Skip to content

Editors beyond VS Code ​

The VS Code extension is the fully integrated path, but every CLAP build can emit a compilation database — the standard compile_commands.json that most C/C++ editor tooling already understands.

bash
clap build main.c --compile-commands

The file lands next to the output binary by default; use --compile-commands-output compile_commands.json to control the location, or the compile_commands = true project setting to always emit it. Everything below builds on that one file.

Neovim / Vim with clangd ​

With clangd installed, point your LSP client at the project root — clangd finds compile_commands.json automatically:

lua
-- minimal nvim-lspconfig setup
require("lspconfig").clangd.setup({})

If the database is not in the project root, pass its directory with --compile-commands-dir:

lua
require("lspconfig").clangd.setup({
  cmd = { "clangd", "--compile-commands-dir=." },
})

You get completion, hover, go-to-definition, and inline diagnostics driven by the exact flags CLAP compiles with — including the vendored include paths and the pinned toolchain's standard library.

Emacs (lsp-mode / eglot) ​

eglot and lsp-mode both use clangd the same way; no CLAP-specific configuration is needed beyond generating the database. Regenerate it after changing flags or adding files — or wire a file-watcher hook to run clap build --compile-commands on save.

CLion and other CMake-first IDEs ​

CLion does not consume compile_commands.json as a project model, but CLAP does not ask you to abandon CMake: clap build --backend cmake drives an existing CMakeLists.txt with the pinned toolchain while the IDE keeps using the same project natively. You can open the project in CLion as a plain CMake project and use CLAP from the terminal or CI — the two do not conflict.

Zed, Helix, Sublime, Qt Creator ​

Anything that speaks clangd or reads a compilation database works unchanged: generate compile_commands.json once per flag change and point the editor's C/C++ language server at the project. Nothing CLAP-specific is required — that is the point of emitting standard metadata instead of a proprietary project format.