From d3081d6aafb09c8b0ee6b27a5d32ea740d86f724 Mon Sep 17 00:00:00 2001 From: Guoliang Chen Date: Wed, 26 Aug 2026 10:26:03 -0700 Subject: [PATCH] =?UTF-8?q?TODO:=20LSP=203.18=20protocol=20audit=20?= =?UTF-8?q?=E2=80=94=20full=20gap=20list=20as=20=C2=A79,=20round=201=20sco?= =?UTF-8?q?ped?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compared lucisv_server against the LSP 3.18 spec. §9a is the round-1 scope (applyEdit compliance, pull diagnostics, selectionRange), §9b/9c the ranked backlog, §9d the documented skips. Co-Authored-By: Claude Fable 5 --- TODO.md | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/TODO.md b/TODO.md index 0a8bfa8..11084ac 100644 --- a/TODO.md +++ b/TODO.md @@ -627,3 +627,105 @@ section only tracks the milestones. CHANGELOG entry covering M7–M14. - [ ] Backlog (extract module, inline, `.*` expansion, ANSI conversion, organize imports, …) — triaged in the umbrella README after M5. + +## 9. LSP 3.18 protocol audit (2026-08-26) + +Systematic comparison of `lucisv_server` against the LSP 3.18 +specification. What we implement: hover, definition, references, +documentHighlight, documentLink, document/workspace symbols, folding, +semanticTokens/full, inlayHint, completion, inlineCompletion (3.18), +signatureHelp, codeAction + executeCommand, rename + prepare, +callHierarchy, formatting + rangeFormatting, push diagnostics, dynamic +file-watcher registration, configuration push. Below is everything +major that's missing, ordered by priority. The `resolve` endpoints +(completionItem, codeAction, inlayHint, documentLink, workspaceSymbol) +are **deliberately** unadvertised — every item is returned complete — +and are not gaps. + +### 9a. Compliance and high-value (round 1) + +- [ ] **`executeCommand` must deliver its edit via `workspace/applyEdit`.** + Today `ports::execute`'s `WorkspaceEdit` is returned as the request's + *result* (`server.rs`, `ports.rs:79`), which the spec does not define + and standard clients drop on the floor — `vscode-languageclient` does + not apply executeCommand results and `editors/vscode/extension.js` + has no custom handler, so `lucisv.addPort`/`removePort`/`propagate` + invoked as *commands* currently do nothing in every stock client (the + code-action path is unaffected: those carry the edit inline). Fix: + push a `workspace/applyEdit` request, return `null` as the command + result, and read the `ApplyWorkspaceEditResponse` (the one client + response we can no longer ignore wholesale). Gate on the client's + `workspace.applyEdit` capability with the old return-the-edit + behavior as the documented fallback. +- [ ] **Pull diagnostics (3.17): `textDocument/diagnostic` + + `workspace/diagnostic`.** The modern model — client controls timing, + prioritizes visible editors, caches via `resultId`/`unchanged`. + Advertise `DiagnosticOptions` (`inter_file_dependencies: true` — a + save can change other files' diagnostics through the index; + `workspace_diagnostics`), compute from the same parse+lint pass that + feeds `publish`, answer `Unchanged` when the buffer version and index + generation both stand. Keep push for clients that don't send + `text_document.diagnostic` capability; never run both models for the + same client (double diagnostics). +- [ ] **`textDocument/selectionRange`** — expand-selection. Cheap for + us: the scope-pair matcher (`pairs.rs`) and AST spans already give + the nesting chain; walk offset → enclosing token → statement → item → + scope → file, one linked chain per input position. + +### 9b. High-value, next rounds + +- [ ] **Incremental text sync** (`TextDocumentSyncKind::INCREMENTAL`). + Full-buffer sync on every keystroke scales poorly; apply + range-scoped `contentChanges` in order, with a full-text fallback on + any malformed change. Touches `set_document` and the staleness model + in `docs/features/lucisv-server/README.md`. +- [ ] **`textDocument/willSaveWaitUntil`** — the protocol-native + format-on-save hook (client-side `editor.formatOnSave` already works; + this serves the editors without it). +- [ ] **Semantic tokens `range` + `full/delta`** — we set + `range: None` and no delta, so clients re-request whole-file token + sets on every edit. Delta needs `resultId` bookkeeping per buffer. +- [ ] **Work-done progress** — `reindex()` is a synchronous full + rescan on every save with no `window/workDoneProgress` reporting; + on a big filelist the server just goes quiet. +- [ ] **`$/cancelRequest`** — the loop handles requests sequentially + and ignores cancellation; at minimum answer already-cancelled queued + requests with `RequestCancelled`. + +### 9c. Moderate value, Verilog-shaped + +- [ ] **Goto type definition** — from a net/variable use to its + typedef/struct/enum/interface declaration; real value once + `vlog_semantic` tracks declared types of bindings. +- [ ] **Linked editing range** — edit `module m` and its + `endmodule : m` label together (`end : label`, `endfunction : name`, + etc.). A genuinely good fit for SV's closing labels. +- [ ] **Code lens** — "N instantiations" above each module header from + the hierarchy index; `codeLens/resolve` unnecessary (counts are + cheap), `workspace/codeLens/refresh` on reindex. +- [ ] **On-type formatting** — conspicuous absence for a + formatter-first server; candidate trigger: newline (indent the new + line per block nesting), `;` (reformat the finished statement). +- [ ] **Type hierarchy (3.17)** — arguably the semantically correct + home for the module hierarchy (and later interface/class extends + chains); keep callHierarchy as the compatibility surface. +- [ ] **File operations** — `workspace/willRenameFiles`: renaming a + `.sv/.svh` rewrites `` `include`` lines that reference it (the + include graph exists); `didRename/didDelete` as cheaper index nudges + than the watcher round-trip. +- [ ] **`workspace/didChangeWorkspaceFolders`** — roots are read once + at initialize; adding/removing a folder mid-session is ignored. +- [ ] **`workspace/configuration` (server-pull)** — we rely solely on + push `didChangeConfiguration`; clients are moving to the pull model. +- [ ] **3.18 additions:** `textDocument/rangesFormatting` (multi-range, + feeds format-modified-lines), snippet edits in `WorkspaceEdit` + (would improve `addPort` cursor placement), and + `workspace/textDocumentContent` (could serve a read-only "expanded + macro" document). + +### 9d. Deliberately skipped (no Verilog use case) + +Notebook sync, moniker (LSIF), inline value (debugger), document +color, goto implementation, goto declaration (Verilog has no +declaration/definition split lucisv models). Recorded here so the +audit doesn't repeat.