Wefti

An evaluated alternative to neocmakelsp and cmake-language-server

Most CMake language servers read the text of a file. wefti-lsp also configures the project in memory, so its answers come from what CMake would do.

wefti-lsp is a CMake language server that evaluates your project with the Wefti engine. It gives hover with the real value and its origin, dims if() branches that did not run, completes installed packages in find_package() and targets in target_link_libraries(), and writes compile_commands.json on save. It works in VS Code, Cursor, Windsurf, Zed, Neovim, Helix, Emacs, Sublime Text, and CLion.

What the evaluator adds

A server that reads only text cannot know which if() branch ran or what value a variable has after three include() calls. wefti-lsp configures the project in memory over your unsaved buffers, and it shows what CMake will do, not only what the file contains.

The language server also handles *.cmake.in templates. It replaces @NAME@ placeholders at command position with spaces of the same length before it parses, so diagnostics and positions stay correct.

Completion for packages, targets, and presets

The Zed extension attaches the server to CMake files only. Zed opens CMakePresets.json as JSON, so preset completion is not available in Zed.

Editor support

Wefti LSP setup by editor
EditorSetupNotes
VS Code, Cursor, WindsurfFirst-party extension in editors/vscodeFinds wefti-lsp without settings. Adds a preset picker and configure debugging.
ZedFirst-party extension in editors/zedFinds the server on PATH or downloads the latest release.
Neovim 0.11 and latervim.lsp.config or editors/neovim/wefti.luaAlso works with nvim-lspconfig.
Helixeditors/helix/languages.tomlRun hx --health cmake to check the server.
EmacsEglot entry for wefti-lspWorks with cmake-mode and cmake-ts-mode.
Sublime TextLSP package clientUses the source.cmake scope.
CLionLSP4IJ pluginShows results next to the built-in CMake support.

Turn off other CMake language servers on the same buffers, such as neocmake or cmake, so you do not get duplicate results.

-- Neovim 0.11 and later
vim.lsp.config("wefti", {
  cmd = { "wefti-lsp" },
  filetypes = { "cmake" },
  root_markers = { "CMakePresets.json", ".git" },
})
vim.lsp.enable("wefti")
# Helix, in ~/.config/helix/languages.toml
[language-server.wefti-lsp]
command = "wefti-lsp"

[[language]]
name = "cmake"
language-servers = ["wefti-lsp"]

Set up wefti-lsp in your editor

These steps work in any editor. Only the second step changes.

  1. Install Wefti. The installer adds wefti, wefti-lsp, and the CMake data. Make sure wefti-lsp is on your PATH.
  2. Connect your editor. Install the extension for VS Code, Cursor, Windsurf, or Zed, or add the Neovim or Helix setup shown below.
  3. Pick a build directory or preset. Set buildDirectory or configurePreset in the client, or build_dir and preset in the [lsp] table of .wefti.toml.
  4. Open a CMakeLists.txt file. Hover over a target to see where each usage requirement comes from. Branches of if() that did not run are dimmed.
  5. Check compile_commands.json. Save a listfile. After 500 ms the server writes <build>/compile_commands.json, and clangd sees the new sources and flags.

Frequently asked questions

What is an alternative to neocmakelsp?

wefti-lsp is a CMake language server in Rust that also evaluates the project in memory. It gives hover with real values, dimmed dead branches, 12 lint rules with quick fixes, and compile_commands.json sync.

What is an alternative to cmake-language-server?

wefti-lsp needs no Python. Run it as wefti-lsp or wefti lsp over standard input and output, and it works in any editor with an LSP client.

Which CMake language server works in VS Code, Neovim, Zed, and Helix?

wefti-lsp works in all four. VS Code and Zed have first-party extensions. Neovim 0.11 and Helix need a few lines of configuration, and both are in the repository.

Does it complete find_package, target_link_libraries, and CMakePresets.json?

Yes. It completes installed packages in find_package(), targets in target_link_libraries(), and keys, preset names, and macros in preset files. The Zed extension does not attach to CMakePresets.json.

How does the server keep clangd up to date?

After you save a listfile, wefti-lsp waits 500 ms and writes <build>/compile_commands.json from the in-memory configure result. It needs a configured build directory and the setting must not be false.

Does the language server change my files?

No, except for formatting and quick fixes that you accept. Formatting uses wefti fmt, which confirms that the syntax tree and comments are unchanged before it writes.