LSP-clangd
C/C++ support for Sublime's LSP plugin provided through clangd.
Details
Installs
- Total 20K
- Win 9K
- Mac 3K
- Linux 8K
Aug 26 | Aug 25 | Aug 24 | Aug 23 | Aug 22 | Aug 21 | Aug 20 | Aug 19 | Aug 18 | Aug 17 | Aug 16 | Aug 15 | Aug 14 | Aug 13 | Aug 12 | Aug 11 | Aug 10 | Aug 9 | Aug 8 | Aug 7 | Aug 6 | Aug 5 | Aug 4 | Aug 3 | Aug 2 | Aug 1 | Jul 31 | Jul 30 | Jul 29 | Jul 28 | Jul 27 | Jul 26 | Jul 25 | Jul 24 | Jul 23 | Jul 22 | Jul 21 | Jul 20 | Jul 19 | Jul 18 | Jul 17 | Jul 16 | Jul 15 | Jul 14 | Jul 13 | Jul 12 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 13 | 14 | 11 | 16 | 13 | 13 | 15 | 13 | 8 | 15 | 15 | 9 | 11 | 21 | 9 | 21 | 8 | 15 | 12 | 17 | 16 | 18 | 8 | 3 | 8 | 10 | 8 | 6 | 6 | 10 | 15 | 11 | 9 | 9 | 14 | 10 | 9 | 4 | 2 | 12 | 13 | 9 | 15 | 20 | 10 | 7 |
Mac | 1 | 5 | 6 | 0 | 11 | 5 | 2 | 5 | 4 | 3 | 3 | 0 | 4 | 1 | 2 | 5 | 6 | 7 | 3 | 3 | 0 | 3 | 2 | 3 | 2 | 4 | 1 | 2 | 2 | 6 | 3 | 3 | 5 | 5 | 3 | 4 | 4 | 4 | 3 | 8 | 4 | 3 | 6 | 4 | 5 | 1 |
Linux | 9 | 10 | 8 | 10 | 15 | 10 | 18 | 12 | 9 | 10 | 12 | 10 | 8 | 4 | 7 | 16 | 19 | 8 | 13 | 6 | 8 | 5 | 9 | 11 | 6 | 11 | 6 | 5 | 18 | 13 | 12 | 7 | 13 | 5 | 6 | 15 | 12 | 9 | 8 | 9 | 9 | 15 | 12 | 14 | 16 | 11 |
Readme
- Source
- raw.githubusercontent.com
LSP-clangd
C/C++ and Objective-C/C++ support for Sublime's LSP plugin provided through clangd.
Installation
- Install LSP and
LSP-clangd
from Package Control - (Optional) Install clangd using your package manager or let this package install clangd for you
Usage
By default, clangd will assume your code is built as clang some_file.cc
, and you’ll probably get errors about missing #include
d files, etc.
For complex projects, clangd needs to know your build flags. This can be done using a compile_commands.json
or compile_flags.txt
file.
For CMake-based projects a compile_commands.json
file can be generated using the -DCMAKE_EXPORT_COMPILE_COMMANDS=1
flag.
cd build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ..
# compile_commands.json will be written to your build directory.
If your build directory is equivalent to the root of the project or <project_root>/build
then clangd will find it. Otherwise, symlink or copy it to the root of your project.
See clangd Project Setup for more information on using
compile_commands.json
,compile_flags.txt
and other build systems.
Configuration
Here are some ways to configure the package and the language server.
- From
Preferences > Package Settings > LSP > Servers > LSP-clangd
- From the command palette:
Preferences: LSP-clangd Settings
- Project-specific configuration.
From the command palette run
Project: Edit Project
and add your settings in:
{
"settings": {
"LSP": {
"clangd": {
"initializationOptions": {
// Put your settings here eg.
// "clangd.header-insertion": "iwyu",
}
}
}
}
}
Sublime Commands
Sublime Command | Description |
---|---|
lsp_clangd_switch_source_header |
Switch between the main source file (.cpp) and header (.h). |