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