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