LSP: Language-Server Eyes for Agents
The win is automatic ERRORs after edit—not hoping the model remembers to ask.
In short
@piex-dev/lsp answers IDE questions—and appends ERRORs after edit/write so the model does not have to remember to re-check.
Background
Without LSP, agents lean on read/grep and guesswork. Signature changes miss call sites; type errors wait for full builds.
@piex-dev/lsp adds navigation, diagnostics, rename/code actions, and a post-edit ERROR loop.
How it works
stdio JSON-RPC; rootMarkers for discovery; publishDiagnostics cache. On edit/write: sync disk (didOpen/didChange) → wait → ERROR-only cap attached to the tool result.
Implementation
initOptions/settings wired correctly; multi-server diagnostics with linter vs primary routing; rename defaults to preview; WorkspaceEdit confined to cwd. Disable post-edit with PI_LSP_DIAGNOSTICS_ON_EDIT=0.
Design notes
| Project | Mechanism | piex choices |
|---|---|---|
| oh-my-pi lsp | Full LSP client: multi-server routing, didChange, full action surface, diagnostics aggregation | Adopted: JSON-RPC client, defaults.json driver, on-demand startup/session reuse, multi-server aggregation. Dropped: Bun runtime (switched to Node), full action surface |
| OpenCode post-edit diagnostics | tool_result hook intercepts edit/write → waits for publishDiagnostics → ERROR only, per-file cap | Adopted the full pattern: sync → wait → only ERROR → cap 20 → skip on clean files |
| VS Code LSP | initialize + settings/didChangeConfiguration + workspace/configuration | Borrowed: initOptions/settings correct delivery path; full-text didChange; which lookup in node_modules/.bin and .venv |
Key tradeoff: post-edit ERROR loop first (from OpenCode), diagnostics over navigation surface; linters do not steal the primary's navigation role.
Roadmap
Done: correctness, post-edit diagnostics, rename/code_actions. Tests: bun test packages/lsp. Next: project .lsp.json, module split, fake-server tests, indexing readiness. Deferred: lspmux, auto-download, completion.
Source Markdown: docs/notes/lsp.md