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