Language servers (LSP)
Larik runs language servers so the model gets compiler feedback on its own edits and can navigate code semantically.
-
Diagnostics after edits: when
edit,multi_editorwritechanges a file, Larik syncs it to the file's language server and appends new errors and warnings to the tool result, for exampleERROR 5:19 undefined: gret (compiler). Errors the change caused in other files are summarized. Reading a file warms up the server in the background. -
The
lsptool (read-only) offersdefinition,references,hover,symbols,workspace_symbols,diagnosticsandcode_actions, using the 1-based line and column thatreadshows. -
Code actions:
code_actionslists a server's quick fixes and refactorings for a line, such as adding a missing import or organizing imports. The model applies one withapply_code_actionand the action's title. That writes files, so it asks likeedit(accept-edits mode allows it inside the project), each changed file gets an undo snapshot, and the result shows new diagnostics. Actions that create, rename or delete files aren't applied. A server can only change files throughworkspace/applyEditwhile an action you approved is running. -
Pull diagnostics: servers that answer
textDocument/diagnostic(LSP 3.17) are asked for diagnostics directly after an edit instead of Larik waiting for them to publish. -
Built-in servers are enabled automatically when their binary is on your
PATH: gopls, typescript-language-server, pyright-langserver, rust-analyzer and clangd. Each starts on the first matching file, once per project root (found from markers likego.mod,package.jsonorCargo.toml). Servers shut down when Larik exits, and their logs go to~/.local/share/larik/logs/lsp-<name>.log. -
Configuration:
{ "lsp": { "gopls": { "initialization_options": { "staticcheck": true } }, "clangd": { "disabled": true }, "zls": { "command": ["zls"], "extensions": [".zig"], "root_markers": ["build.zig"] } } }New server commands are honored only from personal files (
~/.config/larik/config.json, private project settings). A shared.larik/settings.jsoncan only disable servers. -
Timing: edits wait for fresh diagnostics for up to 3s (15s while a server is still loading the project). Servers that stay silent on clean files get a shorter wait.
-
/lspshows servers and their status.