Files
hx/docs/adr/0022-lsp-protocol-quirks.md
johannesandClaude Sonnet 5.5 a94632ea3d chore: delete code comments, add ratchet lint and ADRs
Classify every comment as tautology, stale, excuse or decision record.
Tautology/stale/excuse comments are deleted (excuses filed as issues
#196-#236), decisions moved to docs/adr/0001-0034.

- scripts/lint-comments.sh + .comment-baseline: per-file comment count
  may only go down; wired into tests/all.sh
- .claude/skills/delete-comment: repeatable audit workflow
- cargo fmt applied to touched crates

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-21 13:37:32 +01:00

1.4 KiB

Handling of LSP server quirks and root selection

Status: accepted

Context

Language servers behave inconsistently: some send workspace/configuration requests expecting an array of results; the rustup rust-analyzer proxy exits immediately when the component is not installed; servers still indexing answer requests with -32801 (ContentModified) or -32802 (ServerCancelled). Rust and TypeScript workspaces have nested markers (inner Cargo.toml / package.json), but servers must be started at the workspace root.

Decision

  • Server requests: workspace/configuration gets an array of nulls sized to the request; all other server requests get a null result.
  • A server that exits immediately (rustup proxy without component) is treated as not installed, not as a crash.
  • Requests failing with -32801/-32802 are retried briefly, since the server is still indexing.
  • Root resolution for rust/ts keeps climbing to the outermost marker below the stop dir; the outermost Cargo.toml wins (workspace root); with no marker the workspace root is used.
  • A fake rust-analyzer test models that the first (empty) publish after a change must not be taken as the result.

Consequences

Servers are keyed by (language, outermost root), so one server serves a whole workspace. Retries add bounded latency.

Code: crates/hx-lens/src/lsp.rs (server request handler), crates/hx-lens/src/manager.rs (start, request, root detection, fake rust-analyzer test)