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