This is CMake extension for Zed editor. It combines uyha/tree-sitter-cmake and Decodetalkers/neocmakelsp (hence why it's "neo"). The tree-sitter grammar is taken from helix repo.
For making clangd and cmake work together do the following:
- Add
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
at the top of theCMakeLists.txt
(somewhere belowproject
); - Reconfigure cmake project. If everything is correct there should be
compile_commands.json
file under build directory. I also advise usingCXX=clang
for better compatibility with clangd; - Go to Zed's
settings.json
: Ctrl+Shift+Popen local settings
/open default settings
; - Find
lsp
section. Inside it paste the following (replacebuild
with your build directory name):
"clangd": {
"arguments": ["-background-index", "-compile-commands-dir=build"]
}
The extension now provides 5 tasks to start with:
CMake configure Debug
CMake configure Release
CMake build Debug/Release
- builds what is configured beforehandCMake configure and build Debug
CMake configure and build Release
All tasks use build
directory for building