Zen C comes with a built-in Language Server (LSP) to provide editor features like autocompletion, go-to-definition, and error diagnostics.
The Language Server is built into the zc compiler key. You can start it manually (though your editor usually handles this) with:
zc lspIt communicates over standard input/output (stdio).
For Visual Studio Code, use the official Zen C extension:
- Repository: zenc-lang/vscode-zenc
Install the extension directly from the Visual Studio Code Marketplace.
Alternatively, you can build the .vsix from source.
Support for Vim and Neovim is provided via the Zen-C.vim plugin, which includes syntax highlighting and LSP configuration helpers.
- Repository: davidscholberg/Zen-C.vim
If you are using nvim-lspconfig, you can register zc as a custom server:
local lspconfig = require('lspconfig')
local configs = require('lspconfig.configs')
if not configs.zenc then
configs.zenc = {
default_config = {
cmd = { 'zc', 'lsp' },
filetypes = { 'zenc', 'zc' },
root_dir = lspconfig.util.root_pattern('.git', 'build.bat', 'Makefile'),
settings = {},
},
}
end
lspconfig.zenc.setup {}To configure Zen C in Zed, add the following to your settings.json or language configuration:
{
"lsp": {
"zenc": {
"binary": {
"path": "zc",
"arguments": ["lsp"]
}
}
},
"languages": {
"Zen C": {
"language_servers": ["zenc"]
}
}
}For any editor that supports generic LSP clients:
- Command:
zc - Arguments:
lsp - Transport:
stdio - File Extensions:
.zc
- Diagnostics: Real-time syntax and type errors.
- Go to Definition: Jump to struct, function, and variable definitions.
- Autocompletion: Context-aware suggestions for fields and methods.
- Hover: Type information and documentation on hover (including custom DSL plugins).