C / C++
Language server: clangd
clangd ships with LLVM:
# macOSbrew install llvm
# Ubuntu/Debianapt install clangd
# or download from https://github.com/clangd/clangd/releasesRequirements
Section titled “Requirements”compile_commands.jsonin the project root or build directory- clangd in PATH
Generate compile_commands.json
Section titled “Generate compile_commands.json”clangd needs compile commands to resolve includes:
# CMakecmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -B buildln -s build/compile_commands.json .
# Bear (for Makefiles)bear -- make
# Meson# Generated automatically in the build directoryWithout compile_commands.json, clangd can’t resolve #include directives and symbol resolution will be degraded.
Supported Operations
Section titled “Supported Operations”find symbol— functions, classes, structs, enumshover— types and declarationscheck— clangd diagnosticsedit replace— function/class bodiesrename— cross-file renamelist symbols— file outline
CMakeLists.txt Detection
Section titled “CMakeLists.txt Detection”Krait detects CMakeLists.txt as the project root marker for C/C++ projects.