IDE integration
Luban-managed projects work in any editor that speaks LSP, with zero configuration. The contract is:
clangdis on PATH (provided byluban env --user)compile_commands.jsonis at the project root (produced byluban build)- cmake is on PATH (so
cmake --presetworks for any "configure-via-cmake-tools" extensions)
If those three are true, the IDE attaches clangd, finds the right toolchain, and gives you autocomplete + diagnostics + jump-to-definition out of the box.
Neovim
If you use nvim-lspconfig:
require('lspconfig').clangd.setup{}
That's it. clangd will find compile_commands.json automatically (project root + a few common subdirs).
VS Code / Cursor
Install clangd extension. Done.
The clangd extension auto-detects compile_commands.json. The bundled C/C++ extension by Microsoft is not needed for clangd workflow (and conflicts with it; disable for this workspace).
For cmake-tools experience (preset selector, build/run buttons), also install CMake Tools extension — it picks up CMakePresets.json automatically.
CLion / RustRover / other JetBrains
CLion auto-detects cmake projects via CMakePresets.json. Just open the project root.
What if it doesn't work?
Things to check:
luban env --userwas run in a previous shell? Open a fresh terminal and re-checkclangd --version.luban buildwas run at least once?compile_commands.jsononly exists after a build.luban newruns a build automatically; if you passed--no-build, runluban buildmanually.compile_commands.jsonis in the project root? Should be a copy ofbuild/<preset>/compile_commands.json. If not,luban buildre-syncs it.- Right clangd version?
which clangdshould point at<data>/luban/bin/clangd.cmd(or, after future M3,clangd.exe). Stale system clangd may shadow ours.
Why it works without config
clangd reads compile_commands.json (a list of {file, command, directory} JSON objects produced by cmake). Each entry has the full compile command, including -I, -D, -std=..., and the actual clang++.exe absolute path. clangd uses that compile command verbatim — no guessing.
Because the path to clang++.exe is absolute (luban-managed toolchain), clangd auto-discovers the matching system headers / libc++ via the compiler's resource directory. You never need to set --query-driver or compile_flags.txt.
Why "compile_commands.json at project root" matters
clangd searches a fixed list of locations for compile_commands.json:
<project>/compile_commands.json<project>/build/compile_commands.json<project>/build/<some-preset>/compile_commands.json
luban build always copies to (1), the most reliable location. This is plain cmake convention; any IDE with clangd integration knows about it.