larik v0.25.0

Guide

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_edit or write changes a file, Larik syncs it to the file's language server and appends new errors and warnings to the tool result, for example ERROR 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 lsp tool (read-only) offers definition, references, hover, symbols, workspace_symbols, diagnostics and code_actions, using the 1-based line and column that read shows.

  • Code actions: code_actions lists a server's quick fixes and refactorings for a line, such as adding a missing import or organizing imports. The model applies one with apply_code_action and the action's title. That writes files, so it asks like edit (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 through workspace/applyEdit while 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 like go.mod, package.json or Cargo.toml). Servers shut down when Larik exits, and their logs go to ~/.local/share/larik/logs/lsp-<name>.log.

  • Configuration:

    json
    {
      "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.json can 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.

  • /lsp shows servers and their status. /lsp-config (also Language servers in /config) lists built-ins and personal overrides. Toggle built-ins, or add/edit/delete personal custom servers with comma-separated command argv, extensions and root markers, a language ID, and environment key/value entries. Command arguments are passed directly, not through a shell. Save asks before rebuilding services and starting a fresh model context; if reload is unavailable, run /reload later. The editor reads personal settings only, never copying commands from shared project settings. initialization_options has no schema-independent native editor: edit it only in ~/.config/larik/config.json; the panel preserves it and other unknown fields when saving.

Generated from README.md · section “Language servers (LSP)”. Edit that file to change this page.