LSP-clangd
C/C++ support for Sublime's LSP plugin provided through clangd.
Details
Installs
- Total 23K
- Win 10K
- Mac 4K
- Linux 9K
| Jan 17 | Jan 16 | Jan 15 | Jan 14 | Jan 13 | Jan 12 | Jan 11 | Jan 10 | Jan 9 | Jan 8 | Jan 7 | Jan 6 | Jan 5 | Jan 4 | Jan 3 | Jan 2 | Jan 1 | Dec 31 | Dec 30 | Dec 29 | Dec 28 | Dec 27 | Dec 26 | Dec 25 | Dec 24 | Dec 23 | Dec 22 | Dec 21 | Dec 20 | Dec 19 | Dec 18 | Dec 17 | Dec 16 | Dec 15 | Dec 14 | Dec 13 | Dec 12 | Dec 11 | Dec 10 | Dec 9 | Dec 8 | Dec 7 | Dec 6 | Dec 5 | Dec 4 | Dec 3 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Windows | 4 | 11 | 10 | 19 | 16 | 6 | 13 | 7 | 19 | 11 | 9 | 13 | 8 | 11 | 9 | 19 | 19 | 4 | 5 | 5 | 6 | 14 | 15 | 11 | 11 | 13 | 14 | 10 | 8 | 18 | 5 | 15 | 11 | 9 | 8 | 6 | 9 | 12 | 11 | 13 | 8 | 15 | 7 | 16 | 6 | 14 |
| Mac | 0 | 5 | 7 | 4 | 9 | 5 | 4 | 4 | 3 | 4 | 3 | 0 | 6 | 9 | 4 | 6 | 10 | 3 | 4 | 5 | 2 | 3 | 5 | 3 | 2 | 5 | 7 | 3 | 4 | 1 | 4 | 5 | 5 | 3 | 1 | 9 | 2 | 1 | 5 | 0 | 2 | 2 | 4 | 4 | 5 | 13 |
| Linux | 1 | 11 | 14 | 10 | 10 | 17 | 16 | 16 | 15 | 13 | 19 | 14 | 11 | 14 | 8 | 21 | 30 | 7 | 11 | 7 | 14 | 11 | 9 | 10 | 8 | 16 | 12 | 14 | 11 | 15 | 11 | 12 | 6 | 7 | 5 | 13 | 13 | 15 | 7 | 11 | 13 | 4 | 19 | 14 | 14 | 19 |
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-clangdfrom 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 #included 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.txtand 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 Projectand 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). |