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
tools:
modules:
lsp:
config:
# Optional overrides. Empty config uses built-in probes.
settle_seconds: 10
# servers:
# pyright:
# command: "pyright-langserver --stdio"
# extensions: [".py"]
Tools
| Action | Purpose |
|---|---|
lsp.diagnostics | Return current diagnostics for a file. |
lsp.notify_change | Report that a file changed (optional new content) and return diagnostics. |
Not implemented: lsp.check, lsp.request, lsp.cancel_request.
Short alias when promoted: LintCheck → lsp.diagnostics.
Typical diagnostics response shape
{
"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):
| Language | Typical command |
|---|---|
| Python | pyright-langserver --stdio (or ruff CLI fallback) |
| TypeScript / JS | typescript-language-server --stdio |
| Go | gopls |
| Rust | rust-analyzer |
Install the language server on the host; Digitorn does not bundle them.
Cross-references
- Hook wiring: Tool Hooks
- Module reference: lsp module
- Filesystem edits: filesystem