ZZ LSP — Editor Configuration
The ZZ language server (zz-lsp) provides diagnostics, completion,
hover, go-to-definition, find-references, rename, code actions,
formatting, inlay hints, semantic tokens, and folding ranges.
Building
Section titled “Building”cargo build --release -p zz_lspVS Code / VSCodium
Section titled “VS Code / VSCodium”Install the ZZ Language extension, or configure manually in
.vscode/settings.json:
{ // Point to the zz-lsp binary. "zz.languageServer.path": "target/release/zz-lsp",
// Optional: enable format-on-save. "[zz]": { "editor.defaultFormatter": "your-publisher.zz-lang", "editor.formatOnSave": true }}If using a custom build path, set zz.languageServer.path to the
absolute path of your zz-lsp binary.
Neovim (nvim-lspconfig)
Section titled “Neovim (nvim-lspconfig)”-- In your LSP setup (e.g. after/lsp/zz.lua or init.lua):local lspconfig = require("lspconfig")local configs = require("lspconfig.configs")
-- Register the config if not already present.if not configs.zz_lsp then configs.zz_lsp = { default_config = { cmd = { "zz-lsp" }, filetypes = { "zz" }, root_dir = lspconfig.util.root_pattern(".git", "*.zz"), }, }end
-- Start the server.lspconfig.zz_lsp.setup({})
-- Completion while typing: Neovim's built-in completion only pops-- automatically on trigger characters unless autotrigger is on.-- Enable it so keywords, builtins, and scope items appear as you type-- (the server advertises `.`, `(`, `{`, `:` triggers for members,-- selective imports, struct literals, and annotations).vim.api.nvim_create_autocmd("LspAttach", { callback = function(args) local client = vim.lsp.get_client_by_id(args.data.client_id) if client and client.name == "zz_lsp" then vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = true }) end end,})
-- Optional: format on save.vim.api.nvim_create_autocmd("BufWritePre", { pattern = "*.zz", callback = function() vim.lsp.buf.format({ async = false }) end,})Add the file type detection:
vim.filetype.add({ extension = { zz = "zz" } })Add to ~/.config/helix/languages.toml:
[language-server.zz-lsp]command = "zz-lsp"
[[language]]name = "zz"language-servers = ["zz-lsp"]auto-format = trueFeatures
Section titled “Features”| Feature | Description |
|---|---|
| Diagnostics | Real-time error and warning reporting |
| Completion | Context-aware completions for variables, functions, fields, import paths (stdlib, local modules, installed zz.toml dependencies) |
| Hover | Type and documentation on hover |
| Go-to-definition | Navigate to symbol definitions (cross-file) |
| Find references | Find all uses of a symbol (defining file + importers; fresh buffers preferred) |
| Rename | Rename a symbol across the defining file and its importers (qualified ns.name keeps its qualifier) |
| File watching | External edits to .zz/zz.toml/zz.lock re-index and recheck open dependents transitively; saving a file rechecks its open dependents (unchanged files with an unchanged seed skip the checker) |
| Code actions | Quick fixes for diagnostics (unused vars, typos) + auto-import for workspace and installed-package symbols |
| Code lenses | Run test buttons above @test functions (executes zz test --filter <name> --exact) |
| Refactors | Extract variable/function, inline variable, move to new file |
| Manifest diagnostics | Malformed zz.toml surfaces as a file-level error so broken imports stop being a mystery |
| Formatting | zz fmt style via textDocument/formatting |
| Inlay hints | Parameter names at call sites + inferred types on unannotated bindings |
| Semantic tokens | Syntax highlighting from the AST |
| Folding ranges | Collapse function bodies, structs, loops |
| Workspace symbols | Search symbols across the workspace |
| Document symbols | Outline view for a single file |
Logging
Section titled “Logging”The server uses the log crate with env_logger. Set the RUST_LOG
environment variable to enable debug output:
RUST_LOG=debug zz-lsp # verbose loggingRUST_LOG=zz_lsp=trace zz-lsp # trace-level for zz_lsp onlyWhen using an editor, set the environment variable in your editor
configuration so that zz-lsp inherits it.
CLI Formatter
Section titled “CLI Formatter”Format files from the command line:
zz fmt . # format all .zz files in-placezz fmt -c src/ # check formatting without writing (exit 1 if changed)zz fmt hello.zz # format a single file