Quick Start
Editor Plugins
clice implements the Language Server Protocol. Any editor that supports this protocol can work with clice to provide features like code completion, diagnostics, hover, semantic highlighting, and more.
Beyond the standard protocol, clice also supports some protocol extensions. For better integration, using a dedicated clice plugin is recommended.
See Editor Setup for per-editor instructions: official plugins for Visual Studio Code, Neovim and Zed, plus configuration snippets for editors with generic LSP clients (Helix, Emacs, Sublime Text, Kate, Vim).
Installation
Download Prebuilt Binary
Download the latest binary from the Releases page.
Build from Source
See build from source for detailed instructions.
Project Setup
For clice to correctly understand your code (e.g., find header file locations), you need to provide a compile_commands.json file, also known as a compilation database. The compilation database provides compilation options for each source file.
By default, clice searches your workspace root and each of its immediate subdirectories (e.g. build/) for compile_commands.json, using the first one it finds. You can specify exact paths with the compile_commands_paths option in clice.toml.
CMake
Add -DCMAKE_EXPORT_COMPILE_COMMANDS=ON during configuration:
cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ONThis generates compile_commands.json in the build directory.
WARNING
This option only works with Makefile and Ninja generators. For other generators (e.g., Visual Studio), use an alternative approach below.
Bazel
Use bazel-compile-commands-extractor:
bazel run @hedron_compile_commands//:refresh_allVisual Studio
For CMake projects in Visual Studio (2019 16.1+), configure in CMakeSettings.json:
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"buildRoot": "${projectDir}\\build",
"cmakeCommandArgs": "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
}
]
}For MSBuild projects (.vcxproj), use catter to generate the compilation database.
Makefile
Use bear to intercept compilation commands:
bear -- makeRun make clean before bear -- make to ensure all commands are captured.
Meson
Meson generates a compilation database automatically:
meson setup buildXmake
xmake project -k compile_commands --lsp=clangd buildOr configure the Xmake VS Code extension to auto-generate:
"xmake.compileCommandsDirectory": "build"Others
For any other build system, use catter — a fake-compiler approach that works with any build system.