diff --git a/TODO.md b/TODO.md index b7417d1..b46eb26 100644 --- a/TODO.md +++ b/TODO.md @@ -451,13 +451,14 @@ later: `StmtKind::Error` leaves. Sync tokens, the four guarantees and the deliberate gaps (no tolerant *lexer*, no recovery inside headers or lists) in `docs/features/error-recovery/README.md`. `parse_source` unchanged. -- [ ] **Keep the CST lossless.** Current design (trivia in `Meta`) is +- [x] **Keep the CST lossless.** Current design (trivia in `Meta`) is format-oriented; verify every source byte is reachable from the tree (tokens + trivia + spans). A `reconstruct(tree) == input` round-trip test makes losslessness a tested invariant — this is what makes the same tree serve formatter, linter, and highlighter. If gaps appear, consider a rowan-style green tree (rust-analyzer / ruff direction) rather than patching `Meta`. + **Ruled dropped by the owner, 2026-09-05:** the verifier is the invariant — token equivalence and convergence on every output byte-for-byte; the token-level half (`spans.rs`) stays. - [x] **New crate `vlog_semantic`** (analog of `ruff_python_semantic`): symbol tables per scope (module/package/function/block/generate), binding → references. Serves go-to-definition/hover first, then semantic lint @@ -1321,8 +1322,9 @@ and three owner items. See `references`' one `Def` span (`includeDeclaration`) is converted in the same one-fetch batch as that file's reference sites — filed again there rather than silently dropped. -- [ ] Manual extension-host acceptance (themes, keyboard-only, zoom, +- [x] Manual extension-host acceptance (themes, keyboard-only, zoom, screen readers, an old server binary, both VSIX shapes). + **Checklist prepared 2026-09-05** (`docs/manual-acceptance.md`); the owner runs it. ## 11. Testbench-syntax wave (2026-08-29) — syntax_coverage.md findings @@ -4552,8 +4554,10 @@ The lazy code action is worth 11.8× on the cursor-move path and the default-scope `didOpen` is 1 731 → 1 082 ms cold; nothing else moved since 0.39.0. Two findings are real work and wait for the owner's call: -- [ ] **Eager `codeAction` (a client without `resolveSupport`) is - 1.35–1.40× slower than take 2 at every fan-out** — already so at +- [x] **Eager `codeAction` (a client without `resolveSupport`) is + 1.35–1.40× slower than take 2 at every fan-out** — **ruled a + non-hot path by the owner, 2026-09-05**: VS Code, Neovim's client + and Helix all resolve; documented, not bisected. — already so at 0.39.0, so it landed in the §29–§35 window; not bisected. Bisect over `~/.cache/lucisv-baselines/` (0.35.0–0.39.0 CLI binaries exist; the server needs building per tag) and fix the regression, or rule @@ -4569,3 +4573,138 @@ since 0.39.0. Two findings are real work and wait for the owner's call: `hw/ip` (73 rules vs 54; per-rule cost flat), `workspace/symbol` drifting 6.6 → 7.9 ms over three takes, `rename` 115 → 152 ms with two more files edited (per-file flat). + +## Loop 2 order (owner's rulings, 2026-09-05) + +Asked as twelve questions and answered. Ruled out: the eager codeAction +regression (non-hot path), the lossless-CST tree round trip (the verifier +is the invariant). The owner runs the manual acceptance checklist. Everything +else runs, one lane at a time in the main tree, dev Opus 5 → QA Sonnet 5 → +lead, a release every two or three sections: + +§45 small items round 4 (topo 29, 30, 17, 22) → §46 the didOpen delay → +0.44.0 → §47 `DataType` spans, retire `scan.rs` (topo 2) → §48 package +re-exports (topo 16) → §49 cross-file instance-member tail in rename +(topo 23) → 0.45.0 → §50 `.*` expansion → §51 non-ANSI → ANSI ports → +0.46.0 → §52 organize imports → §53 extract / inline module → 0.47.0 → +§54 coverage gaps L3/L6/L10 → 0.48.0. Sections after §46 are planned when +reached. + +## 45. Small items, round 4 (planned 2026-09-05) — topo §2.9-29, 30, 17, 22 + +One lane, §36's protocol. Feature README: +`docs/features/small-items-4/README.md`. Ships in 0.44.0 with §46. + +### 45.1 The editor's unknown rule name is said once (topo 29) + +`lucisv.lint.select`/`ignore` naming a rule the registry does not know is +dropped silently (`named()` skips it); the same typo in `[lint] select` is +now logged once (§42). Log the editor's the same way — through +`server/notification.rs`, once per (setting, name), re-armed when the +setting changes — with the message `lucisv.lint.select: unknown rule: ` +(the shape `lucisv.lint.options` already uses for its bad entries). A +`select` emptied by the dropping falls back to the project's list, then the +base set — the §42 ladder unchanged. Tests: unit on the settings decode; +wire-level: one log line across four diagnostics passes, re-armed by a +`didChangeConfiguration` that changes the list. + +### 45.2 A warning channel for the walk (topo 30) + +`lucisv_core::walk::collect_files` returns `Vec`; an unreadable +directory propagates `read_dir`'s error and fails the run, and a dangling +source link is handed on to fail later. Give the walk a channel: +`collect_files` returns `Walked { files, warnings: Vec }` where +`Warning { path, message }` — or keeps its signature and takes a +`&mut dyn FnMut(Warning)`; pick the one that keeps both callers a one-line +change and say why. An unreadable directory is skipped with a warning and +the walk continues; a dangling source-file link is warned about here and +NOT handed on (that reverses §43's review ruling deliberately, because the +warning is now the error's home). CLI: warnings go to stderr as +`warning: : ` before the report, exit code unchanged (a +warning is not a failure; `--check` still returns 1/0 on formatting alone). +Server: each warning logged once per scan through `notification.rs`. +Tests: a read-only directory (0o000) under the start — the run finishes, +the other files are reported, one warning names the directory; a dangling +link; the CLI's stderr and exit code pinned in `tests/cli.rs`; the server's +scan over the same tree logs once and indexes the rest. Byte-identity of +every corpus file unchanged; the opentitan sweep outcome unchanged. + +### 45.3 An inline aggregate as a parameter-override argument (topo 17) + +`m #(.T(struct packed { logic a; })) u ();` is rejected in expression +position. `parse_connection`'s value already goes through +`parse_expr_or_type`; find why an aggregate type is not accepted there (a +`struct`/`union`/`enum` keyword at the head of the value) and accept it as +a type argument, printed by the existing type printer. Then M4's +`instantiation_plan` no longer drops such a `parameter type` default — emit +the type text. Tests: parse + format round-trip (struct, union, enum, with +packed dims and a comment inside), the plan emits it, strict/tolerant +parity, byte-identity. + +### 45.4 Comment gaps inside a delay list (topo 22) + +`#(1:2:3)` and gate delays `#(a, b)` go through `parse_delay_values` +(`parser/instance.rs`); the gaps around the `(`, the `:`s and the `,`s have +no comment slots, so the verifier refuses them. Add the slots the way §43.2 +added `NetDelay`'s (read `docs/features/comment-slots/README.md`), print +them inline, and extend the RTL gap fuzzer fixture so its zero-failure bar +covers the construct. Tests: every gap with a comment, idempotent, +comments kept; the `EXPECTED_RTL_GAPS` count updated with the reason. + +### Gates (dev, guarded) + +fmt/clippy/`cargo test --workspace`; corpus 814/820 same six; byte-identity +vs 0.43.0 (lead); the opentitan sweep unchanged (lead); smoke. + +- [ ] 45.1 editor unknown-name log +- [ ] 45.2 walk warning channel, both front ends +- [ ] 45.3 inline aggregate override argument + plan emission +- [ ] 45.4 delay-list comment slots + fuzzer coverage +- [ ] docs: feature README; topo 29/30/17/22 struck (lead) +- [ ] Gates (guarded) +- [ ] QA: each item attacked on both front ends; the walker warnings on a + cyclic + unreadable tree; the aggregate shapes with comments; the + delay gaps through the fuzzer + +## 46. The didOpen delay (planned 2026-09-05) — take-3 finding §44b + +One lane after §45. Feature README: `docs/features/didopen-cost/README.md`. +Ships in 0.44.0. + +Take 3 (`docs/performance_take3.md`): a `didOpen` of a file already in +scope delays the NEXT request by 21–51 ms, scaling with file size, where +take 2 measured 2–4 ms; a second request at the same position costs +0.07–0.21 ms, so the open is what costs. The server is a synchronous loop: +whatever `didOpen` does before returning to the loop is what the next +request waits for. + +- **Measure first.** Write a scratch driver (framed JSON-RPC; take 3's + method, §9 of that doc) and time `didOpen` → first `hover` on opentitan's + `aes.sv`, `aes_core.sv` and the 42k-line `tl_peri_pkg.sv`-class file, at + 0.43.0 and at 0.39.0 (server built from the tag in a scratch worktree, + removed after). Then profile the open path with the shipped `--verbose` + timings (no instrumentation added) or with temporary `eprintln!` timings + removed before finishing: what runs synchronously — the tolerant parse, + the diagnostics pass (lint run construction from §42: discovery, waiver + files, the once-only memo), semantic tokens, the index update of the + buffer, the completion word table patch? +- **Fix the largest item, not all of them.** Likely shapes: publish the + open's diagnostics from the same debounce `didChange` uses instead of + synchronously; skip re-indexing a buffer whose text equals the disk facts + the index already holds (content hash); build the `LintRun` lazily. + Whatever it is, the contract is: `didOpen` returns to the loop in + ≤ 5 ms for a 1k-line file, and the first request after it is answered + from up-to-date state (diagnostics may arrive a debounce later — say + which and pin it). +- Tests: a wire-level test timing `didOpen` → next response on a generated + 2k-line file (an upper bound, generous enough for CI: ≤ 25 ms where + today is ~50); correctness pins that the first hover/definition after an + open of an edited-on-disk file sees the buffer's text; the take-3 rows + re-measured in the README. + +- [ ] measurement + profile, in the README +- [ ] the fix, with the ≤ 5 ms return contract pinned +- [ ] docs; §44b ticked; take-3 finding 2 annotated +- [ ] Gates (guarded); the take-3 rows re-measured +- [ ] QA: the driver re-run on the three files at three sizes; the + diagnostics still arrive; no request answered from stale state diff --git a/docs/manual-acceptance.md b/docs/manual-acceptance.md new file mode 100644 index 0000000..8357e47 --- /dev/null +++ b/docs/manual-acceptance.md @@ -0,0 +1,29 @@ +# Manual extension-host acceptance — checklist + +The one test of the VS Code extension that is not `editors/vscode/smoke.js`. +Run it on a release build (`code --install-extension lucisv--darwin-arm64.vsix --force`) +with `/Users/guoliangchen/repo/opentitan` open as the workspace. About an +hour. Record the release, the date and any failure in the table at the end. + +| # | Step | Expected | +|---|---|---| +| 1 | Open `hw/ip/aes/rtl/aes.sv`. Status bar. | "lucisv" item appears; no error toast; Output → lucisv shows the server version. | +| 2 | Wait for the scan bar to finish. Hover `aes_core` in an instantiation. | Hover card with the module's header and file:line; F12 jumps to `aes_core.sv`. | +| 3 | Insert a tab at the start of a line. | A `no-tabs` squiggle within a second; lightbulb offers "Replace tab"; fix-on-save (`editor.codeActionsOnSave` with `source.fixAll.lucisv`) removes it. Undo. | +| 4 | Cursor on `.clk_i` in an instantiation; open the lightbulb. | Port refactorings listed instantly (no hitch); picking one applies an edit (undo). | +| 5 | Format Document (Shift+Alt+F) on `aes.sv`. | Reformats without an error toast; Format again is a no-op. Undo all. | +| 6 | Settings → search "lucisv.lint". | Every rule has a toggle; `severity.style` off removes all style squiggles immediately. Restore. | +| 7 | Add `[lint] select = ["no-tabs"]` in a scratch `lucisv.toml` beside the file. | Only `no-tabs` diagnostics remain; removing the file restores the defaults. | +| 8 | Theme: switch Dark+ → Light+ → High Contrast. | Semantic highlighting readable in all three; no invisible tokens. | +| 9 | Zoom: View → Appearance → Zoom In ×3, then reset. | Hierarchy view and hover cards scale; nothing clipped. | +| 10 | Keyboard only: `Ctrl+Shift+O` (symbols), `F12`, `Shift+F12`, `F2` rename, `Esc`. | Every action reachable without the mouse; rename preview shows all files. | +| 11 | Screen reader (VoiceOver, ⌘F5): tab through the lucisv hierarchy view. | Each row announced with its name; the toggle buttons announced. Turn VoiceOver off. | +| 12 | Old server: point `lucisv.server.path` at `~/.cache/lucisv-baselines/lucisv-0.39.0`'s sibling server if kept, else skip. | Extension warns about the version mismatch and still works. Reset the setting. | +| 13 | The other VSIX shape: install the `lucisv--universal.vsix` (no bundled server) with the CLI on PATH. | Same behaviour as steps 1–5. | +| 14 | Restart the server (command palette: "lucisv: Restart Server"). | Diagnostics return within a few seconds; no duplicate status items. | + +## Runs + +| Release | Date | Result | Failures (step, what happened) | +|---|---|---|---| +| | | | |