packages/shared-skills/skills/lsp-setup/references/c-cpp/README.md
clangd — clangd --background-index --clang-tidy.c .cpp .cc .cxx .c++ .h .hpp .hh .hxx .h++https://clangd.llvm.org/installationbrew install llvm (clangd ships in the LLVM keg; add its bin to PATH)apt install clangd (Debian/Ubuntu); use your distro package elsewherehttps://releases.llvm.org or winget install LLVM.LLVMSee https://clangd.llvm.org/installation for other platforms.
Confirm it resolves:
command -v clangd
Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in .codex/lsp-client.json (Codex) AND .opencode/lsp.json (OpenCode/omo):
{ "lsp": { "clangd": { "priority": 100 } } }
For builtin ids in a PROJECT config, command is supplied automatically — only set priority/initialization/extensions/disabled/env. A fully custom (non-builtin) server with its own command must go in the USER config (~/.codex/lsp-client.json).
None commonly required. clangd reads flags from a project .clangd file rather
than initializationOptions. The builtin command already passes
--background-index --clang-tidy.
clangd needs a compile_commands.json at the project root (or in build/) for
accurate diagnostics and cross-file navigation. Generate it with:
cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON (symlink/copy build/compile_commands.json to the root)bear -- makeWithout it, clangd falls back to heuristic flags and reports spurious errors.
None builtin. ccls exists as a third-party server but is not builtin — it would
need a custom command in the USER config.
clangd must be on PATH; reopen shell after install. Homebrew LLVM is keg-only — add $(brew --prefix llvm)/bin to PATH.compile_commands.json — regenerate it after changing the build..clangd CompileFlags block.bun ../../scripts/verify-lsp.ts path/to/file.cpp