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