2026-07-19 LSP Diagnostics Extension

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

ProjectMechanismpiex choices
oh-my-pi lspFull LSP client: multi-server routing, didChange, full action surface, diagnostics aggregationAdopted: 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 diagnosticstool_result hook intercepts edit/write → waits for publishDiagnostics → ERROR only, per-file capAdopted the full pattern: sync → wait → only ERROR → cap 20 → skip on clean files
VS Code LSPinitialize + settings/didChangeConfiguration + workspace/configurationBorrowed: 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.