Editor Setup
clice implements the Language Server Protocol, so any editor with an LSP client can use it. The editors below fall into two groups: editors with an official clice plugin, and editors configured through their generic LSP client.
All setups assume:
- The
cliceexecutable is on yourPATH(or use an absolute path in the snippets below); the VS Code extension ships its own, and the Zed extension downloads one when there is none. - Your project provides a
compile_commands.json(by default clice searches the project's root directory, then each of its immediate subdirectories without aclice.tomlor.clice/config.tomlof its own).
Compiler Environment
clice asks the compiler of each command how it compiles (its target, its system headers, its default standard), and runs it in the environment the editor starts clice with. A compiler that needs more gets it from the editor's setting for clice's environment: a Cygwin or MSYS2 compiler on Windows, for one, needs its runtime's bin directory on PATH.
VS Code:
clice.serverEnv, whose values name VS Code's own variables as${env:NAME}, asterminal.integrated.env.*does:json{ "clice.serverEnv": { "PATH": "C:\\cygwin64\\bin;${env:PATH}" } }Neovim:
cmd_env:luavim.lsp.config('clice', { cmd_env = { PATH = 'C:\\cygwin64\\bin;' .. vim.env.PATH } })Zed:
lsp.clice.binary.env, whose values are taken as written.
Official Plugins
Visual Studio Code
Install the clice extension from the marketplace; Cursor, VSCodium, Windsurf and other VS Code forks install the same extension from Open VSX. Published builds are platform-specific and ship the clice server inside the extension, so no download or network access is needed after installation; set clice.executable to use your own build instead.
The context menu of an editor clice serves holds clice's commands, below Go to Definition and its kin: Switch Header and Source (Module Interface and Implementation); Switch Compilation Context when the file has more than one context, which the Explorer's Compilation Contexts view lists too; Switch Build Configuration when the rules declare configurations, which restarts the server under the one picked; and Show Compile Command, which opens the file's whole compile command and says where it comes from — a compilation database, the source including a header, a rule's default_command, a unit nearby, or clice's own. A compile that runs long shows its progress in the status bar, as it does in every editor that shows progress.
Neovim
On Neovim 0.11 or later with nvim-lspconfig installed, enable clice:
vim.lsp.enable('clice')nvim-lspconfig carries a copy of the config in editors/nvim, updated after it; without nvim-lspconfig or ahead of its copy, copy lsp/clice.lua from there into the after/lsp/ directory of your config, which takes precedence over nvim-lspconfig's. The config adds commands that show and switch the compilation context of a buffer; the README lists them, along with the features Neovim leaves to your config, such as inlay hints and completion as you type.
Zed
The Zed extension lives in editors/zed. It runs lsp.clice.binary.path when set, with lsp.clice.binary.arguments, which must include serve; else clice from PATH, else downloads the newest release; lsp.clice.settings.release_channel set to "pre-release" follows the nightly builds instead.
Zed runs its built-in clangd for C and C++ as well, which duplicates completion and diagnostics; to use clice alone:
{
"languages": {
"C": { "language_servers": ["clice", "!clangd", "..."] },
"C++": { "language_servers": ["clice", "!clangd", "..."] }
}
}Zed builds its outline panel and breadcrumbs with tree-sitter by default; to have them show clice's document symbols, turn on document_symbols for C and C++ in Zed's settings.json:
{
"languages": {
"C": { "document_symbols": "on" },
"C++": { "document_symbols": "on" }
}
}Generic LSP Clients
An editor without a clice plugin, Zed included, switches what a file compiles under from its code action menu: asked for actions, clice offers source actions that compile a header as included by another of its hosts, or a source with another of its commands (source.clice.context), go back to the context clice picks, and select another build configuration for the next start (source.clice.configuration). Every editor shows the progress of indexing and of a compile that runs long, and the messages that ask the user to fix the setup.
Helix
Add to ~/.config/helix/languages.toml:
[language-server.clice]
command = "clice"
args = ["serve"]
[[language]]
name = "cpp"
language-servers = ["clice"]
[[language]]
name = "c"
language-servers = ["clice"]Emacs
With the built-in eglot:
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
'((c-mode c-ts-mode c++-mode c++-ts-mode)
. ("clice" "serve"))))Sublime Text
Install the LSP package, then add to its settings:
{
"clients": {
"clice": {
"enabled": true,
"command": ["clice", "serve"],
"selector": "source.c | source.c++"
}
}
}Kate
Open Settings → Configure Kate → LSP Client → User Server Settings and add:
{
"servers": {
"c": {
"command": ["clice", "serve"],
"url": "https://github.com/clice-io/clice",
"highlightingModeRegex": "^(C|C\\+\\+)$"
}
}
}Vim
With vim-lsp:
if executable('clice')
au User lsp_setup call lsp#register_server({
\ 'name': 'clice',
\ 'cmd': {server_info->['clice', 'serve']},
\ 'allowlist': ['c', 'cpp'],
\ })
endif