489 lines
29 KiB
Markdown
489 lines
29 KiB
Markdown
# server-lint
|
|
|
|
## Goal
|
|
|
|
`lucisv check` has existed since round 11 and the language server has published
|
|
parse errors since the same round, but the two never met: an editor running
|
|
`lucisv-server` saw syntax errors and nothing else, while CI running `lucisv check`
|
|
saw seven rules' worth of findings. This round wires `vlog_linter` into
|
|
`lucisv_server` so the editor shows what CI will say — lint findings as
|
|
**warnings** alongside the parse **errors**, in **one** `publishDiagnostics` per
|
|
change — and adds `textDocument/codeAction`: a quick fix per Safe fix, and a
|
|
`source.fixAll.lucisv` action for fix-on-save. Nothing about the linter changed;
|
|
this is protocol-layer wiring, which is all `lucisv_server` is allowed to be.
|
|
|
|
## Assumptions
|
|
|
|
- **One publish per version, always.** `textDocument/publishDiagnostics`
|
|
*replaces* a document's diagnostics; it never merges them. Publishing the
|
|
parse pass and the lint pass as two notifications for one version is the
|
|
classic flicker bug — whichever arrives second is the only one the user sees,
|
|
and which that is depends on ordering nobody controls. `diagnostics::all`
|
|
therefore concatenates both sources and the server sends the result once, from
|
|
the single `publish()` path every notification already goes through.
|
|
- **Errors first, then warnings, each in position order.** The two lists are
|
|
concatenated, not interleaved: a parse error is the thing the user must fix
|
|
and reads better above an opinion about style. Every editor sorts the list its
|
|
own way anyway; what matters is that the order is deterministic, and it is.
|
|
- **A lint finding is a `Warning`, a parse error stays an `Error`.** The linter
|
|
has opinions; the parser reports the file not being Verilog. `code` is the
|
|
rule's stable kebab-case name — the string the user needs to write a waiver or
|
|
an `--ignore`, and the string a code action matches on. `source` is `"lucisv"`
|
|
for both, as before.
|
|
- **The linter is handed the URI's own path**, so `module-filename` can speak.
|
|
It is the one default rule that needs a file name; without the path it goes
|
|
quiet, which would have made the editor disagree with CI on exactly the rule
|
|
whose whole subject is the file name. An `untitled:` buffer genuinely has no
|
|
path and genuinely gets no `module-filename` finding — the same behavior as
|
|
`lucisv check` on stdin without `--stdin-filename`.
|
|
- **The document is parsed twice per change, and that is a known cost, not an
|
|
oversight.** `Document::new` parses for the server, and `LintContext::new`
|
|
parses again inside the linter. `linter-core`'s own Handshakes file this as
|
|
"one parse, two tools" (TODO §4) and say what the fix is: `LintContext` would
|
|
have to accept a pre-built tree. Refactoring `vlog_linter` from this round was
|
|
out of scope and would have been the wrong place to decide it — the CLI pays
|
|
the same cost. Measured shape of the cost: it is one extra tolerant parse per
|
|
keystroke of a single file, which is the same order as the analysis the server
|
|
already redoes per keystroke by design (TODO §6, "per-file recompute is fine
|
|
at Verilog file sizes"). When the shared-parse work lands, exactly one call
|
|
site here changes.
|
|
~~parsed twice per change~~ **Delivered by one-parse (round 19): `lint.rs`
|
|
now lints from the `Document`'s own products via `LintContext::from_parse`
|
|
— see `docs/features/one-parse/README.md`.**
|
|
- **Only Safe fixes are ever offered.** `--unsafe-fixes` is a flag a CLI user
|
|
types on purpose; a lightbulb is not that, and a fix that can change what the
|
|
circuit does must not be one click away. No rule ships an Unsafe fix today, so
|
|
this is a rule written for the first one that does — and it is enforced in
|
|
code (`quick_fix` returns `None` for anything not `Applicability::Safe`) and
|
|
in `apply_fixes(.., include_unsafe = false)` for the fix-all path, not just
|
|
stated here.
|
|
- **`source.fixAll.lucisv` is one pass, deliberately.** `lucisv check --fix` loops
|
|
fix → re-lint until nothing changes, because a single pass skips any fix
|
|
overlapping one already applied (the everyday case is a line ending in a tab,
|
|
which `no-tabs` and `no-trailing-whitespace` both want to rewrite). The server
|
|
does **not** reproduce that loop: applying the action changes the buffer, the
|
|
change re-lints, the client asks again, and convergence arrives for free
|
|
through the edit/re-lint cycle the editor already runs. One pass per request
|
|
also keeps every action the user is shown a description of the buffer actually
|
|
in front of them, rather than of a hypothetical buffer three rounds ahead.
|
|
Pinned by `fix_all_is_one_pass_and_the_next_request_finishes_the_job`.
|
|
- **The fix-all edit is the whole document.** That is what `apply_fixes`
|
|
produces and what it guarantees — a set of ranges assembled by hand here could
|
|
interleave two fixes in a way the linter's own skip rule would have refused.
|
|
It matches what `textDocument/formatting` already sends, so no client is
|
|
surprised by the shape.
|
|
- **A quick fix's tab-expansion width comes from `lucisv.toml`.** A code-action
|
|
request carries no `FormattingOptions`, so unlike formatting there is no
|
|
client `tabSize` in play: the precedence is `lucisv.toml` > the built-in
|
|
default, via `format::indent_width`. Without this, a project with `indent = 4`
|
|
would get a quick fix inserting two spaces that format-on-save then rewrites —
|
|
precisely the CLI/editor divergence `lucisv-core-lift` exists to prevent. The
|
|
diagnostics path does not do this lookup: it never reads a fix, so it would be
|
|
a config file read per keystroke bought for nothing.
|
|
- **A broken `lucisv.toml` is silent on the code-action path.** The formatting
|
|
path already warns once per file change (`lucisv-core-lift`); warning again from
|
|
a lightbulb an editor requests on every cursor move would train the user to
|
|
ignore lucisv's messages. The fix falls back to the built-in indent width.
|
|
- **The client's `context.only` filter is honored here rather than left to the
|
|
client.** The spec permits a server to return everything and let the client
|
|
filter, but fix-on-save asks for `source.fixAll.lucisv` alone, and computing
|
|
every quick fix for a request that discards them is work nobody reads.
|
|
Filtering is hierarchical, as the spec says: `source` selects
|
|
`source.fixAll.lucisv`.
|
|
- **A quick fix is offered when its diagnostic range *touches* the requested
|
|
range.** A cursor sitting on the first character of a warning is asking about
|
|
that warning; an empty requested range (a bare cursor) is the normal case.
|
|
- **Waivers, fences and rule selection are the linter's business, not this
|
|
crate's.** A `// lucisv: waive no-tabs` suppresses the diagnostic and therefore
|
|
the lightbulb, because the finding never reaches this crate. **Note the one
|
|
asymmetry with the CLI:** `lucisv check --fix` additionally refuses to fix
|
|
inside a `// verilog_format: off` fence, and that refusal lives in
|
|
`crates/lucisv/src/lint.rs`, not in `vlog_linter` — so it is **not** inherited
|
|
here. See Status/TODO; it is the one honest gap this round leaves.
|
|
~~not inherited here~~ **Inherited as of shared-fence-filter (round 14): the
|
|
filter moved to `vlog_formatter::fence` and this crate calls it.**
|
|
|
|
## Handshakes
|
|
|
|
**Consumed from `vlog_linter`** (all already `pub`; nothing in that crate was
|
|
modified, and nothing needed to be):
|
|
|
|
- `run(source, Option<PathBuf>, &[&dyn Rule]) -> Vec<Violation>` — the
|
|
diagnostics path.
|
|
- `lint(&LintContext, &[&dyn Rule])` with
|
|
`LintContext::new(source, path).with_tab_width(w)` — the code-action path,
|
|
which needs the fix text built for the buffer's indent width.
|
|
- `default_rules()`, `rule_by_name(name)` (for the lightbulb's title, from
|
|
`Rule::summary`), `Violation { rule, message, span, fix }`,
|
|
`Fix { edits: Vec<(TextRange, String)>, applicability }`,
|
|
`Applicability::{Safe, Unsafe}`, `apply_fixes(source, &[Violation],
|
|
include_unsafe) -> Fixed { output, applied }`.
|
|
|
|
Relied on, and stated so it breaks loudly if it stops being true: rule **names
|
|
are stable** (they are this feature's `Diagnostic::code` and appear in users'
|
|
waivers), `run` **never panics and never writes**, and findings come back
|
|
**sorted by `(span.start, span.end, rule)`** — all three are promises in
|
|
`docs/features/linter-core/README.md`'s Handshakes.
|
|
|
|
**Consumed from `lucisv_core`** — nothing new: `format::indent_width` reuses the
|
|
existing private `discover`, which is `Discovery::for_file`.
|
|
|
|
**Promised to nobody.** `lucisv_server` is still a leaf binary with no library
|
|
target. `editors/**` was not touched: a client needs no change to receive lint
|
|
diagnostics, and `editor.codeActionsOnSave` naming `source.fixAll.lucisv` is a
|
|
user setting, not an extension one.
|
|
|
|
**Requested of others — not done here:**
|
|
|
|
1. *linter-core / whoever unifies the pipelines*: **one parse, two tools.** This
|
|
crate now pays the duplicated parse per keystroke, which makes it the second
|
|
caller with a reason to want `LintContext` to accept a pre-built
|
|
`SourceFile`. Nothing here blocks on it; when it lands, `lint.rs` is the one
|
|
file that changes.
|
|
**Delivered by one-parse (round 19) — `lint.rs` was indeed the one file
|
|
(plus `Document` gaining its `tree` field).**
|
|
2. *linter-core / config-discovery*: **a `lint` key in `lucisv.toml`.** The server
|
|
runs `default_rules()` and nothing else, because there is no configured rule
|
|
set to read — `--select`/`--ignore` are CLI-only. When `lint = [...]` lands,
|
|
`lint.rs` should resolve it through the same `Discovery` the formatter uses,
|
|
with the same anchored-at-the-document rule.
|
|
3. *lead*: **the fence gap.** `lucisv check --fix` will not rewrite bytes inside a
|
|
`// verilog_format: off` region, but that filter lives in
|
|
`crates/lucisv/src/lint.rs` (it needs `vlog_formatter::fence`, which the linter
|
|
crate deliberately does not depend on). This round did not duplicate it — a
|
|
third copy of "what is fenced" is exactly how the three answers drift — so a
|
|
quick fix in this server *can* edit inside a fence. Reported honestly rather
|
|
than half-fixed: the right home is a shared helper both front ends call. It
|
|
cannot corrupt code (every offered fix is Safe), but it does violate the
|
|
fence's "hands off" promise the same way the CLI did before its QA round.
|
|
~~a quick fix in this server *can* edit inside a fence~~ **Delivered by
|
|
shared-fence-filter (round 14): `vlog_formatter::fence::protected_regions`
|
|
is now the one answer both front ends call, and `lint::fixable` withholds
|
|
any fix that would edit a fenced byte — reported, never auto-fixed, exactly
|
|
as the CLI.**
|
|
4. *lead*: **`TODO.md:353` is now stale.** §6's `lucisv_server` entry still lists
|
|
"lint diagnostics (waits on `vlog_linter`)" under **Not shipped**. TODO.md is
|
|
outside this round's stated scope, so it was left alone rather than edited;
|
|
the checkbox itself is already `[x]` and needs no flip.
|
|
|
|
## Capabilities, as this round leaves them
|
|
|
|
| LSP request | Engine it consumes | Notes |
|
|
|---|---|---|
|
|
| `textDocument/publishDiagnostics` | `vlog_parser::parse_source_tolerant` **+ `vlog_linter::run`** | One publish per change carrying both: parse errors as `Error`, lint findings as `Warning` with `code` = rule name |
|
|
| `textDocument/codeAction` | `vlog_linter` fixes | `quickfix` per Safe fix (`isPreferred`, `diagnostics` populated); one `source.fixAll.lucisv` whole-document edit |
|
|
|
|
The `initialize` diff is exactly one field:
|
|
|
|
```rust
|
|
code_action_provider: Some(CodeActionProviderCapability::Options(CodeActionOptions {
|
|
code_action_kinds: Some(vec![
|
|
CodeActionKind::QUICKFIX,
|
|
CodeActionKind::new("source.fixAll.lucisv"),
|
|
]),
|
|
work_done_progress_options: WorkDoneProgressOptions::default(),
|
|
resolve_provider: None,
|
|
})),
|
|
```
|
|
|
|
`Options` rather than `Simple(true)` on purpose: a client that filters by kind
|
|
(which is how fix-on-save is configured) has to be told which kinds exist.
|
|
`resolve_provider` is `None` because every action is returned complete.
|
|
|
|
**Still deliberately not advertised**, unchanged by this round and absent from
|
|
the initialize result rather than present-and-false: `rangeFormatting` (waits on
|
|
TODO §2 `--lines`), `completion`, `rename`, `signatureHelp`, and cross-file
|
|
`references`.
|
|
|
|
## Status / TODO
|
|
|
|
- [x] `vlog_linter` added to `crates/lucisv_server/Cargo.toml` (path dependency;
|
|
the crate was already a workspace member, so the root `Cargo.toml` needed
|
|
**no** edit).
|
|
- [x] `src/lint.rs`: violations for the diagnostics path, violations-with-fixes
|
|
for the code-action path, and the `Violation` → `Diagnostic` conversion.
|
|
- [x] `src/diagnostics.rs`: `all()` — parse errors then lint warnings, one list.
|
|
- [x] `server.rs`: `publish()` sends that one list; every path that published
|
|
before (`didOpen`, `didChange`, `didSave`, and the post-save republish of
|
|
every open buffer) now publishes both sources, unchanged otherwise.
|
|
- [x] `src/code_action.rs`: quick fixes, `source.fixAll.lucisv`, `context.only`
|
|
filtering, range-overlap matching.
|
|
- [x] `format::indent_width` — the config-governed tab width a fix writes.
|
|
- [x] `textDocument/codeAction` wired into the request dispatcher.
|
|
- [x] `codeActionProvider` advertised with both kinds.
|
|
- [x] Handler tests: publish merge, waived violation, `module-filename` from the
|
|
URI, untitled buffer, UTF-16 positions after multi-byte content, quick fix
|
|
reproducing `apply_fixes`' own output, fix-all over multiple fixes,
|
|
one-pass convergence, client filter, indent width.
|
|
- [x] e2e through the real binary: one publish carrying two rule codes, the
|
|
capability's kinds on the wire, quick fixes + fixAll, and a filtered
|
|
fix-on-save request.
|
|
- [x] `docs/features/lucisv-server/README.md` deferred list annotated.
|
|
- [ ] **Not done, deliberately:** rule selection. No `lucisv.toml` `lint` key
|
|
exists (Handshake 2); the server runs `default_rules()`.
|
|
- [ ] **Not done, deliberately:** offering Unsafe fixes. No rule ships one, and
|
|
when one does it wants a decision (a separate `source.fixAll` kind? a
|
|
client setting?), not a silent inclusion.
|
|
- [x] ~~**Not done:** fence-aware fixes (Handshake 3) — a quick fix can edit
|
|
inside a `// verilog_format: off` region, where `lucisv check --fix` would
|
|
not.~~ Delivered by **shared-fence-filter** (round 14).
|
|
- [ ] **Not done:** `codeAction/resolve`. Every action is cheap to build in
|
|
full; lazy resolution is a payload optimization for actions that are not.
|
|
- [x] ~~**Not done:** sharing one parse with the linter (Handshake 1).~~
|
|
Delivered by **one-parse** (round 19).
|
|
|
|
## Work log
|
|
|
|
### 2026-08-19 — dev agent
|
|
|
|
- Read `CLAUDE.md`, `docs/features/lucisv-server/README.md`,
|
|
`docs/features/linter-core/README.md` and
|
|
`docs/features/lucisv-core-lift/README.md` in full (QA logs and Reviews
|
|
included) before writing anything, plus `vlog_linter`'s public surface
|
|
(`lib.rs`, `violation.rs`, `context.rs`, `registry.rs`). No engine crate
|
|
needed a change, again: every entry point this round wanted was already
|
|
public and already documented.
|
|
- **The publish merge was the one decision with a wrong answer available.**
|
|
Adding a second `send_diagnostics` call for lint findings would have looked
|
|
right in every unit test and flickered in every editor, because LSP replaces
|
|
rather than merges. The merge is therefore in `diagnostics::all` — one
|
|
function, called from the one `publish()` path every notification already used
|
|
— rather than at the four notification sites. The e2e test asserts on the
|
|
**count of publish notifications** (`== 1`), which is the assertion that would
|
|
catch a regression here; asserting only on the contents would not.
|
|
- **Two lint entry points, for one honest reason.** `lint::violations` (the
|
|
diagnostics path) calls `vlog_linter::run` and never looks at a fix, so it
|
|
does no config work per keystroke. `lint::fixable` (the code-action path)
|
|
builds a `LintContext` with the tab width of the governing `lucisv.toml`, since
|
|
a fix that writes two spaces into an `indent = 4` project is a fix
|
|
format-on-save immediately overwrites. The split costs three lines and buys
|
|
the CLI/editor parity `lucisv-core-lift` was about.
|
|
- **`fixAll` is one pass and says so in a doc comment at the function**, with
|
|
the reasoning (the client's own edit/re-lint cycle *is* the convergence loop).
|
|
The tab-and-trailing-whitespace case — the everyday two-round example from
|
|
`linter-core` — is the test that pins it: pass one changes the buffer, a
|
|
second request finishes it, a third offers nothing.
|
|
- **`fixAll` carries no `diagnostics` list.** A pass skips fixes overlapping an
|
|
applied one, so the action cannot honestly claim which findings it resolves.
|
|
Quick fixes, which resolve exactly one, do carry theirs — built by the same
|
|
`lint::diagnostic` the publisher uses, so the diagnostic in the action is
|
|
equal to the one on screen rather than a lookalike reconstructed by hand.
|
|
- **`context.only` is honored** with hierarchical prefix matching, because
|
|
fix-on-save requests `source.fixAll.lucisv` alone and would otherwise be handed
|
|
every quick fix in the file to throw away.
|
|
- **Two clippy warnings fixed by restructuring, not by `#[allow]`**: both were
|
|
`clippy::mutable_key_type` on a `let`-bound `&HashMap<Uri, Vec<TextEdit>>` in
|
|
the tests (`lsp_types::Uri` has interior mutability, and the map type is the
|
|
protocol's, not ours). Replaced with an `edits_of(action)` helper that returns
|
|
the `Vec<TextEdit>` directly, so no map is ever bound. No `#[allow]` was added
|
|
anywhere in this round.
|
|
- No `unwrap`/`expect`/`panic!`/`unsafe` outside `#[cfg(test)]` in any file
|
|
added or touched.
|
|
- Did not touch `vlog_linter`, `vlog_parser`, `vlog_formatter`, `vlog_semantic`,
|
|
`lucisv`, `lucisv_core` or `editors/**`. Root `Cargo.toml` needed no edit —
|
|
`vlog_linter` is already a workspace member, so the dependency is one path
|
|
line in this crate's own manifest (`Cargo.lock` gained the corresponding
|
|
one-line edge). `TODO.md` left alone per the round's stated scope, with the
|
|
one stale sentence filed as Handshake 4. Did not run `git commit`/`git push`.
|
|
|
|
**Results.**
|
|
|
|
- `cargo test -p lucisv_server`: **108 passed, 0 failed** (104 unit + 4 e2e),
|
|
up from 85 (82 + 3). New: 7 in `lint.rs`, 10 in `code_action.rs`, 2 in
|
|
`diagnostics.rs`, 2 in `format.rs`, 2 in `main.rs`, 1 e2e.
|
|
- `cargo clippy -p lucisv_server --all-targets`: **0 warnings from this crate**.
|
|
One warning reaches the output from a dependency — `vlog_formatter`'s
|
|
`with_comma is never used` — which belongs to the concurrent round live in
|
|
`vlog_parser`/`vlog_formatter`, not to anything here.
|
|
- `cargo fmt --all -- --check`: clean.
|
|
- `cargo test --workspace`: **547 passed, 0 failed**, measured after the
|
|
concurrent round's tree settled.
|
|
- **Concurrency note.** Mid-round the other agent landed new `ast::Module` /
|
|
`ast::AnsiPort` fields, and for ~20 minutes nothing in the workspace compiled,
|
|
this crate included. Nothing was touched in response; the gates were re-run
|
|
once `vlog_parser` built again and are the numbers above. `-p lucisv_server`'s
|
|
own 104 + 4 is the count that belongs to this feature and did not move across
|
|
the break.
|
|
- Files added: `crates/lucisv_server/src/{lint,code_action}.rs`, this README.
|
|
Files edited: `crates/lucisv_server/Cargo.toml` (one line),
|
|
`crates/lucisv_server/src/{main,server,diagnostics,format}.rs`,
|
|
`crates/lucisv_server/tests/e2e.rs`, one annotation line in
|
|
`docs/features/lucisv-server/README.md`.
|
|
|
|
## QA log
|
|
|
|
### 2026-08-19 — QA agent
|
|
|
|
Scoped to `-p lucisv_server` per the concurrency note (a second agent was live
|
|
in `vlog_parser`/`vlog_formatter` for the directives-in-lists round; the tree
|
|
briefly failed to build mid-session and recovered on its own — retested after
|
|
and the numbers below are post-recovery). No files touched outside this QA
|
|
log entry.
|
|
|
|
**Gates.**
|
|
|
|
- `cargo test -p lucisv_server`: **104 unit + 4 e2e, 0 failed** — matches the
|
|
claimed count exactly.
|
|
- `cargo clippy -p lucisv_server --all-targets`: **0 warnings from this crate.**
|
|
- `cargo fmt --all -- --check`: clean.
|
|
- `grep -rn "#\[allow" crates/lucisv_server/src/{lint,code_action,diagnostics,format,main,server}.rs crates/lucisv_server/tests/e2e.rs`
|
|
finds exactly one hit, `main.rs:112` (`#[allow(deprecated)]` on
|
|
`root_uri`) — confirmed via `git diff crates/lucisv_server/src/main.rs` to
|
|
predate this round (it sits outside every hunk this diff touches). **No
|
|
new `#[allow]` was added.**
|
|
|
|
**Claim 1 — single-publish merge: PASS.**
|
|
`grep -rn "send_diagnostics\|PublishDiagnostics" crates/lucisv_server/src/`
|
|
shows exactly one call site that ever sends a non-empty diagnostics list —
|
|
`server.rs:259`, `self.send_diagnostics(uri.clone(), diagnostics::all(doc))`
|
|
inside `publish()` — plus the `didClose` clear-with-`Vec::new()` at line 236,
|
|
which is not a second source, it is the documented "clear what we drew"
|
|
case. No other path calls `send_diagnostics` or constructs a
|
|
`PublishDiagnosticsParams`. Drove the real binary (hand-rolled Python LSP
|
|
client, framed JSON-RPC over stdio, script kept at
|
|
`/private/tmp/claude-501/.../scratchpad/test1_publish_merge.py`):
|
|
`didOpen` on `"module m;\n\twire ;\nendmodule\n"` (a tab **and** a parse
|
|
error) produced **exactly one** `publishDiagnostics`, carrying one `Error`
|
|
(unnamed `wire`) and one `Warning` `code: "no-tabs"`. `didChange` fixing the
|
|
parse error but keeping the tab: still one publish, error gone, `no-tabs`
|
|
warning persists. `didChange` adding `// lucisv: waive no-tabs`: still one
|
|
publish, diagnostics array empty. All three steps matched the claim exactly.
|
|
|
|
**Claim 2 — codeAction: PASS**, verified against the real binary
|
|
(`test2_codeaction.py`, `test3_convergence.py`):
|
|
- A `codeAction` request at the tab returned one `quickfix`
|
|
(`isPreferred: true`, `diagnostics` = one entry, built from the same
|
|
`lint::diagnostic` the publisher uses — confirmed both by source
|
|
(`code_action.rs:63`) and by the wire payload being byte-identical to the
|
|
publish's own diagnostic) and one `source.fixAll.lucisv`. The quickfix's
|
|
edit, applied by hand from UTF-16 positions, was byte-identical to
|
|
`lucisv check --fix`'s output on the same file.
|
|
- `fixAll` carried no `diagnostics` key (absent from the JSON entirely, i.e.
|
|
`None`, matching the one-pass argument in the README) and its one
|
|
whole-document edit also matched `lucisv check --fix`.
|
|
- Convergence: a line with both a leading tab and a trailing tab
|
|
(`no-tabs` + `no-trailing-whitespace` both wanting those bytes) took
|
|
**3 rounds** to reach a clean buffer via repeated `fixAll` → `didChange` →
|
|
`fixAll` — within the documented "2-3 rounds" window. Round 3 returned no
|
|
`fixAll` action at all (nothing left to fix), which is the correct
|
|
"converged" signal.
|
|
- `context.only=["source"]` returned only the `fixAll` action (1 action);
|
|
`context.only=["quickfix"]` returned only the quickfix (1 action) — both
|
|
confirmed live, not just via the existing unit test.
|
|
- Tab width from `lucisv.toml`: a scratch tree with `indent = 4` produced a
|
|
quickfix expanding the tab to 4 spaces; a tree with no config produced 2
|
|
spaces (the built-in default) — both driven through the real binary
|
|
(`test6_config_and_filename.py`).
|
|
- Diagnostics path skips config reads: `grep -rn "indent_width" crates/lucisv_server/src/*.rs`
|
|
shows `format::indent_width` called from exactly one site,
|
|
`server.rs:131`, inside the `CodeActionRequest` handler. Neither
|
|
`lint::violations` nor `lint::diagnostics` (the path every `didOpen`/
|
|
`didChange`/`didSave` publish goes through) calls it or `Discovery`
|
|
anywhere. Confirmed by static read since a per-keystroke file read isn't
|
|
directly observable from outside; the absence of the call is the proof.
|
|
- Unsafe fixes excluded: confirmed in code (`code_action.rs:60-62` returns
|
|
`None` for non-`Safe`; `fix_all` calls `apply_fixes(.., false)`) and by
|
|
`grep -rn "Applicability::Unsafe" crates/vlog_linter/src/rules/` finding
|
|
no rule that constructs one — there is nothing to accidentally offer today.
|
|
|
|
**Claim 3 — capabilities: PASS.** `main.rs`'s `capabilities()` diff is
|
|
exactly the one field the README documents (`code_action_provider: Options`
|
|
with `[QUICKFIX, "source.fixAll.lucisv"]`, `resolve_provider: None`); nothing
|
|
else in `capabilities()` changed per `git diff`. `caps.code_action_provider`
|
|
is `Options`, not `Simple(true)` — asserted by
|
|
`the_two_code_action_kinds_are_named_in_the_capability` and by the e2e test
|
|
reading the actual wire payload. `rangeFormatting`/`completion`/`rename`
|
|
remain `None`, asserted by the pre-existing
|
|
`every_advertised_capability_is_implemented` test (still passing, unmodified
|
|
in spirit — only gained one new assertion for `code_action_provider`).
|
|
|
|
**Claim 4 — tests: PASS**, numbers above.
|
|
|
|
**Claim 5 — handshakes: PASS**, and the fence gap was reproduced live rather
|
|
than taken on faith. `test4_fence_gap.py`: a file with
|
|
`// verilog_format: off` / a tabbed line / `// verilog_format: on` —
|
|
`lucisv check --fix` left the tab untouched (confirmed: output still contains
|
|
the literal tab byte); the server's `fixAll` action **did** rewrite it to
|
|
spaces (confirmed: applied output has the tab replaced). This is exactly
|
|
what Handshake 3 claims, stated as a known gap rather than silently — the
|
|
handshake text is accurate, not aspirational. The other three handshakes
|
|
(second-parse-per-keystroke in `lint.rs`'s own doc comments, no `lint` key
|
|
in `lucisv.toml` yet, `TODO.md:353` being stale) were spot-checked against the
|
|
actual files and are accurate: `TODO.md`'s "Not shipped, deliberately: ...
|
|
lint diagnostics (waits on `vlog_linter`)" line is indeed still present and
|
|
now stale, and its checkbox is already `[x]`, exactly as claimed.
|
|
|
|
**UTF-16 under fixes: PASS.** `test5_utf16.py`: a violation on a line after
|
|
`🎉🎉 café` (multi-byte, multi-UTF-16-unit content) — the server's `fixAll`
|
|
edit, applied from its UTF-16 positions, produced output **byte-identical**
|
|
to `lucisv check --fix` on the same file, and the emoji/accented content was
|
|
untouched.
|
|
|
|
**module-filename via URI: PASS.** A `file://` URI whose module name
|
|
mismatches its filename produced the `module-filename` warning (message
|
|
correctly named both names); the same content opened under an `untitled:`
|
|
URI produced zero diagnostics for that rule and the server did not error or
|
|
hang on a subsequent `codeAction` request against the same untitled buffer
|
|
(returned `[]`, no `error` field).
|
|
|
|
**Documentation.** README has all seven CLAUDE.md-required sections, all
|
|
populated except Review (correctly reserved for the lead). The two
|
|
`docs/features/lucisv-server/README.md` annotation locations (the "Deferred"
|
|
paragraph's `lint diagnostics (waits on \`vlog_linter\`)` clause, and the
|
|
Status/TODO `lint diagnostics` checklist item) are each a single
|
|
struck-through-and-replaced item, word-wrapped across several physical lines
|
|
in the file's existing 80-column convention — consistent with "one
|
|
annotation" per location, not a rewrite of surrounding content. Minor,
|
|
non-blocking nit: the dev's own work-log sentence says "one annotation line
|
|
in `docs/features/lucisv-server/README.md`" (singular), but two separate
|
|
locations in that file were actually touched (the Deferred-paragraph clause
|
|
and the Status/TODO item) — the substance of both edits is correct and
|
|
scoped, this is purely a miscount in the work-log's own wording.
|
|
|
|
**No BLOCKING findings.** No double-publish observed in any of five live
|
|
sessions across the scenarios above (always exactly one
|
|
`publishDiagnostics` per change). No fix landed on wrong bytes under UTF-16
|
|
(byte-identical to the CLI in the emoji test). No Unsafe fix was ever
|
|
offered (none exists to offer, and the two guard sites hold).
|
|
|
|
Nothing in this feature required touching `verify.rs`, so CLAUDE.md's rule 4
|
|
(masked-corruption attack tests for widened forgiveness) does not apply to
|
|
this round.
|
|
|
|
## Review
|
|
|
|
**2026-08-19 — lead. Verdict: accepted and committed. Linting in the
|
|
editor — the last line of the owner's original feature list — is live.**
|
|
|
|
Points reviewed and accepted:
|
|
|
|
1. **The flicker bug made structurally impossible** rather than avoided
|
|
by discipline: one merged list through the one publish path, with
|
|
the e2e asserting on notification *count*. That's the design habit
|
|
this project has been building all day, applied to the protocol
|
|
layer.
|
|
2. **fixAll as one honest pass**: no converge loop (the client's
|
|
edit/re-lint cycle provides it, verified live at 3 rounds), and no
|
|
`diagnostics` list on the action because a pass that skips
|
|
overlapping fixes can't honestly name what it resolved. Declining
|
|
to claim what you can't prove is the house style.
|
|
3. **Quick fixes byte-identical to `lucisv check --fix`** — the two
|
|
front ends provably agree, which is the property users will
|
|
actually rely on.
|
|
4. **The fence gap filed, not papered over**: a server fix can edit
|
|
inside `// lucisv: off` because the fence filter lives in
|
|
`crates/lucisv`, and a third copy of "what is fenced" is how answers
|
|
drift. QA reproduced both sides live. This is the top item for the
|
|
next round — a shared fence-region helper (likely in
|
|
`vlog_formatter` next to `fence.rs`, or `lucisv_core`) that the CLI
|
|
and the server both call. Until then: no corruption is possible
|
|
(only Safe fixes exist), but the hands-off promise has a documented
|
|
editor-side hole.
|
|
5. The second-parse-per-keystroke cost and the `lucisv.toml` `lint` key
|
|
stay filed where they belong (vlog_linter's one-parse-two-tools
|
|
TODO and config-discovery's key list respectively).
|
|
|
|
Lead note on QA's nit: the work-log's "one annotation line" was two
|
|
locations — both correct; miscount acknowledged here rather than
|
|
rewriting the dev's log.
|