LSP-clangd
C/C++ support for Sublime's LSP plugin provided through clangd.
Details
Installs
- Total 17K
- Win 7K
- Mac 3K
- Linux 7K
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 | Feb 15 | Feb 14 | Feb 13 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 3 | 10 | 10 | 9 | 12 | 12 | 11 | 5 | 4 | 5 | 12 | 6 | 21 | 11 | 7 | 7 | 15 | 15 | 17 | 12 | 7 | 6 | 12 | 6 | 8 | 15 | 11 | 12 | 8 | 12 | 10 | 14 | 12 | 9 | 9 | 8 | 14 | 9 | 10 | 15 | 13 | 5 | 17 | 8 | 6 | 13 |
Mac | 1 | 6 | 4 | 6 | 7 | 4 | 6 | 3 | 2 | 5 | 10 | 3 | 6 | 4 | 8 | 6 | 5 | 1 | 1 | 2 | 4 | 2 | 4 | 5 | 0 | 5 | 2 | 1 | 0 | 3 | 4 | 2 | 4 | 7 | 3 | 2 | 4 | 8 | 4 | 2 | 2 | 3 | 2 | 7 | 7 | 5 |
Linux | 4 | 12 | 15 | 8 | 12 | 2 | 10 | 13 | 7 | 17 | 9 | 9 | 10 | 12 | 7 | 11 | 8 | 8 | 19 | 7 | 10 | 17 | 14 | 14 | 10 | 11 | 9 | 7 | 12 | 9 | 5 | 8 | 6 | 6 | 9 | 18 | 5 | 8 | 13 | 6 | 13 | 10 | 6 | 4 | 15 | 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). |