Skip to main content

LSP - Real-Time Code Diagnostics

The lsp module runs language servers (pyright, gopls, typescript-language-server, ruff, ...) and exposes diagnostics to the agent via two tools: lsp.diagnostics and lsp.notify_change.

Agents can call these tools when the module is granted. Hooks such as lsp_diagnose can also call them after edits.

Module declaration

yaml
tools:
modules:
lsp:
config:
# Optional overrides. Empty config uses built-in probes.
settle_seconds: 10
# servers:
# pyright:
# command: "pyright-langserver --stdio"
# extensions: [".py"]

Tools

ActionPurpose
lsp.diagnosticsReturn current diagnostics for a file.
lsp.notify_changeReport that a file changed (optional new content) and return diagnostics.

Not implemented: lsp.check, lsp.request, lsp.cancel_request.

Short alias when promoted: LintChecklsp.diagnostics.

Typical diagnostics response shape

json
{
"success": true,
"data": {
"diagnostics": [
{
"severity": "error",
"line": 42,
"column": 12,
"message": "Import 'foo' could not be resolved"
}
]
}
}

Exact fields depend on the language server / fallback parser.

Built-in language probes

When no custom servers map is set, the module probes common binaries (examples):

LanguageTypical command
Pythonpyright-langserver --stdio (or ruff CLI fallback)
TypeScript / JStypescript-language-server --stdio
Gogopls
Rustrust-analyzer

Install the language server on the host; Digitorn does not bundle them.

Cross-references