Compare commits

...
6 Commits
Author SHA1 Message Date
lucioandClaude Fable 5.1 972bd1cff1 Release 0.42.0 — external waiver files and the two vendor shapes
ci / checks (push) Successful in 1m5s
ci / corpus (push) Successful in 33s
release / build-and-publish (push) Successful in 6m28s
Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-05 00:03:07 -05:00
lucioandClaude Fable 5.1 8a92e79fc0 External waiver files: Verible's format from lucisv.toml, --waiver-file and the editor, union with inline waivers, honoured by quick fixes
TODO §39 (docs/features/waiver-files). Closes §4's last waiver item.

`vlog_linter::waiver_file`: `waive --rule=<rule> [--line=N|N-M]
[--location=<pattern>]`, `#` comments, BOM tolerated; `--location` is
the `--exclude` matcher (`lucisv_core::walk::is_excluded`, a new
vlog_linter → lucisv_core edge), a regex-looking pattern refused by
name. `lint_with(ctx, rules, external)` applies inline and external
waivers as a union and reports which external directives fired;
`lucisv check` reports the dead ones under `unused-waiver` at the
waiver file's line after the whole run. Discovery: `[lint] waivers`
(relative to the toml), `--waiver-file` (repeatable), `lucisv.lint.waivers`
(first workspace root); bad lines fail the CLI run with file:line and
are dropped and logged once by the server.

Review rework (QA's HIGH): the server's code-action path now lints with
the buffer's `LintRun` — its enabled rules and external waivers — so a
quick fix is never offered, nor applied by fix-on-save, for a waived
finding.

Docs: Waivers sections in README and the linter guide, cli and
configuration rows, topo edge, site rebuilt.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-05 00:03:07 -05:00
lucioandClaude Fable 5.1 f6f18de10d docs: repository analysis audit at v0.41.0 — README architecture, topo facts (codec 17, handshakes 26–28), site guides and rebuilt dist
Written by the owner's audit process on 2026-09-04; committed by the lead
unchanged. Findings 1–3 are planned as TODO §41–§43.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-04 23:37:55 -05:00
lucioandClaude Fable 5.1 d5abf81563 The two §11 parser skips: rival unit headers across an ifdef/else split as one verbatim unit, a net delay accepted after the type
TODO §38 (docs/features/parser-skips). Closes the jtag_if.sv and
SimDTM.sv skips from the §11 sweep.

38.1 `Parser::at_rival_header`: in a module/interface/program body, a
continuing directive at the unit's own entry level followed by the same
keyword and name is a header written twice across the arms, not a
nested unit. The error routes into the existing conditional split
(`at_split_conditional` now fires on a rival as well as an open
bracket; `scan_split_extent` runs to the unit's real closer, counting
nested units of the same kind), so the whole unit is one Verbatim item
in both modes. jtag_if.sv now formats (body verbatim, the standing
directive-split trade).

38.2 `DataDecl::delay: Option<NetDelay { expr, after_type }>`: a net
delay is accepted before or after the type (IEEE 1800 §6.7 puts it
after), never both, and printed where it was written. SimDTM.sv now
formats; its four `#0.1` lines come back byte-identical.

Byte-identity vs 0.41.0: 0 of 820 corpus files differ; over 2 554
opentitan files exactly the two named files change outcome.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-04 23:06:37 -05:00
lucioandClaude Fable 5.1 97aa2fefd8 Release 0.41.0 — code actions off the fan-out
ci / checks (push) Successful in 58s
ci / corpus (push) Successful in 32s
release / build-and-publish (push) Successful in 6m13s
Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-04 18:15:40 -05:00
lucioandClaude Fable 5.1 9604753b6c Lazy codeAction/resolve for the port refactorings, definitions from the index, the inlayHint zero ruled correct
TODO §37 (docs/features/lazy-code-action). Closes the four §10 lines.

37.1 For a client whose resolveSupport lists "edit", the port actions are
offered over the buffer plus the instantiated module's declaration alone
(`ports::offers`, `offer_sources`), carrying `data {uri, position,
title}` and no edit; `codeAction/resolve` (`ports::resolve`) re-runs the
eager path and returns the matching action, matched on the title minus
its count phrase, erroring when the action is gone or the buffer is on
the large-file path. Clients without resolve support get today's eager
answer. Offer flat at ~55 µs from a 3- to a 128-file fan-out where the
eager path was linear; ~4.5 ms vs ~77 ms over the wire on opentitan's
128-file case.

37.2 The inlayHint zero at the default scope is correct: the hinted
module (`pins_if`) is declared outside what the scope reaches, and
definition/hover answer nothing there either. Pinned, not changed.

37.3 `locate::definition_location`: an index-only Location for a closed
file's file-scope declaration from its recorded `DeclPositions`; nav and
workspace symbols routed through it (0.4 µs vs 28 µs). Open buffers keep
the file-read path.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-04 18:15:40 -05:00
97 changed files with 6968 additions and 337 deletions

No files matched your search

+45
View File
@@ -4,6 +4,51 @@ All notable changes to lucisv are recorded here. Versions follow
[semantic versioning](https://semver.org/); until 1.0 the CLI's exit codes
(see `README.md`) are the only frozen contract.
## 0.42.0 — 2026-09-05
### External waiver files, and the two vendor shapes the sweep skipped
- **External waiver files** in Verible's format: `waive --rule=<rule>
[--line=N|N-M] [--location=<pattern>]`, `#` comments. Read from
`[lint] waivers` in `lucisv.toml`, `lucisv check --waiver-file` (repeatable)
and the editor setting `lucisv.lint.waivers`; the three add up.
`--location` is an `--exclude`-style pattern, not a regex, and a
regex-looking one is refused by name. Union with inline waivers; unused
external waivers are reported under `unused-waiver` at their line of the
waiver file by `lucisv check`, after the whole run. The editor's quick
fixes and fix-on-save honour external waivers too.
- **Rival module/interface headers across an `ifdef`/`else`** (opentitan's
`jtag_if.sv`) now parse: the unit is kept verbatim as a whole, the
standing directive-split trade, instead of nesting and losing its
closer.
- **A net delay after the type** (`wire [31:0] #0.1 x = y;`, where the LRM
puts it) is accepted and printed where it was written.
- Documentation: the repository analysis audit's README and site rewrite
(architecture across all eight crates, topo facts at codec 17) is
committed; its three findings are planned as TODO §41–§43.
## 0.41.0 — 2026-09-04
### Code actions off the fan-out
- **Lazy port refactorings.** For a client that supports
`codeAction/resolve` (VS Code does), the port actions are offered from
the buffer and the instantiated module's declaration alone, and the
edit is computed when the action is picked. The request VS Code sends
on nearly every cursor move no longer reads the module's fan-out:
flat at ~55 µs in-process from a 3-file to a 128-file fan-out, where
it was linear (15 ms at 128). A resolve for an action that no longer
applies is an error, not an empty edit. Clients without resolve
support get the edit up front, as before.
- **Definitions from the index.** `textDocument/definition` and
workspace symbols for a file-scope declaration in a closed file now
build the location from the positions the index already records
instead of reading the file: 0.4 µs against 28 µs per answer.
- **inlayHint at the default scope**: investigated, not changed. The
hints missing at that scope belong to a module declared outside what
the scope reaches; definition and hover say the same. A scope
question, recorded in the feature README.
## 0.40.0 — 2026-09-04
### Two parser residues and atomic writes
Generated
+9 -8
View File
@@ -97,7 +97,7 @@ dependencies = [
[[package]]
name = "lucisv"
version = "0.40.0"
version = "0.42.0"
dependencies = [
"lucisv_core",
"rayon",
@@ -108,11 +108,11 @@ dependencies = [
[[package]]
name = "lucisv_core"
version = "0.40.0"
version = "0.42.0"
[[package]]
name = "lucisv_server"
version = "0.40.0"
version = "0.42.0"
dependencies = [
"lsp-server",
"lsp-types",
@@ -248,15 +248,16 @@ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
[[package]]
name = "vlog_formatter"
version = "0.40.0"
version = "0.42.0"
dependencies = [
"vlog_parser",
]
[[package]]
name = "vlog_linter"
version = "0.40.0"
version = "0.42.0"
dependencies = [
"lucisv_core",
"vlog_formatter",
"vlog_parser",
"vlog_semantic",
@@ -264,11 +265,11 @@ dependencies = [
[[package]]
name = "vlog_parser"
version = "0.40.0"
version = "0.42.0"
[[package]]
name = "vlog_refactor"
version = "0.40.0"
version = "0.42.0"
dependencies = [
"vlog_parser",
"vlog_semantic",
@@ -276,7 +277,7 @@ dependencies = [
[[package]]
name = "vlog_semantic"
version = "0.40.0"
version = "0.42.0"
dependencies = [
"vlog_parser",
]
+1 -1
View File
@@ -12,7 +12,7 @@ members = [
]
[workspace.package]
version = "0.40.0"
version = "0.42.0"
authors = ["Guoliang Chen"]
edition = "2021"
license = "MIT"
+90 -13
View File
@@ -2,6 +2,12 @@
A Verilog and SystemVerilog formatter, linter, and language server written in Rust.
Start with the [repository analysis](docs/repository-analysis.md) for a code-based
assessment and [dependency topology](docs/topo.md) for interfaces and change
impact. The [documentation site source](docs/site/README.md) contains usage
guides and references; [CHANGELOG.md](CHANGELOG.md) records releases, and
[TODO.md](TODO.md) tracks work in progress.
An opinionated, fast formatter and linter for Verilog-2001 and SystemVerilog
RTL, built in the image of [ruff](https://github.com/astral-sh/ruff), with
layout conventions and lint ergonomics borrowed from
@@ -160,9 +166,9 @@ with a file that sets only `line-length` uses both). `exclude` is the
exception: config patterns are *added* to `--exclude`, not replaced by it.
An unknown key, a bad value, an out-of-range number, or any TOML beyond the
supported subset (tables other than `[lint]`, multi-line arrays, string
escapes) is a hard error naming the file and line — exit 2, with nothing
written. This is deliberate:
supported subset (tables other than `[lint]` and `[lint.<rule>]`, multi-line
arrays, unsupported string escapes) is a hard error naming the file and
line — exit 2, with nothing written. This is deliberate:
a silently ignored `line_length` typo costs more than a strict parser does.
## Linting
@@ -387,13 +393,52 @@ wire a; // lucisv: waive no-tabs suppresses that rule on this line
works unedited — including waivers naming Verible rules lucisv has not
implemented, which are ignored rather than reported. A waiver of lucisv's own
that suppresses nothing, names an unknown rule or is malformed is reported
under `unused-waiver`. External waiver files are not supported. Full rules:
under `unused-waiver`.
Findings can also be suppressed from **outside** the RTL, in Verible's
waiver-file format — one directive per line, `#` comments and blank lines
ignored:
```text
# every line of every file
waive --rule=no-tabs
# one line, or a range with both ends included
waive --rule=line-length --line=12
waive --rule=line-length --line=12-20
# only the files a pattern names
waive --rule=no-tabs --location=legacy/top.sv
```
`--rule` is required and names exactly one rule (a severity word is not
accepted). `--line` is 1-based. `--location` is matched the way an
`--exclude` pattern is — `*` within one path component, a pattern with `/`
matching a path suffix, one without matching the file name at any depth — and
**not** as a regular expression; a pattern that looks like one (`.*`, `\.`,
`[…]`) is an error naming the difference.
Waiver files come from three places, and they add up: `lucisv check
--waiver-file <path>` (repeatable, relative to the working directory),
`waivers` under `[lint]` in `lucisv.toml` (relative to that file; read by the
CLI and the editor), and the editor setting `lucisv.lint.waivers` (relative to
the first workspace folder). External and inline waivers are a union: a
finding either covers is suppressed, and one both cover leaves neither
reported as dead. A missing file or an unparsable directive fails `lucisv
check` with `<file>:<line>: <message>` and exit 2; in an editor the bad line
is dropped and the rest of the file applies — a bad line in a file named by
the editor setting is written once to the lucisv log, one named by
`lucisv.toml` is not (run `lucisv check` to see it). Unused external waivers
are reported under `unused-waiver` at their line of the waiver file, by
`lucisv check` only and only after the whole run.
The server currently selects rules from `lucisv.lint.*` editor settings;
project `[lint] select/ignore` lists affect the CLI only. Project per-rule
options are read by both front ends. Full rules:
`docs/features/linter-core/README.md`.
## Architecture (the ruff mapping)
The workspace mirrors ruff's crate layout — a comment-preserving parser, a
generic pretty-printing IR, language formatting rules, and a thin CLI:
The eight-crate workspace separates source syntax, reusable engines, project
inputs, and the CLI/LSP front ends. The formatter follows ruff's separation
of document layout from language rules:
| This repo | ruff equivalent | Role |
|---|---|---|
@@ -401,7 +446,20 @@ generic pretty-printing IR, language formatting rules, and a thin CLI:
| `crates/vlog_formatter/src/{doc,printer}.rs` | `ruff_formatter` | Wadler/prettier-style document IR (`Text`/`Line`/`Group`/`Indent`) + width-aware printer |
| `crates/vlog_formatter/src/format/` | `ruff_python_formatter` | Per-node formatting rules, one module per grammar domain (`item`, `module`, `instance`, `decl`, `stmt`, `expr`, `class`, `cover`, `sva`, …) |
| `crates/vlog_linter` | `ruff_linter` | Rule registry, violations, fix applicability, waivers |
| `crates/lucisv` | the `ruff` CLI | File discovery, in-place rewriting, `--check`, `check`, stdin mode |
| `crates/vlog_semantic` | — | File scopes and references, workspace index, conservative cross-file resolution |
| `crates/vlog_refactor` | — | Verified rename, references, port refactors, instantiation plans |
| `crates/lucisv_core` | — | Shared config, filelists, walks, format cache, atomic replacement |
| `crates/lucisv` | the `ruff` CLI | Parallel per-file formatting/linting, reports, stdin, in-place writes |
| `crates/lucisv_server` | — | Synchronous LSP loop, open-buffer overlays, indexing, editor capabilities |
`vlog_parser` and `lucisv_core` have no dependencies. The formatter depends
only on the parser; semantic analysis also depends only on the parser.
Linting consumes the parser, semantics and `lucisv_core` (for the one
`--exclude`-style matcher a waiver file's `--location` shares with the CLI);
refactoring consumes the parser and semantics. The CLI reaches
semantics through the linter and has no refactoring dependency. The server
composes all six libraries. See [topo.md](docs/topo.md) for the full graph,
including the linter's formatter dependency used only by tests.
Key ideas carried over from ruff/prettier:
@@ -414,8 +472,15 @@ Key ideas carried over from ruff/prettier:
lists, expressions, concatenations) is a `Group`: it renders on one line if
it fits within the line limit, otherwise it breaks one-element-per-line.
A comment inside a group forces it to break.
- **Idempotency as a hard invariant.** The test suite formats every fixture
twice and asserts a fixed point.
- **Verification on every formatting call.** The engine re-lexes input and
output and compares normalized tokens, including comments. It then parses
and formats the output again and requires a fixed point. Either check can
reject the result; the caller retains the original file. This is a lexical
safety net, not compiler elaboration or a proof of hardware equivalence.
- **Two parsing modes.** Formatting uses strict parsing. Linting and the
editor use tolerant parsing: failed elements become error leaves while
valid siblings remain available for analysis. A lexer failure is still
all-or-nothing. Neither mode performs cross-file macro expansion.
## Style
@@ -871,8 +936,11 @@ vim.lsp.enable('lucisv')
**Which files the server indexes.** A filelist if the project has one — the
`filelist` key of its `lucisv.toml`, or the editor setting `lucisv.filelist`
(a path, absolute or relative to the workspace folder) — and then exactly the
files it names. Otherwise the workspace folder, walked as the CLI walks it;
and with no folder open at all, the current file's own directory. Open buffers
files it names. Otherwise the default `lucisv.index.scope = "folder"` starts
from open-file folders, widens by `lucisv.index.scopeDepth` (default 2), and stays bounded by
the workspace roots; `"workspace"` walks the full roots. With no folder open,
the server stays in the current file's directory: depth 0 scans it flat; a
positive depth walks its descendants but never climbs to a parent. Open buffers
are always indexed on top. A filelist that cannot be read warns and falls back
to the folder walk, so the index is never silently empty.
@@ -903,11 +971,20 @@ expected; no PRs or review required.
```bash
cargo build --release # binaries at target/release/{lucisv,lucisv-server}
cargo test # unit + snapshot + idempotency tests
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
tools/guard.sh -- cargo test --workspace # unit, integration, snapshots, doc tests
```
Snapshot tests live in `crates/vlog_formatter/tests/fixtures/`; regenerate
expected outputs with `UPDATE_SNAPSHOTS=1 cargo test -p vlog_formatter`.
expected outputs only for intentional formatting changes with
`UPDATE_SNAPSHOTS=1 tools/guard.sh -- cargo test -p vlog_formatter`.
Table-driven cases live in `crates/vlog_formatter/tests/cases/`; lint cases
live in `crates/vlog_linter/tests/cases/`. All tests, fuzzers, and corpus/tree
sweeps must run through `tools/guard.sh` (8 GiB RSS / 30 minutes by default),
as required by [CLAUDE.md](CLAUDE.md). A guard kill is a finding, not a reason
to increase the limit. Documentation build instructions are in
[docs/site/README.md](docs/site/README.md).
## Install and releases
+564 -25
View File
@@ -43,13 +43,14 @@ Legend: **[V]** = practice from Verible, **[R]** = from ruff, **[V+R]** = both.
`vlog_parser::parser` that returns a parse error past a documented limit
(ruff does the same). Do the same in the formatter's recursive walk.
- [ ] **Atomic in-place writes.** QA find during cli-filelist (2026-08-25,
- [x] **Atomic in-place writes.** QA find during cli-filelist (2026-08-25,
pre-existing): `process_file` and the `--fix` path write with plain
`fs::write` (open/truncate/write) while `cache.rs` next door already
does tempfile+rename. Two workers reaching one inode through two
spellings (symlink alias — lexical dedup cannot see it) could tear a
file. Fix: tempfile+rename in both writers; optionally canonicalized
dedup keys as a second line of defense.
**Delivered by §36.3** (0.40.0): `lucisv_core::atomic::write_atomic` in all three writers.
## 2. Formatter features
@@ -217,7 +218,7 @@ Verible's rule ergonomics (waivers, configurable rules).
→ `Fix { edits, applicability: Safe | Unsafe }` and `--fix` /
`--unsafe-fixes`. Only `no-tabs` and `no-trailing-whitespace` ship fixes
(both Safe); the unsafe path is plumbed and tested but no rule uses it yet.
- [ ] **[V] Waiver mechanisms:** inline `// lucisv: waive rule-name` (accept
- [x] **[V] Waiver mechanisms:** inline `// lucisv: waive rule-name` (accept
`verilog_lint: waive` for migration), `waive-start`/`waive-stop` ranges,
and external waiver files (`waive --rule=X --line=N --location=glob`) for
code you can't touch. ruff's lesson: also warn about *unused* waivers.
@@ -225,8 +226,11 @@ Verible's rule ergonomics (waivers, configurable rules).
`unused-waiver` pseudo-rule (unused, unknown rule, malformed, unmatched
`waive-stop`). A `verilog_lint:` waiver naming a rule lucisv lacks is
ignored rather than reported, so Verible-annotated code lints unedited.
- [ ] external waiver files — needs a file format, a discovery rule and a
precedence story against inline waivers.
- [x] external waiver files — needs a file format, a discovery rule and a
precedence story against inline waivers. **Delivered by §39**: Verible's
format, discovered from `[lint] waivers`, `--waiver-file` and
`lucisv.lint.waivers`, union with the inline waivers, unused ones
reported by the CLI after the whole run.
- [x] **[V] Configurable naming rules via regex** (module/instance/
parameter/enum naming), with named presets like Verible's
(snake_case, ALL_CAPS, etc.).
@@ -246,10 +250,11 @@ Verible's rule ergonomics (waivers, configurable rules).
and an "every registered rule appears" test. Renderable today via
`cargo run -p vlog_linter --example rules_markdown`; a `lucisv check
--rules-doc` flag is filed as a handshake for `crates/lucisv`.
- [ ] Seed rules (all syntactic, all from Verible's default set):
- [x] Seed rules (all syntactic, all from Verible's default set):
no-tabs, no-trailing-spaces, explicit-parameter-storage-type,
case-missing-default, always-ff-non-blocking / always-comb-blocking,
forbid `wire`-reg mixups in SV files, module-filename match.
**All delivered** — every rule named here exists (`explicit-parameter-storage-type`, `case-missing-default`, `always-ff-non-blocking`, `always-comb-blocking`, `module-filename`, the two above); 73 rules as of 0.39.0.
- [x] `no-tabs`, `no-trailing-whitespace`,
`explicit-parameter-storage-type`, `case-missing-default`,
`always-ff-non-blocking`, `always-comb-blocking`, `module-filename` —
@@ -278,14 +283,16 @@ Adapt each:
Port cases directly from `formatter_test.cc` where our supported-syntax
overlaps — it encodes years of accumulated edge cases (translate expected
output to our style: 2-space indent matches, wrap style differs).
- [ ] **[V] Run equivalence + convergence on *every* test case**, not just
- [x] **[V] Run equivalence + convergence on *every* test case**, not just
snapshots — once §1's `verify_equivalence` exists, assert it in the
fixture harness too, so every new case buys three checks for free.
- [ ] **[V] Component-level tests.** Verible tests the pipeline stages
**Delivered:** `format_source` runs `verify_equivalence` and `verify_convergence` on every output (`format/mod.rs`), so every fixture, snapshot, corpus file and fuzz case buys all three checks.
- [x] **[V] Component-level tests.** Verible tests the pipeline stages
separately (`token-annotator_test.cc`, `tree-unwrapper_test.cc`). Ours:
unit tests for `lexer.rs` trivia attachment (comment → leading/trailing
decisions, blank-line counting), `parser.rs` per-construct parse tests,
and `printer.rs` group-breaking behavior on synthetic docs.
**Delivered incrementally:** `lexer.rs` carries 37 unit tests on trivia and tokens, `parser/tests/` is one module per construct, `printer.rs` has its own group-breaking tests.
- [x] **[V] Lint test harness with inline violation markers.** Port the
`LintTestCase` / `RunLintTestCases` idea: test cases embed expected
findings positionally in the source (Verible splices `ExpectedTokenInfo`
@@ -309,8 +316,9 @@ Adapt each:
(inputs the formatter refuses must say `#tolerant`, enforced in both
directions like `#SKIP`; that population is empty today — all 5 fix cases
for the 2 fixable rules run the full cross-tool check).
- [ ] **[V] Error-case tests.** Table of inputs that must *fail* to parse
- [x] **[V] Error-case tests.** Table of inputs that must *fail* to parse
with the expected error position — locks in the failsafe path.
**Delivered** by error-recovery / header-recovery: the `BROKEN` table in `vlog_parser/tests/error_recovery.rs` plus `a_diagnostics_span_is_the_token_its_line_col_names`.
- [x] **[R] Real-world corpus check (ruff's "ecosystem check").** ruff
CI runs against big OSS codebases and diffs results between commits. Do
the same with permissively-licensed RTL: e.g. lowRISC Ibex, OpenTitan,
@@ -392,12 +400,14 @@ Adapt each:
lives in a file lucisv deliberately does not read. `directive-split` (14
files) is still the top blocker, and every remaining failure is in a
deliberately-unsupported category.
- [ ] **[R] Fuzzing.** ruff fuzzes its parser. `cargo-fuzz` targets:
- [x] **[R] Fuzzing.** ruff fuzzes its parser. `cargo-fuzz` targets:
(a) parser must never panic on arbitrary bytes, (b) for inputs that
parse, format must satisfy equivalence + convergence.
- [ ] **[R] Consider `insta`** for the snapshot harness (review workflow
**Delivered in-tree, without `cargo-fuzz`** (nightly + a dependency): the guarded truncation and single-character-deletion fuzzers in `vlog_parser/tests/error_recovery.rs` (a), and the formatter gap fuzzers from comment-slots (b), all run under `tools/guard.sh`.
- [x] **[R] Consider `insta`** for the snapshot harness (review workflow
`cargo insta review` beats `UPDATE_SNAPSHOTS=1`), keeping the
idempotency loop from `fixtures.rs`.
**Ruled 2026-09-04:** no. The `UPDATE_SNAPSHOTS=1` loop plus the idempotency suite has served 40 releases; a dependency for a review UI is not worth its weight.
## 6. LSP: full editor support (a first-class goal, not a maybe)
@@ -560,7 +570,7 @@ later:
`exit` over hand-rolled framing. Manual install steps only — CI packaging
and Marketplace publishing are out of scope, and `publisher` is a
placeholder. `docs/features/editor-packaging/README.md`.
- [ ] **Salsa-style incrementality — defer.** ruff's `ruff_db` uses salsa;
- [x] **Salsa-style incrementality — defer.** ruff's `ruff_db` uses salsa;
don't take that dependency until hover/definition across files exists.
Per-file recompute is fine at Verilog file sizes.
**Partly answered without salsa, 2026-08-27**
@@ -611,6 +621,7 @@ later:
Answers given mid-scan read the index as of that moment, and only the startup
scan gives them: a request queued behind a message that asked for a rescan
waits for that rescan, which is the order contract the loop always kept.
**Ruled 2026-09-04:** not needed. `incremental-index` (per-file `update_file`, batch publish) and the persistent facts store answer every cross-file question without salsa.
- [x] **Release prep.** `LICENSE` (MIT), `CHANGELOG.md` (v0.2.0), version
bumped to 0.2.0 across the workspace and the extension, `tools/release.sh`
(release binaries + `.vsix` + `SHA256SUMS` into a gitignored `dist/`) and
@@ -1220,32 +1231,41 @@ Files: `crates/lucisv_server/src/{candidates.rs,state.rs,server.rs,perf.rs}`,
own, which is quadratic in the batch — **403 ms of the 935 ms** on
opentitan's `hw/ip`. Counted per batch and merged once: 43 ms.
Warm **935 / 881 → 555 / 564 ms**, cold **1 529 → 1 175 ms**.
- [ ] **Still slow, filed:** what is left of that jump is real work over
- [x] **Still slow, filed:** what is left of that jump is real work over
1 683 genuinely new files — 325 ms re-lexing them for the
completion word table (the persistent store holds a file's facts
but not its words), ~100 ms walking and reading them, ~80 ms
hashing and decoding records. Storing the word list beside the
facts is the next lever and is `index-persistence`'s call: it is a
`FACTS_FORMAT` change.
- [ ] **Not done, deliberately:** a widen still does not interleave, so
**Delivered by `FACTS_FORMAT` 13** (semantic-lints-on, 2026-09-02): the word census is a fact, so a cached hit brings its words and a scan never re-lexes for the table (`state.rs`, "Read off the record").
- [x] **Not done, deliberately:** a widen still does not interleave, so
this is a bar the user watches once per session per big widen. The
coalescing rule is unchanged.
**Ruled 2026-09-04:** stays as is; a widen is one bar per session per big widen.
### Deferred, filed
- [ ] `codeAction` costs 185–201 ms at a 128-file fan-out and offers
- [x] `codeAction` costs 185–201 ms at a 128-file fan-out and offers
**zero** actions there (`performance_take2.md` §6a): ~1.4 ms per
instantiating file plus a ~13 ms floor, paid before anything knows
there is nothing to offer. Wants either the lazy resolve below or
a cheap zero-detector that answers before the fan-out is walked.
- [ ] `inlayHint` returns **0 hints at the default scope** where the
**Delivered by §37.1**: the offer is flat at 54–59 µs from a 3- to a
128-file fan-out, both cursor shapes.
- [x] `inlayHint` returns **0 hints at the default scope** where the
workspace scope returns 4 (`performance_take2.md` §8): investigate
before assuming it is scope-relative-answers working as intended —
the hinted instantiation's module may be in scope and still unhinted.
- [ ] codeAction lazy resolution (`codeAction/resolve`): make the offer
**Investigated by §37.2 and ruled correct**: the four hints are
`pins_if`'s, declared in `hw/dv/sv/common_ifs`, which the widen to
`hw/ip/aes` does not reach; hover and definition answer nothing for it
either. Finding and two default-scope tests in
`docs/features/lazy-code-action/README.md`.
- [x] codeAction lazy resolution (`codeAction/resolve`): make the offer
index-only (~0 ms regardless of fan-out), edits computed on
lightbulb click — kills the 83 ms worst case. Owner-approved
direction, after the wave.
direction, after the wave. **Delivered by §37.1.**
- [x] Rename over an index-stale workspace: Lane A must state the
staleness premise; if the verifier cannot catch a hidden
reference, the honesty gate is the lead's review call. Stated
@@ -1290,10 +1310,17 @@ and three owner items. See
lowercased index with a character-mask pre-filter and a counting
top-K — 3–8 ms per query over a generated 120 000-entry
hierarchy, asserted in the node suite.
- [ ] Filed, not done: rewire `locate::location` onto `DeclPositions`
- [x] Filed, not done: rewire `locate::location` onto `DeclPositions`
so `textDocument/definition`, references, the lens and both
hierarchies stop reading a file to convert an indexed span. Every
unit's range is now in the index for free.
unit's range is now in the index for free. **Delivered by §37.3**
for the file-scope answers `nav.rs` and `symbols.rs` give
(27.9 µs → 0.42 µs per definition on opentitan); references, the
lens and the hierarchies answer from `ReferenceSite`/`InstantiationEdge`
spans, which are not `Def`s and record no `DeclPositions`, and
`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,
screen readers, an old server binary, both VSIX shapes).
@@ -1335,8 +1362,9 @@ README.md, TODO.md §11 Lane B lines)
swallowed by the condition's first call. Out of Lane B's file set;
filed as a handshake in `docs/features/formatter-bug-fixes/
README.md`.
- [ ] Owner/lead: the one-line parser fix above (Lane A's file), which
- [x] Owner/lead: the one-line parser fix above (Lane A's file), which
closes the last of the 12.
**Delivered 2026-08-29** by directive-in-statements (`take_before_open` request, formatter-bug-fixes README).
### Serial, after Lane A merges (parser.rs frees up)
@@ -1427,23 +1455,35 @@ into an opaque blob are now parsed (see below). Corpus byte-identical at
true at 256, false at 1024 — while re-verifying the phase argument that
keeps the two budgets additive.
`docs/features/recursion-limit/README.md` round 4.
- [ ] **Skipped, `jtag_if.sv`**: its clocking blocker is fixed; a
- [x] **Skipped, `jtag_if.sv`**: its clocking blocker is fixed; a
**pre-existing** one sits behind it. Two rival, bracket-*balanced*
interface headers in an `` `ifdef ``/`` `else `` region, which
`at_split_conditional` does not fire on (it requires an open bracket), so
the parser nests them. Handshake request to a future `directive-split`
round; reproduced on trunk grammar alone.
- [ ] **Skipped, `SimDTM.sv`**: a net delay written *after* the type
**Delivered by §38.1** (2026-09-04): `parse_module`'s body loop detects
the rival, `at_split_conditional`'s fourth condition is now "bracket
open **or** rival header" and `scan_split_extent` runs to the unit's own
closing keyword, so the whole unit is one `ItemKind::Verbatim`. The file
parses and formats; its body is not laid out — the standing
`directive-split` trade. `docs/features/parser-skips/README.md`.
- [x] **Skipped, `SimDTM.sv`**: a net delay written *after* the type
(`wire [31:0] #0.1 x = y;`), which is where the LRM puts it — lucisv
parses it only before. One `DataDecl` field has one print position, so
accepting both spellings needs a positional field or the safety net
rightly refuses the reordered tokens. One vendor file in `tb/unused/`.
- [ ] **Skipped, `kmac_reduced_tb.sv`**: a trailing comma in a *named*
**Delivered by §38.2** (2026-09-04): the positional field is
`NetDelay { expr, after_type }`; the parser accepts either position and
never both, and the formatter prints it where it was written, so no
token moves. `docs/features/parser-skips/README.md`.
- [x] **Skipped, `kmac_reduced_tb.sv`**: a trailing comma in a *named*
parameter override list. Not legal SystemVerilog; rejecting it is
correct.
- [ ] **Recommended instead of grammar work**, for the sweep's non-SystemVerilog
**Closed 2026-09-04:** rejecting it is correct; nothing to do.
- [x] **Recommended instead of grammar work**, for the sweep's non-SystemVerilog
files: exclude patterns `**/*.tpl.sv`,
`**/vendor/google_riscv-dv/**`, `**/pulp_riscv_dbg/tb/unused/**`.
**Ruled 2026-09-04:** not excluded; the six failures (all in the three trees named here) stay in the 814/820 count as the honest number, and are listed in the release gates each round.
## 12. Inline instantiation wave (2026-08-30) — owner request
@@ -2177,13 +2217,14 @@ docs/features/escaped-identifiers/README.md (new), TODO.md §19.
comment, so no corpus file reaches the new branch. Same for the
read-only opentitan sweep (13 failures, all parse/lex, zero
verification errors).
- [ ] **Follow-up for a parser lane**: `Parser::parse_scoped_name`
- [x] **Follow-up for a parser lane**: `Parser::parse_scoped_name`
joins `pkg::name` into one `String`, losing the boundary, so a
`\my-pkg ::\state-t` type (or instantiated module, or `bind`
target) is still rejected by the net — an error, never a
corruption. Keep the segments. Recorded as the file's one `#SKIP`
case and as
`an_escaped_name_in_a_scoped_type_is_rejected_rather_than_corrupted`.
**Delivered by escaped-identifiers** (2026-09-02): `push_scope_segment` keeps the terminating space, the `#SKIP` is gone, the verification pin is inverted (README, "How it was answered").
- [x] **QA (2026-09-02)**: gates clean (fmt, clippy 0, tests 2819/0 after
one QA-added attack pair, corpus 813/820 unchanged); scope matches
the file list above exactly, `verify.rs` confirmed absent from the
@@ -3999,3 +4040,501 @@ opentitan read-only sweep, vsix smoke, 0.40.0.
`mismatched-labels` had no arm for the block; fixed by the lead at
review with a test, plus the LOW doc comment and a read-only-target
refusal in `write_atomic` (parity with the old `fs::write`)
## 37. Server residue from §10 (planned 2026-09-04) — lazy codeAction resolve, the inlayHint zero, `locate` onto `DeclPositions`
One lane in the main tree, dev Opus 5 then QA Sonnet 5, same protocol as
§36 (lead snapshots the diff before QA; QA never runs a git command that
rewrites the tree). Feature README: `docs/features/lazy-code-action/README.md`
(one README for the three, sections per item). Ships as 0.41.0.
**Expected touch set:** `crates/lucisv_server/src/{ports.rs,code_action.rs,
locate.rs,nav.rs,symbols.rs,inlay.rs,main.rs,state.rs,perf.rs}`,
`crates/lucisv_server/src/server/{dispatch.rs,mod.rs}`,
`crates/lucisv_server/tests/e2e.rs`, `crates/vlog_refactor/src/ports/mod.rs`
(only if the offer needs a new one-file question), the §10 lines this closes
(1236–1249 and 1293), `docs/features/server-lint/README.md`'s resolve note,
this section. Anything else is named in the work log.
### 37.1 `codeAction/resolve` for the port refactorings (§10, owner-approved)
`ports::code_actions` costs ~1.4 ms per instantiating file plus a 13 ms
floor on every cursor move (`docs/performance_take2.md` §6a: 185 ms at a
128-file fan-out, to offer zero actions), because the *offer* already
computes the full edit over `Workspace::module_sources` — the module's
fan-out **plus every open buffer**, each read as text. The quick fixes in
`code_action.rs` are cheap and stay eager; only the port actions change.
- **The offer is local.** Whether an action exists at the cursor is a
one-file question plus, for a cursor on an instantiation, the instantiated
module's own declaration (`vlog_refactor::module_definition` through the
index — one file, the way `inlay.rs`'s `Plans::read` does it). Run the
engine's `port_actions` over exactly those sources to learn which actions
exist; throw the edits away. No fan-out is read. The title's count
("updates N instantiations") comes from the index
(`instantiations_of(name)` — say in the doc whether that is instances or
files, and word the title to match); the unsaved-buffer case in
`an_unsaved_buffer_contributes_the_instantiation_the_index_has_not_seen`
is answered by the *resolved* edit, which is still exact — move that pin
to resolve.
- **Resolve computes the edit.** Each offered action carries `data`
(`{uri, position, title}`) and no `edit`. `codeAction/resolve` re-runs
today's eager path at that position and returns the action whose title
matches, with its `edit`. No match (the buffer changed under the
lightbulb) is an error response, `"the action is no longer available"`,
not a silent empty edit. Advertise `resolve_provider: Some(true)`.
- **A client that cannot resolve gets today's answer.** Read
`textDocument.codeAction.resolveSupport.properties` at `initialize`; only
when it lists `"edit"` is the offer lazy. Keep the flag in the server
state beside whatever `main.rs` already reads from the client
capabilities (the range-formatting registration is the precedent).
- Tests: the lazy offer's titles and kinds equal the eager offer's, over
the `crowded` tree; the resolved `WorkspaceEdit` is byte-equal to the
eager one (both cursor shapes: a port declaration, an instantiation with
missing connections); the no-resolveSupport client gets the eager shape;
a resolve after the document changed errors; the offer over
`crowded(40)` reads none of the noise files and none of the fan-out
(pin it the way `the_files_a_code_action_reads_are_the_modules_own_fan_out`
pins the eager path — through what the offer asks the workspace for);
an e2e case over the wire (`tests/e2e.rs`): initialize with
resolveSupport → `codeAction` returns `data` and no `edit` →
`codeAction/resolve` returns the edit; initialize without → the edit is
inline. `perf.rs`'s `a_code_action_at_an_instantiation_before_and_after`
gains an "offer" column; report the three numbers in the work log.
### 37.2 `inlayHint` returns 0 at the default scope where workspace scope returns 4 (§10 / take-2 §8)
Investigate before fixing: `Plans::read` asks `module_definition` of the
index, and at folder or default scope the instantiated module's file may
not be in the index even though §4b says the default scope now answers
cross-file questions (the `didOpen` widen). Find which lookup the
neighbours (hover, signature help, completion) use that inlay does not,
and make inlay use it. Deliverable is one of: a fix with a test at the
default scope (a `sub.sv` outside the opened folder, `top.sv` inside it,
hints appear after the widen), or — if the zero is correct — a paragraph
in the README saying exactly why, for the lead to rule on. Not a gate.
### 37.3 `locate::location` onto `DeclPositions` (§10, filed)
`Def::lines.positions` (`DeclPositions { name, decl }`, `Some` for every
file-scope declaration) already holds the client-side ranges, so
`textDocument/definition`, references, the lens and both hierarchies need
not read a file to convert an indexed span. Add the index-only path in
`locate.rs` for a `Def` whose positions are recorded (members keep the
file-read path — they have none) and route `nav.rs`/`symbols.rs`'s
file-scope answers through it. Pins: the index-only `Location` equals the
file-read one over files with multi-byte and astral characters (UTF-16
surrogates), CRLF and a BOM; a file-scope definition answers without a
`file_view` being created (assert through whatever the view cache exposes,
or add a test-only counter — say which); a definition request over an
opentitan file timed before/after, read-only, in the work log.
### Gates (dev, guarded)
`cargo fmt -p` per touched crate; clippy clean; `tools/guard.sh -- cargo
test --workspace`; `tools/guard.sh -- tools/corpus_check.sh` unchanged
(814/820, same six); the e2e suite green; vsix smoke. Lead at review:
byte-identity vs 0.40.0, opentitan read-only sweep, 0.41.0.
- [x] 37.1 lazy offer + resolve + capability gate + e2e + perf column
- [x] 37.2 inlayHint: fix with test, or the written finding — the written
finding (the zero is correct), plus two default-scope tests
- [x] 37.3 `locate` index-only path + pins + timing
- [x] docs: feature README; §10 lines ticked; server-lint note
- [x] Gates (guarded)
- [x] QA: resolve attacked (stale document, wrong data, missing data,
client without resolveSupport, both cursor shapes, unsaved buffer);
inlay at the default scope against a real two-folder tree; locate
equality over the encoding shapes; opentitan timing re-derived —
PASS, no findings above LOW; offer ~4.5 ms vs eager ~77 ms over the
wire at the 128-file fan-out
## 38. The two §11 parser skips (planned 2026-09-04) — rival headers in a conditional region, a net delay after the type
One lane in the main tree, dev Opus 5 then QA Sonnet 5, §36's protocol.
Feature README: `docs/features/parser-skips/README.md`. Ships as 0.42.0
together with §39.
**Expected touch set:** `crates/vlog_parser/src/parser/{module.rs,split.rs,
decl.rs}`, `crates/vlog_parser/src/ast/decl.rs`,
`crates/vlog_formatter/src/format/decl.rs`, `crates/vlog_formatter/tests/cases/*`
(new cases), `crates/vlog_parser/src/parser/tests/{module.rs,decl.rs,split.rs}`,
`crates/vlog_parser/tests/error_recovery.rs`, the two §11 lines (1453, 1459),
this section.
### 38.1 Two rival, bracket-balanced module/interface headers in an `ifdef`/`else` region (`jtag_if.sv`)
The real file: `/Users/guoliangchen/repo/opentitan/hw/dv/sv/jtag_agent/jtag_if.sv`
(read-only; copy it into a test case). Shape:
```
`ifdef GATE_LEVEL
interface jtag_if #(parameter int unsigned P = 41_664) ();
`else
interface jtag_if #(parameter int unsigned P = 20_000) ();
`endif
wire tck;
…
endinterface
```
Today the first header parses in full, the `` `else `` is a directive item
of its body, the second `interface jtag_if` becomes a *nested* interface,
and the outer one reaches EOF without its `endinterface`: "163:1: expected
`endinterface`". `at_split_conditional` (split.rs) never fires because
nothing errors until EOF and the headers are bracket-balanced.
- **Detect the rival in `parse_module`'s body loop**, before the item is
parsed: the cursor is on an `` `else ``/`` `elsif `` that continues a
region opened *before this item's own first token* (`open_conds` at the
item's mark is above zero and no region has been opened since), and the
tokens after it are the same keyword (`module`/`interface`/`program`) and
the same name as the header just parsed. That is a header written twice
across the arms, not a nested unit. Raise a `ParseError` there ("rival
header for `jtag_if` in a conditional region").
- **Route it into the existing split.** `split_conditional_item` already
turns an item that errored inside a region into `ItemKind::Verbatim`
over the whole item (`capture_split`) — extend `at_split_conditional`'s
trigger so this error qualifies with the brackets balanced (a flag on
the error, or a dedicated check beside the bracket one; say which and
why), and make sure `scan_split_extent` runs to the unit's real closer
(`endinterface`) so the whole unit is the verbatim item, the way a
bracket-unbalanced header is today. Strict and tolerant modes get the
same tree. The formatter prints a `Verbatim` item byte-for-byte, so the
file formats (its body is not formatted; that is the standing trade for
a split header, recorded in the directive-split README — cite it).
- Not a rival: a second `module x` written in the `` `else `` arm of a
region opened *inside* the body (that is two nested units, illegal, and
stays the error it is); a different name after the `` `else ``; a region
closed before the item began. Pin each as a negative.
- Tests: the jtag_if shape (`module` and `interface` spellings, with and
without `#(...)`, with `()` and with a real port list); the three
negatives; the real file as a cases entry (idempotent, comments kept,
the body verbatim); `tolerant_parse_equals_strict_parse_on_valid_sources`
still green; the fuzzers.
### 38.2 A net delay written after the type (`SimDTM.sv`)
`wire [31:0] #0.1 x = y;` is where IEEE 1800 §6.7 puts a net delay
(`net_type [drive_strength] [vectored|scalared] data_type_or_implicit
[delay3] list_of_net_decl_assignments`); lucisv parses the delay only
between the net keyword and the type. Real file:
`/Users/guoliangchen/repo/opentitan/hw/vendor/pulp_riscv_dbg/tb/unused/SimDTM.sv`
lines 38–40 (read-only).
- `DataDecl` gains the position: replace `delay: Option<Expr>` with
`delay: Option<NetDelay>` where `NetDelay { expr: Expr, after_type: bool }`
(or two fields — pick the one that keeps every existing consumer a
one-line change, and say). The parser accepts the delay in either
position, never both (both is an error), and records which. The
formatter prints it where it was written: `wire #5 w;` stays, `wire
[31:0] #0.1 x = y;` stays. No normalisation — the safety net compares
token order, and the LRM position is the one the vendor file uses.
- Consumers: every `d.delay` reader across the workspace (`grep -rn
'\.delay' crates`), each a mechanical change; `ast::size_pins`
unchanged or explained.
- Tests: both positions round-trip byte-identical; both written is a
parse error; a delay after a *packed* dimension and after a plain
`logic`-typed net; the SimDTM lines as a cases entry; snapshot suite
green; the corpus check unchanged.
### Gates (dev, guarded)
`cargo fmt -p` per touched crate; clippy clean; `tools/guard.sh -- cargo
test --workspace`; `tools/guard.sh -- tools/corpus_check.sh` — **814/820
still**, since neither file is in the corpus (say so); `lucisv format
--check` on the two opentitan files now parses both (read-only; report the
outcome — `jtag_if.sv` should now be "would reformat" or "unchanged", not
an error). Lead at review: byte-identity vs 0.41.0 over the corpus and the
opentitan sweep — the *only* files whose result may change are these two;
any other difference is a REWORK.
- [x] 38.1 the rival-header detection, the split routing, tests — the
routing is a **dedicated check** (`rival_end_kw`) beside the bracket
one, not a flag on `ParseError`; `scan_split_extent` takes the unit's
closing keyword
- [x] 38.2 `NetDelay` position, both spellings, tests — `NetDelay { expr,
after_type }` as a struct, since both consumers were one-line either
way and the struct cannot represent a position without a delay
- [x] docs: feature README; §11 lines ticked; directive-split README
cross-reference
- [x] Gates (guarded) — workspace 3 744 passed / 0 failed; corpus 814/820,
the same six; both opentitan files "would reformat" (neither is a
parse error any more), opentitan tree untouched
- [x] QA: rival shapes and the three negatives attacked; the two real
files through `--check` and `--stdout` (read-only); delay positions
attacked with comments and attributes around them; opentitan sweep
re-derived with exactly two files changing. Verdict PASS — see
`docs/features/parser-skips/README.md` QA log (2026-09-04).
## 39. External waiver files (planned 2026-09-04) — §4's last waiver item
One lane after §38 merges, same protocol. Feature README:
`docs/features/waiver-files/README.md`. Ships as 0.42.0 with §38.
**Decisions taken by the lead** (the "file format, discovery rule and
precedence story" §4 asked for):
- **Format: Verible's**, so an existing `.waiver` file carries over
unchanged. One directive per line:
`waive --rule=<rule> [--line=<N>|--line=<N>-<M>] [--location=<pattern>]`;
`#` comments and blank lines ignored. `--rule` is required and must name
a lucisv rule (`rules_named` validates it, severity words not accepted);
`--line` is 1-based, a range inclusive; `--location` is matched the way
`--exclude` patterns are (`lucisv_core`'s matcher: a pattern with `/`
matches a path suffix, otherwise the file name) — a regex is not accepted
and a `--location` that looks like one (`.*`, `\.`) is an error naming
the difference. No `--location` means every file; no `--line` means the
whole file.
- **Discovery:** `[lint] waivers = ["path", …]` in `lucisv.toml`, paths
relative to that toml; `lucisv check --waiver-file <path>` (repeatable,
relative to the cwd) adds to them; the editor setting
`lucisv.lint.waivers` (a list, relative to the workspace root) adds to
them for the server. A file that does not exist or has a bad line is a
configuration error, reported as `<file>:<line>: message` exactly like a
bad `[lint.<rule>]` entry (CLI exit 2; the server logs it through
`notification.rs` and drops that line, never the file).
- **Precedence: union.** A violation is suppressed when an inline waiver
*or* an external one covers it; nothing overrides anything. Unused
external waivers are reported under the existing `unused-waiver` rule
with the *waiver file* as the path and the directive's line — by the
CLI only, after the whole run (a `--location` may match a file not yet
seen); the server does not report unused external waivers (documented:
it never sees a whole run). An external waiver whose `--location` names
no file in the run is unused.
**Expected touch set:** `crates/vlog_linter/src/waiver_file.rs` (new: parse
+ match; `waiver.rs` stays the inline story and is near 250 lines),
`crates/vlog_linter/src/lib.rs` (apply both), `crates/lucisv_core/src/config.rs`
(`[lint] waivers`), `crates/lucisv/src/{args.rs,lint.rs}`,
`crates/lucisv_server/src/{lint.rs,settings.rs}` + `server/notification.rs`,
`editors/vscode/package.json` (the setting, plus `vlog_linter::vscode`'s
drift test if it generates lint settings), `README.md` and
`docs/site/src/content/docs/reference/` (a "Waivers" section), the §4
lines (221, 229), this section.
- Tests: parse every directive shape and every error (unknown rule,
missing `--rule`, bad line range, regex-looking location); matching by
file name and by path suffix; line and range; union with an inline
waiver on the same violation (one suppression, neither reported unused);
unused external waiver reported at the waiver file's line; server: the
setting adds a file, a bad line is logged once and the rest applies; an
e2e case over the wire; CLI: `--waiver-file` twice, toml + CLI combined,
exit codes.
- [x] 39.1 `waiver_file.rs` + application in `lib.rs` — the union lives in
`lib.rs::waive`, which asks both waiver kinds about every violation and
never short-circuits, so a finding two waivers cover marks both used;
`waiver.rs`'s `filter` became `covers`
- [x] 39.2 discovery: toml (`[lint] waivers`, resolved against that toml),
CLI flag (`--waiver-file`, repeatable, adds to it), editor setting
(`lucisv.lint.waivers`, hand-written in `package.json` — the generator
and its drift test cover only `severity.*` and `rules.*`)
- [x] 39.3 unused reporting (CLI, after the whole run, at the waiver file's
own line); errors `<file>:<line>: message` — exit 2 on the CLI, dropped
line by line and logged once on the server
- [x] docs: feature README; §4 lines ticked. The README/site "Waivers"
section is ready to paste in the feature README under "Docs to apply at
merge (lead)" — those files were being edited by another process
- [x] Gates (guarded): fmt/clippy/workspace tests; corpus unchanged; smoke
- [x] QA: every directive shape and error attacked on both front ends;
precedence attacked; an opentitan run with a waiver file that waives
one real finding, read-only, counts re-derived — verdict REWORK, one
HIGH finding (code-action/fixAll does not honor external waivers); see
the feature README's QA log
## 40. Performance take 3 on opentitan (owner request 2026-09-04) — after §38 and §39 merge
Read-only measurement, no code changes unless a regression is found (then
it is filed, not fixed in this lane). Output: `docs/performance_take3.md`,
same table shapes as `docs/performance_take2.md` so every row is a
before/after, plus a `docs/perf/README.md` entry. Tree:
`/Users/guoliangchen/repo/opentitan` (never written; the three
pre-existing modified files stay as they are). Every run under
`tools/guard.sh`.
- **Server, the take-2 request table** (§2 of take 2): startup and scan
per scope config and cache state (cold / warm), the `didOpen` widen at
the default scope, `codeAction` at the five cursors of §6a (now the
lazy offer *and* a `codeAction/resolve` at each), `prepareRename` /
`rename`, `completion` at the worst prefix, `definition` (index-only
path), `hover`, `inlayHint` (workspace scope and default scope, with
§37.2's ruling restated), `references`, `documentSymbol`,
`workspaceSymbol`, `semanticTokens/full`, diagnostics publish. Driven
over the wire against `target/release/lucisv-server` at 0.42.0 and,
for the rows that exist there, the 0.39.0 baseline
(`~/.cache/lucisv-baselines/` holds CLI binaries only — build the
0.39.0 server from the tag in a scratch worktree under the scratchpad,
removed after).
- **CLI sweeps** over `hw/ip`, `hw/top_earlgrey/ip`, `hw/top_darjeeling/ip`,
`hw/dv`, `hw/vendor`: `format --check` (cold cache and warm), `check`
(all rules on; default rules), wall time and peak RSS (`/usr/bin/time
-l`), 0.42.0 vs 0.39.0 vs 0.41.0; the failure counts per tree and the
list of files whose outcome changed since 0.39.0 (expected: exactly
jtag_if.sv and SimDTM.sv from §38).
- **Method** as take 2 §9: three tries per row, first try and repeat
range both reported, machine state noted; no server-side
instrumentation added.
- Findings: any row slower than take 2 by more than noise is a filed
item with a reproduction; anything faster is credited to the section
that did it.
- [ ] server table re-measured, 0.42.0 vs take 2 vs 0.39.0
- [ ] CLI sweeps, three binaries, RSS included
- [ ] `docs/performance_take3.md` + perf README entry
- [ ] opentitan status unchanged after every run
## 41. Repository-analysis fix 1 (planned 2026-09-04) — same-target atomic writers (topo §2.9-26)
From `docs/repository-analysis.md` finding 1 and topo handshake 26. One
lane after §39 merges, §36's protocol. Feature README:
`docs/features/atomic-write-coordination/README.md`. Ships in 0.43.0 with
§42 and §43.
The audit's probe: two threads writing 1 MiB each through `write_atomic` to
one target collided on the temp name (canonical target + pid — the *same*
process, so the same name) — 100 write errors in 200 calls, no mixed bytes.
Two ways in: the CLI's `dedup` (`lucisv/src/main.rs`) folds `.`/`..` but
leaves symlinks unresolved, so two spellings of one file reach two rayon
workers; and any two threads in one process writing one path.
- **Exclusive, unique temp files.** `atomic::temp_path` gains a per-process
counter (`AtomicU64`) beside the pid: `.{name}.{pid}.{n}.lucisv-tmp`; the
temp is opened with `OpenOptions::new().write(true).create_new(true)`
(O_EXCL) so a collision is an `AlreadyExists` error that retries with the
next counter value, never a shared file. The temp's mode is set before
the bytes are written (a 0600 target must not spend a moment world-
readable).
- **Dedup by target identity.** `dedup` keys on the canonical path when the
file exists (`fs::canonicalize`), falling back to today's lexical key
when it does not; the *reported* path stays the user's spelling (the
first seen). That closes the symlink alias without changing any output.
- **Last-writer semantics stated.** Two processes writing one target still
race (rename is atomic, the later rename wins); both write formatted
bytes of the same input, and the formatter is idempotent, so the result
is whole and correct either way. Say so in the README and the atomic.rs
module doc; do not build a lock.
- Tests: the audit's probe as a real test (two barrier-started threads ×
100 rounds, 1 MiB each, **0 write errors**, final bytes always one
writer's whole buffer); a symlink alias through the real CLI (`lucisv
format dir/` where `dir/b.sv -> a.sv`: one write, one report line);
`dedup` with a symlink and with a missing file; the counter's
uniqueness; the 0600 window (the temp is never readable by others —
assert its mode right after creation in the test's own thread).
- [ ] 41.1 exclusive unique temps, mode before bytes
- [ ] 41.2 dedup by canonical identity, reported path unchanged
- [ ] docs: feature README; topo §2.9-26 struck (lead); analysis finding
1 annotated "fixed by §41" (lead)
- [ ] Gates (guarded): fmt/clippy/workspace tests; corpus unchanged;
byte-identity vs 0.42.0
- [ ] QA: the probe re-run under the guard at 4 threads; alias attacks
through the CLI (relative/absolute/`..` spellings + symlink); a
target that is itself a symlink into another directory; RSS of the
100-round probe
## 42. Repository-analysis fix 2 (planned 2026-09-04) — one lint-configuration contract for project and editor (topo §2.9-28)
Finding 2 / handshake 28. One lane after §41. Feature README:
`docs/features/lint-config-contract/README.md`. Ships in 0.43.0.
**Contract (lead's ruling), which is the CLI's today applied to the
editor:** the editor's settings play the role the CLI's flags play.
`lucisv/src/lint.rs` already does `pick(--select, toml select)` — the flag
when given, else the project file. The server does the same, key by key:
- rung 2 of `enabled_rules`'s ladder becomes: `lucisv.lint.select` when
non-empty, else `[lint] select` from the buffer's `lucisv.toml`, else
the base set;
- rung 5: `lucisv.lint.ignore` when non-empty, else `[lint] ignore`;
- rungs 3 and 4 (class switches, per-rule tri-states) are editor-only and
unchanged — the project file has no such keys;
- rule options: unchanged (project options, editor overlay key by key).
- **Rejected project rule options are surfaced**, not dropped: a
`[lint.<rule>]` entry `set_raw` refuses — and, from §39's QA, a bad
directive line in a file named by `[lint] waivers`, which the server
today drops silently where the editor-setting path logs it — is logged
once per
(config file, entry) through `notification.rs` as
`<toml>:<line>: <message>`, exactly the wording `lucisv check` prints
before failing the run. The server keeps linting with the entry
dropped (an editor cannot "fail the run"); say so.
- `enabled_rules` therefore takes the project's selection as an argument
(a small struct `ProjectLint { select, ignore }` read by `configured`
from the discovered file) — no second discovery, one read per buffer
per settings generation, cached the way `configured` already caches or
not at all if it does not (measure: it must not add a file read per
diagnostic pass — the `Discovery` result is already computed there).
- Docs: the README/site sentence the audit wrote ("project selection
controls CLI runs; editor selection requires `lucisv.lint.*`") becomes
the new contract in both places (lead applies to README/site at merge;
the dev writes the text in the feature README).
- Tests: unit — every combination of {toml select, editor select} ×
{toml ignore, editor ignore} against the ladder; severity words in the
toml's lists; a rejected project option logged once and the lint still
running; wire-level e2e — a workspace with `[lint] select = ["no-tabs"]`
and no editor settings publishes only `no-tabs` diagnostics; adding
`lucisv.lint.select` over the wire replaces it; `didChangeConfiguration`
back to empty restores the project's; the CLI's and the server's rule
lists for the same buffer are asserted **equal** for three configs.
- [ ] 42.1 project selection into the ladder, editor-when-set-else-project
- [ ] 42.2 rejected project options logged with file:line
- [ ] docs + tests above; topo §2.9-28 struck (lead); finding 2 annotated
- [ ] Gates (guarded); e2e green
- [ ] QA: the four-way matrix over the wire; the CLI/server equality on
an opentitan IP (read-only) with its real `lucisv.toml` if one
exists, else a scratch one
## 43. Repository-analysis fix 3 (planned 2026-09-04) — a cycle policy for the walker (topo §2.9-8), and the net-delay comment slot (§2.9-27)
Finding 3 / handshakes 8 and 27. One lane after §42. Feature README:
`docs/features/walk-cycles/README.md`. Ships in 0.43.0.
### 43.1 Walker cycle policy
`lucisv_core/src/walk.rs` recurses on `Path::is_dir()` with no visited set;
a symlink cycle (`a/loop -> ..`) runs until the OS refuses. Policy (lead's
ruling): **each directory is entered once by identity**, and a symlink to a
directory already on the current path is skipped silently. Identity is
`(dev, ino)` from `fs::metadata` on unix and the canonical path elsewhere.
A symlinked directory that is *not* an ancestor is still followed once
(today's behaviour for `rtl -> ../shared/rtl` stays). No traversal budget:
identity is the policy, and a budget would be a second, weaker rule.
- `Walker` gains `visited: HashSet<Identity>`; `dir()` checks-and-inserts
before reading. The same file reached twice through two symlinked
directories is reported once (the first spelling), which also removes
the dedup case §41.2 would otherwise catch late.
- Tests: `a/loop -> a` terminates and yields `a`'s files once; `a/up -> ..`
from a nested start; two symlinked dirs to one target yield its files
once; a symlink to a *sibling* directory is still followed; a dangling
symlink is skipped; the gitignore interplay is unchanged (a cycle inside
an ignored dir never runs). Both front ends: the CLI walks it, the
server's index scan (`lucisv_server` uses the same walk — confirm with
grep) opens a cyclic workspace and finishes.
### 43.2 Comment before a net delay's `#`
`wire /* c */ #5 w;` and `wire [7:0] /* c */ #5 w;` are refused by the
verifier because `NetDelay` has no comment slot. Add `before_hash:
Vec<Comment>` on `NetDelay` (parser takes the gap before `#` the way other
slots do — see `docs/features/comment-slots/README.md` for the house
mechanism and its gap fuzzer), the formatter prints it inline before `#`,
the `#SKIP` in `net_delay_position.cases` goes live, the gap fuzzer covers
the new slot.
- [ ] 43.1 visited-by-identity walker, both front ends, tests
- [ ] 43.2 `NetDelay::before_hash`, the `#SKIP` retired
- [ ] docs; topo §2.9-8 and §2.9-27 struck (lead); finding 3 annotated
- [ ] Gates (guarded): fmt/clippy/workspace tests; corpus unchanged;
byte-identity vs 0.42.0; a cyclic scratch tree through both binaries
- [ ] QA: cycles of depth 1–3 through the CLI and the server (guarded,
time-limited); the comment slot attacked with every comment shape
and position; the gap fuzzer re-run
## Loop order (2026-09-04, owner: "follow the repository analysis")
§39 (in flight) → 0.42.0 → §41 → §42 → §43 → 0.43.0 → §40 performance
take 3 on opentitan. The audit's own doc edits (README, topo, site) are
committed by the lead as one "docs: repository analysis" commit once that
process is finished, before §41 starts.
+55 -2
View File
@@ -71,6 +71,12 @@ pub struct Options {
pub select: Vec<String>,
/// `check` only: rules to drop from whatever `--select` left.
pub ignore: Vec<String>,
/// `check` only: external waiver files, relative to the current
/// directory. They *add* to whatever `[lint] waivers` in a `lucisv.toml`
/// names — a waiver file suppresses findings and can only ever suppress
/// fewer of them by being left out, so there is nothing here for a
/// command line flag to override.
pub waiver_files: Vec<String>,
/// `check` only: print the generated rule reference and exit, reading no
/// file at all.
pub rules_doc: bool,
@@ -203,6 +209,9 @@ CHECK OPTIONS (`lucisv check` only):
--fix apply safe fixes and write the files back
--unsafe-fixes let --fix apply unsafe fixes too (no rule ships
one yet, so today this changes nothing)
--waiver-file <PATH> read waiver directives from this file; may be
repeated, and adds to whatever `[lint] waivers`
in a lucisv.toml already names
--rules-doc print the rule reference — every rule, what it
reports and whether it has a fix — as Markdown on
stdout and exit 0. Generated from the registry, so
@@ -215,6 +224,31 @@ CHECK OPTIONS (`lucisv check` only):
accepted in place of `lucisv:`. A waiver that suppresses nothing is
reported under the `unused-waiver` rule.
WAIVER FILES:
Findings can also be suppressed from outside the RTL, in Verible's waiver
file format — one directive per line, `#` comments and blank lines ignored:
waive --rule=<rule> every line of every file
waive --rule=<rule> --line=12 one line
waive --rule=<rule> --line=12-20 a range, both ends included
waive --rule=<rule> --location=legacy.sv the files that pattern names
`--rule` is required and names one rule (a severity word is not accepted);
`--line` is 1-based and a range includes both ends; `--location` is matched
the way an `--exclude` pattern is — `*` within one path component, a
pattern with `/` against a path suffix and one without against the file
name. Unlike Verible's, it is **not** a regular expression, and a pattern
that looks like one is an error rather than a silent mismatch.
lucisv reads `--waiver-file <PATH>` (relative to the current directory) and
every path in `waivers` under `[lint]` in a `lucisv.toml` (relative to that
file). An external waiver and an inline one are a union: a finding either
covers is suppressed, and neither is then reported as dead. A file that
does not exist, or a directive that does not parse, fails the run with
`<file>:<line>: message` and exit 2. An external waiver that suppressed
nothing anywhere in the run is reported under `unused-waiver`, at the line
of the waiver file it was written on.
IGNORE FILES:
While walking a directory, lucisv reads a `.gitignore` in every directory it
enters and skips what it names; a deeper file overrides a shallower one and
@@ -250,8 +284,11 @@ CONFIGURATION:
read by lucisv-server only — the CLI reads a filelist only when `-f` names
one, so `lucisv rtl/` always means the directory it was given). One table
is recognized, `[lint]`, with `select` and `ignore` (arrays of rule names,
`--select`/`--ignore` semantics). A command line flag overrides the file's
corresponding key; the other keys still apply.
`--select`/`--ignore` semantics) and `waivers` (an array of waiver file
paths, resolved against the config file's own directory). A command line
flag overrides the file's corresponding key; the other keys still apply —
`--waiver-file` is the exception, and adds to `waivers` rather than
replacing it.
RANGE FORMATTING:
`--lines` formats one construct at a time: an item whose lines meet a range
@@ -298,6 +335,7 @@ fn parse_from(args: impl Iterator<Item = String>) -> Result<Options, String> {
unsafe_fixes: false,
select: Vec::new(),
ignore: Vec::new(),
waiver_files: Vec::new(),
rules_doc: false,
inputs: Vec::new(),
filelists: Vec::new(),
@@ -378,6 +416,10 @@ fn parse_from(args: impl Iterator<Item = String>) -> Result<Options, String> {
let v = args.next().ok_or("--ignore requires a value")?;
opts.ignore.extend(split_rules(&v));
}
"--waiver-file" => {
let v = args.next().ok_or("--waiver-file requires a value")?;
opts.waiver_files.push(v);
}
"--rules-doc" => opts.rules_doc = true,
"-h" | "--help" => {
print_help();
@@ -444,6 +486,7 @@ fn check_flag_scopes(opts: &Options) -> Result<(), String> {
(opts.output_format != OutputFormat::Text, "--output-format"),
(!opts.select.is_empty(), "--select"),
(!opts.ignore.is_empty(), "--ignore"),
(!opts.waiver_files.is_empty(), "--waiver-file"),
(opts.rules_doc, "--rules-doc"),
];
let format_only = [
@@ -614,6 +657,16 @@ mod tests {
assert!(parse(&["--no-gitignore", "rtl"]).unwrap().no_gitignore);
}
#[test]
fn waiver_files_are_collected_in_order_and_are_lint_only() {
let opts = parse(&["check", "--waiver-file", "a.waiver", "--waiver-file", "b", "rtl"])
.expect("parsed");
assert_eq!(opts.waiver_files, vec!["a.waiver", "b"]);
assert!(parse(&["check", "rtl"]).unwrap().waiver_files.is_empty());
assert!(parse(&["check", "--waiver-file"]).is_err(), "a value is required");
assert!(parse(&["--waiver-file", "a.waiver", "rtl"]).is_err(), "not a formatter flag");
}
#[test]
fn rules_doc_is_the_one_check_that_needs_no_input() {
assert!(parse(&["check", "--rules-doc"]).unwrap().rules_doc);
+163 -40
View File
@@ -16,7 +16,8 @@ use vlog_formatter::fence::{self, Region};
use vlog_formatter::Config;
use vlog_linter::words;
use vlog_linter::{
apply_fixes, lint, Fix, MentionOracle, ParsedSource, Rule, RuleOptions, Violation,
apply_fixes, lint_with, ExternalWaivers, Fix, MentionOracle, ParsedSource, Rule, RuleOptions,
Violation, WaiverUse,
};
use vlog_parser::LineIndex;
@@ -46,6 +47,15 @@ pub struct Plan {
/// The project's identifier census, built when at least one selected rule
/// asks for a workspace and there is more than one file to ask about.
census: Option<Census>,
/// Every external waiver file the run reads, applied to every job.
///
/// One set for the whole run rather than one per file, because a
/// `--location` pattern names files and a waiver is only *unused* when no
/// file in the run matched it — a question only the whole run can answer.
external: ExternalWaivers,
/// Every rule name any job in the run has switched on, for deciding which
/// external waivers never had a chance to fire.
enabled: Vec<&'static str>,
}
/// How many of the run's files write each identifier down.
@@ -163,6 +173,7 @@ impl MentionOracle for Elsewhere<'_> {
/// already says about itself.
pub fn plan(opts: &Options, gathered: Vec<(PathBuf, Config, FileConfig)>) -> Result<Plan, String> {
let workspace = gathered.len() > 1;
let external = external_waivers(opts, gathered.iter().map(|(_, _, file)| file))?;
let mut jobs = Vec::with_capacity(gathered.len());
for (path, config, file_config) in gathered {
let select = pick(&opts.select, file_config.lint_select.as_deref());
@@ -175,7 +186,56 @@ pub fn plan(opts: &Options, gathered: Vec<(PathBuf, Config, FileConfig)>) -> Res
let wanted = jobs.iter().any(|job| job.rules.iter().any(|rule| rule.needs_workspace()));
let interfaces = jobs.iter().any(|job| job.rules.iter().any(|rule| reads_interfaces(*rule)));
let census = (workspace && wanted).then(|| Census::of(&jobs, workspace && interfaces));
Ok(Plan { jobs, census })
let mut enabled: Vec<&'static str> =
jobs.iter().flat_map(|job| job.rules.iter().map(|rule| rule.name())).collect();
enabled.sort_unstable();
enabled.dedup();
Ok(Plan { jobs, census, external, enabled })
}
/// The run's external waiver files, read once each: `--waiver-file` in flag
/// order, then every `[lint] waivers` entry of a config file governing an
/// input.
///
/// The two **add up** rather than override: a waiver file only ever suppresses
/// findings, so there is nothing for a command line to take back. A file named
/// twice over — the flag and a `lucisv.toml`, or one `lucisv.toml` governing
/// five hundred files — is read once, or its directives would each be reported
/// unused as many times as the file was read.
///
/// A file that cannot be read, or a directive that does not parse, fails the
/// run naming the file and the line, exactly as a bad `[lint.<rule>]` entry
/// does and for the same reason: a user wrote it and is watching.
pub fn external_waivers<'a>(
opts: &Options,
configs: impl Iterator<Item = &'a FileConfig>,
) -> Result<ExternalWaivers, String> {
let mut paths: Vec<PathBuf> = opts.waiver_files.iter().map(PathBuf::from).collect();
for config in configs {
for path in config.lint_waivers.iter().flatten() {
paths.push(path.clone());
}
}
let mut read: Vec<PathBuf> = Vec::new();
let mut waivers = ExternalWaivers::default();
for path in paths {
// Compared canonically, because the flag's path is relative to the
// working directory and a `lucisv.toml`'s is absolute: the same file
// named both ways is still one file, and reading it twice would report
// each of its dead directives twice. Only the *comparison* is
// canonical — the path a diagnostic names stays the one written.
let key = std::fs::canonicalize(&path).unwrap_or_else(|_| path.clone());
if read.contains(&key) {
continue;
}
let (file, problems) = ExternalWaivers::read(&path)?;
if let Some(problem) = problems.first() {
return Err(problem.clone());
}
waivers.absorb(file);
read.push(key);
}
Ok(waivers)
}
/// The `[lint.<rule>]` entries of one file's config, resolved against the
@@ -234,12 +294,30 @@ struct Report {
violations: Vec<Violation>,
/// Violations whose fix was applied and written back.
fixed: usize,
/// Which of the run's external waivers suppressed something in this file.
/// Merged across every file before the dead ones are reported.
used: WaiverUse,
/// Set when the file could not be fully checked: unreadable, unwritable,
/// or — because the lexer is all-or-nothing — unlexable, in which case
/// only the text-level rules saw it.
error: Option<String>,
}
/// Everything one file's lint pass reads besides the file itself.
///
/// One value rather than six parameters: every function below the driver
/// needs the same set, and the `--fix` loop passes it down another level
/// again.
struct Pass<'a> {
config: &'a Config,
rules: &'a [&'static dyn Rule],
options: &'a RuleOptions,
census: Option<&'a Census>,
/// The run's external waiver files. Empty unless `--waiver-file` or a
/// `[lint] waivers` named one, and then costing nothing.
external: &'a ExternalWaivers,
}
/// Lints every gathered file and reports. Exit 1 if anything is left over,
/// 2 if a file could not be read, written, or lexed.
pub fn check_files(opts: &Options, plan: &Plan) -> ExitCode {
@@ -247,9 +325,20 @@ pub fn check_files(opts: &Options, plan: &Plan) -> ExitCode {
.jobs
.par_iter()
.map(|job| {
check_one(&job.path, &job.config, opts, &job.rules, &job.options, plan.census.as_ref())
let pass = Pass {
config: &job.config,
rules: &job.rules,
options: &job.options,
census: plan.census.as_ref(),
external: &plan.external,
};
check_one(&job.path, opts, &pass)
})
.collect();
// The dead external waivers are found once every file has been linted,
// and reported against the waiver file, which then sorts in among the
// sources like any other path.
reports.extend(dead_waivers(&plan.external, &reports, &plan.enabled));
// Diagnostics are printed sorted by path, then by position within the
// file (`lint` already sorts those), so a run over a directory reads
// top to bottom whatever order the walk or the worker pool produced.
@@ -257,6 +346,37 @@ pub fn check_files(opts: &Options, plan: &Plan) -> ExitCode {
finish(opts, reports)
}
/// The `unused-waiver` reports for external waivers no file in the run used.
///
/// **After the whole run**, which is the whole reason this is the CLI's job
/// and not the linter's: a `--location` pattern may match a file the run has
/// not reached yet, so a waiver is only dead once every file has been asked.
fn dead_waivers(
external: &ExternalWaivers,
reports: &[Report],
enabled: &[&'static str],
) -> Vec<Report> {
if external.is_empty() {
return Vec::new();
}
let mut used = WaiverUse::default();
for report in reports {
used.merge(&report.used);
}
external
.unused(&used, enabled)
.into_iter()
.map(|dead| Report {
path: dead.path.display().to_string(),
index: LineIndex::new(&dead.text),
violations: dead.violations,
fixed: 0,
used: WaiverUse::default(),
error: None,
})
.collect()
}
/// Lints a buffer piped in on stdin. `--stdin-filename` names it, and is
/// what the rules that need a file name see.
pub fn check_stdin(
@@ -265,32 +385,34 @@ pub fn check_stdin(
config: &Config,
rules: &[&'static dyn Rule],
options: &RuleOptions,
external: &ExternalWaivers,
) -> ExitCode {
let name = opts.stdin_filename.clone().unwrap_or_else(|| "<stdin>".to_string());
let path = opts.stdin_filename.as_ref().map(PathBuf::from);
let (violations, lex_error) = run_rules(src, path, config, rules, options, None);
let pass = Pass { config, rules, options, census: None, external };
let (violations, used, lex_error) = run_rules(src, path, &pass);
// Nothing is ever written back for stdin, so `--fix` has nothing to do
// here; the violations are reported as they are.
let error = lex_error.map(|e| format!("{name}: {e}"));
let report = Report { path: name, index: LineIndex::new(src), violations, fixed: 0, error };
finish(opts, vec![report])
let report =
Report { path: name, index: LineIndex::new(src), violations, fixed: 0, used, error };
// One buffer is a whole run too, so a waiver that covered nothing in it is
// as dead as one that covered nothing in a directory.
let names: Vec<&'static str> = rules.iter().map(|rule| rule.name()).collect();
let mut reports = vec![report];
reports.extend(dead_waivers(external, &reports, &names));
finish(opts, reports)
}
/// Lints one file, optionally fixing it, and never panics out of its worker.
fn check_one(
file: &Path,
config: &Config,
opts: &Options,
rules: &[&'static dyn Rule],
options: &RuleOptions,
census: Option<&Census>,
) -> Report {
fn check_one(file: &Path, opts: &Options, pass: &Pass) -> Report {
let path = file.display().to_string();
let failed = |error: String| Report {
path: path.clone(),
index: LineIndex::new(""),
violations: Vec::new(),
fixed: 0,
used: WaiverUse::default(),
error: Some(error),
};
@@ -300,14 +422,13 @@ fn check_one(
};
let outcome = crate::catch_panic(|| {
if opts.fix {
fix_source(&src, file, config, opts, rules, options, census)
fix_source(&src, file, opts, pass)
} else {
let (violations, lex_error) =
run_rules(&src, Some(file.to_path_buf()), config, rules, options, census);
(violations, None, 0, lex_error)
let (violations, used, lex_error) = run_rules(&src, Some(file.to_path_buf()), pass);
(violations, used, None, 0, lex_error)
}
});
let (violations, rewritten, fixed, lex_error) = match outcome {
let (violations, used, rewritten, fixed, lex_error) = match outcome {
Ok(outcome) => outcome,
Err(msg) => return failed(format!("{path}: panicked while linting: {msg}")),
};
@@ -322,21 +443,20 @@ fn check_one(
// so the file must not pass as checked. It is an error (exit 2), exactly
// as `lucisv format` treats the same file.
let error = lex_error.map(|e| format!("{path}: {e}"));
Report { path, index, violations, fixed, error }
Report { path, index, violations, fixed, used, error }
}
/// Runs the rules over one text. The second half of the answer is the lex
/// error when the text does not lex — rendered `line:col: message`, ready
/// for a path prefix — because a file with no tokens was only text-linted
/// and must be reported as an error, not passed off as clean.
/// Runs the rules over one text, reporting which external waivers fired. The
/// last part of the answer is the lex error when the text does not lex —
/// rendered `line:col: message`, ready for a path prefix — because a file with
/// no tokens was only text-linted and must be reported as an error, not passed
/// off as clean.
fn run_rules(
src: &str,
path: Option<PathBuf>,
config: &Config,
rules: &[&'static dyn Rule],
options: &RuleOptions,
census: Option<&Census>,
) -> (Vec<Violation>, Option<String>) {
pass: &Pass,
) -> (Vec<Violation>, WaiverUse, Option<String>) {
let Pass { config, rules, options, census, external } = *pass;
// One parse per file (TODO §4): the products are built here, once, and
// lent to the context. Under `--fix` each *round* re-enters through this
// function with rewritten text — that re-parse is inherent (the old
@@ -360,7 +480,8 @@ fn run_rules(
Some(elsewhere) => ctx.with_oracle(elsewhere),
None => ctx,
};
(lint(&ctx, rules), lex_error)
let (violations, used) = lint_with(&ctx, rules, external);
(violations, used, lex_error)
}
/// The violations whose fix may be applied: everything except a fix that
@@ -399,16 +520,15 @@ fn touches_fence(fix: &Fix, regions: &[Region]) -> bool {
fn fix_source(
src: &str,
file: &Path,
config: &Config,
opts: &Options,
rules: &[&'static dyn Rule],
options: &RuleOptions,
census: Option<&Census>,
) -> (Vec<Violation>, Option<String>, usize, Option<String>) {
pass: &Pass,
) -> (Vec<Violation>, WaiverUse, Option<String>, usize, Option<String>) {
let mut text = src.to_string();
let mut fixed = 0;
let (mut violations, mut lex_error) =
run_rules(&text, Some(file.to_path_buf()), config, rules, options, census);
let mut used = WaiverUse::default();
let (mut violations, mut round_used, mut lex_error) =
run_rules(&text, Some(file.to_path_buf()), pass);
used.merge(&round_used);
for _ in 0..MAX_FIX_ROUNDS {
let round =
apply_fixes(&text, &fixable_outside_fences(&text, &violations), opts.unsafe_fixes);
@@ -417,11 +537,14 @@ fn fix_source(
}
fixed += round.applied;
text = round.output;
(violations, lex_error) =
run_rules(&text, Some(file.to_path_buf()), config, rules, options, census);
(violations, round_used, lex_error) = run_rules(&text, Some(file.to_path_buf()), pass);
// A waiver that covered a finding in an earlier round did its job even
// though the fix then removed the finding, so usage accumulates over
// the rounds rather than being the last round's.
used.merge(&round_used);
}
let rewritten = (text != src).then_some(text);
(violations, rewritten, fixed, lex_error)
(violations, used, rewritten, fixed, lex_error)
}
/// Prints the run and turns it into an exit code.
+11 -1
View File
@@ -128,7 +128,17 @@ fn run_check(opts: &Options) -> ExitCode {
return ExitCode::from(2);
}
};
return lint::check_stdin(opts, &src, &config, &rules, &options);
// A stdin buffer has one config file too — the one governing
// `--stdin-filename`, or the working directory's — so `[lint] waivers`
// reaches it exactly as `[lint] select` does.
let external = match lint::external_waivers(opts, std::iter::once(&file_config)) {
Ok(external) => external,
Err(e) => {
eprintln!("error: {e}");
return ExitCode::from(2);
}
};
return lint::check_stdin(opts, &src, &config, &rules, &options, &external);
}
let jobs = match gather(opts).and_then(|jobs| build_pool(opts).map(|()| jobs)) {
Ok(jobs) => jobs,
+83
View File
@@ -935,6 +935,89 @@ fn check_honors_inline_waivers_and_reports_dead_ones() {
assert!(stdout(&out).contains("[unused-waiver]"), "{}", stdout(&out));
}
/// Two tabbed lines, one of which a waiver file's `--line` covers.
const TABBED: &str = "module foo;\n\twire a;\n\twire b;\nendmodule\n";
/// `--waiver-file`: the suppression, the flag repeated, and the dead directive
/// reported at the waiver file's own line. TODO §39.
#[test]
fn check_reads_external_waiver_files() {
let dir = TempDir::new("check-waiver-file");
let path = dir.write("foo.sv", TABBED);
let one = dir.write("one.waiver", "# just line 2\nwaive --rule=no-tabs --line=2\n");
let out = run(&["check", "--waiver-file", &one, &path]);
assert_eq!(code(&out), 1, "{}", stdout(&out));
assert_eq!(stdout(&out).lines().count(), 1, "one tab left: {}", stdout(&out));
assert!(stdout(&out).contains("foo.sv:3:1"), "{}", stdout(&out));
// A second file adds to the first rather than replacing it, and both are
// then used, so neither is reported.
let two = dir.write("two.waiver", "waive --rule=no-tabs --line=3 --location=foo.sv\n");
let out = run(&["check", "--waiver-file", &one, "--waiver-file", &two, &path]);
assert_eq!(code(&out), 0, "{}", stdout(&out));
// A directive that covered nothing is reported against the waiver file.
let dead = dir.write("dead.waiver", "waive --rule=no-tabs --location=elsewhere.sv\n");
let out = run(&["check", "--waiver-file", &dead, &path]);
assert_eq!(code(&out), 1);
let text = stdout(&out);
assert!(text.contains("dead.waiver:1:1: style: unused waiver for `no-tabs`"), "{text}");
assert!(text.contains("[unused-waiver]"), "{text}");
}
/// The `[lint] waivers` key, and that `--waiver-file` adds to it. TODO §39.
#[test]
fn check_reads_the_waiver_files_a_config_file_names() {
let dir = TempDir::new("check-waiver-toml");
let path = dir.write("rtl/foo.sv", TABBED);
dir.write("lucisv.toml", "[lint]\nwaivers = [ \"project.waiver\" ]\n");
dir.write("project.waiver", "waive --rule=no-tabs --line=2\n");
// Relative to the config file, not to the working directory.
let out = run_raw(&["check", "--no-cache", &path]);
assert_eq!(code(&out), 1, "{}", stdout(&out));
assert!(stdout(&out).contains("foo.sv:3:1"), "only line 3 survives: {}", stdout(&out));
let extra = dir.write("extra.waiver", "waive --rule=no-tabs --line=3\n");
let out = run_raw(&["check", "--no-cache", "--waiver-file", &extra, &path]);
assert_eq!(code(&out), 0, "the two lists add up: {}", stdout(&out));
// `--no-config` drops the config file's list with everything else in it.
let out = run_raw(&["check", "--no-cache", "--no-config", &path]);
assert_eq!(code(&out), 1);
assert_eq!(stdout(&out).lines().count(), 2, "both tabs are back: {}", stdout(&out));
}
/// A waiver file that cannot be read, or that has a line that does not parse,
/// fails the run with `<file>:<line>: message` and exit 2. TODO §39.
#[test]
fn a_broken_waiver_file_fails_the_run() {
let dir = TempDir::new("check-waiver-bad");
let path = dir.write("foo.sv", TABBED);
let out = run(&["check", "--waiver-file", &dir.write("x.waiver", "hush\n"), &path]);
assert_eq!(code(&out), 2, "{}", stderr(&out));
assert!(stderr(&out).contains("x.waiver:1: expected a `waive` directive"), "{}", stderr(&out));
let bad = dir.write("y.waiver", "# fine\nwaive --rule=no-such-rule\n");
let out = run(&["check", "--waiver-file", &bad, &path]);
assert_eq!(code(&out), 2);
assert!(stderr(&out).contains("y.waiver:2: unknown rule"), "{}", stderr(&out));
let regexy = dir.write("z.waiver", "waive --rule=no-tabs --location=.*foo.sv\n");
let out = run(&["check", "--waiver-file", &regexy, &path]);
assert_eq!(code(&out), 2);
assert!(stderr(&out).contains("looks like a regular expression"), "{}", stderr(&out));
let out = run(&[
"check",
"--waiver-file",
&dir.path.join("gone.waiver").display().to_string(),
&path,
]);
assert_eq!(code(&out), 2);
assert!(stderr(&out).contains("gone.waiver:"), "{}", stderr(&out));
}
#[test]
fn check_reads_stdin_and_names_it() {
let out = run_with_stdin(&["check", "--stdin-filename", "rtl/z.sv", "-"], LINTY);
+58 -6
View File
@@ -37,6 +37,15 @@ pub struct FileConfig {
pub lint_select: Option<Vec<String>>,
/// `[lint] ignore`: rules dropped from whatever `select` left.
pub lint_ignore: Option<Vec<String>>,
/// `[lint] waivers`: external waiver files, in the order written.
///
/// Like [`FileConfig::filelist`], these name *other files*: [`parse`]
/// records them exactly as written and [`Discovery`] resolves each one
/// against the config file's own directory, so every `FileConfig` a
/// `Discovery` hands out carries usable paths. Nothing here reads them —
/// their contents name lint rules, and this crate does not know the rule
/// registry any more than it does for `select`.
pub lint_waivers: Option<Vec<PathBuf>>,
/// `[lint.<rule>]` tables, **as written**: one entry per key, in file
/// order.
///
@@ -93,7 +102,7 @@ pub fn parse(text: &str) -> Result<FileConfig, String> {
enum Table {
/// Before any header: the formatter's own keys.
Top,
/// `[lint]`: `select` and `ignore`.
/// `[lint]`: `select`, `ignore` and `waivers`.
Lint,
/// `[lint.<rule>]`: that rule's options.
Rule(String),
@@ -106,7 +115,7 @@ fn parse_entry(
number: usize,
) -> Result<(), String> {
if line.starts_with('[') {
// `[lint]` carries `select`/`ignore`; `[lint.<rule>]` carries that
// `[lint]` carries `select`/`ignore`/`waivers`; `[lint.<rule>]` carries that
// rule's options, which are stored raw and checked by whoever knows
// the registry.
if line == "[lint]" {
@@ -155,19 +164,28 @@ fn parse_entry(
}
_ => Err(format!(
"unknown key `{key}` (known keys: line-length, indent, exclude, filelist; \
select, ignore under `[lint]`; and a rule's own options under \
`[lint.<rule-name>]`)"
select, ignore, waivers under `[lint]`; and a rule's own options \
under `[lint.<rule-name>]`)"
)),
}
}
/// One key of the `[lint]` table.
fn parse_lint_entry(key: &str, value: &str, config: &mut FileConfig) -> Result<(), String> {
if key == "waivers" {
if config.lint_waivers.is_some() {
return Err(format!("duplicate key `{key}`"));
}
config.lint_waivers = Some(parse_array(value)?.into_iter().map(PathBuf::from).collect());
return Ok(());
}
let slot = match key {
"select" => &mut config.lint_select,
"ignore" => &mut config.lint_ignore,
_ => {
return Err(format!("unknown key `{key}` under `[lint]` (known keys: select, ignore)"))
return Err(format!(
"unknown key `{key}` under `[lint]` (known keys: select, ignore, waivers)"
))
}
};
if slot.is_some() {
@@ -359,10 +377,16 @@ fn load(path: &Path) -> Result<FileConfig, String> {
// `filelist` is the one value that names another file, so it is resolved
// here — against the config file's own directory, which `parse` cannot
// know. An absolute path is left alone (`join` already does that).
let dir = path.parent().unwrap_or(Path::new(".")).to_path_buf();
if let Some(filelist) = config.filelist.take() {
let dir = path.parent().unwrap_or(Path::new("."));
config.filelist = Some(dir.join(filelist));
}
// `[lint] waivers` names other files the same way, and is resolved the
// same way: against the config file's directory, an absolute path left
// alone by `join`.
if let Some(waivers) = config.lint_waivers.take() {
config.lint_waivers = Some(waivers.into_iter().map(|file| dir.join(file)).collect());
}
// So an error about a `[lint.<rule>]` entry can name the file to edit.
config.source = Some(path.to_path_buf());
Ok(config)
@@ -428,6 +452,34 @@ exclude = [ \"build\", \"*_gen.sv\", ]
);
}
/// `[lint] waivers` names other files, so it resolves the way `filelist`
/// does: against the config file's own directory, absolute paths left
/// alone. See `docs/features/waiver-files/README.md`.
#[test]
fn lint_waivers_are_a_list_resolved_against_the_config_files_directory() {
assert_eq!(
ok("[lint]\nwaivers = [ \"a.waiver\", \"deep/b.waiver\" ]").lint_waivers,
Some(vec![PathBuf::from("a.waiver"), PathBuf::from("deep/b.waiver")])
);
assert_eq!(
ok("[lint]\nselect = [\"no-tabs\"]").lint_waivers,
None,
"absent unless written"
);
assert!(err("[lint]\nwaivers = \"a.waiver\"").contains("multi-line arrays"));
assert!(err("[lint]\nwaivers = []\nwaivers = []").contains("duplicate key `waivers`"));
assert!(err("[lint]\nwaiver = []").contains("unknown key `waiver` under `[lint]`"));
let tree = TempTree::new();
tree.write("lucisv.toml", "[lint]\nwaivers = [ \"rtl/a.waiver\", \"/opt/b.waiver\" ]\n");
let deep = tree.write("a/b/x.sv", "");
let found = Discovery::new(true).for_file(&deep).unwrap();
assert_eq!(
found.lint_waivers,
Some(vec![tree.path.join("rtl/a.waiver"), PathBuf::from("/opt/b.waiver")])
);
}
#[test]
fn an_empty_file_sets_nothing() {
assert_eq!(ok(""), FileConfig::default());
+72 -9
View File
@@ -14,6 +14,7 @@ use lsp_types::{
use vlog_linter::{apply_fixes, rule_by_name, Applicability, Violation};
use crate::convert::Positions;
use crate::lint::LintRun;
use crate::state::Document;
/// The kind of the fix-everything action, namespaced under `source.fixAll` so
@@ -27,6 +28,7 @@ pub const FIX_ALL: &str = "source.fixAll.lucisv";
/// client, because a fix-on-save request asks for `source.fixAll.lucisv` alone
/// and computing every quick fix for it would be work nobody reads.
pub fn code_actions(
run: &LintRun,
uri: &Uri,
doc: &Document,
range: Range,
@@ -34,7 +36,7 @@ pub fn code_actions(
tab_width: usize,
) -> Vec<CodeActionOrCommand> {
let positions = doc.positions();
let violations = crate::lint::fixable(doc, tab_width);
let violations = crate::lint::fixable(run, doc, tab_width);
let mut actions = Vec::new();
if wanted(only, &CodeActionKind::QUICKFIX) {
let quick = violations.iter().filter_map(|v| quick_fix(uri, &positions, v, range));
@@ -170,7 +172,7 @@ mod tests {
fn actions_of(ws: &Workspace) -> Vec<CodeAction> {
let doc = ws.document(&uri()).expect("open");
let whole = doc.positions().whole_document();
code_actions(&uri(), doc, whole, None, 2)
code_actions(&LintRun::default(), &uri(), doc, whole, None, 2)
.into_iter()
.map(|a| match a {
CodeActionOrCommand::CodeAction(action) => action,
@@ -248,7 +250,14 @@ mod tests {
start: Position { line: 1, character: 0 },
end: Position { line: 1, character: 0 },
};
let actions = code_actions(&uri(), doc, line1, Some(&[CodeActionKind::QUICKFIX]), 2);
let actions = code_actions(
&LintRun::default(),
&uri(),
doc,
line1,
Some(&[CodeActionKind::QUICKFIX]),
2,
);
assert_eq!(actions.len(), 1, "the cursor's line only: {actions:#?}");
}
@@ -320,14 +329,32 @@ mod tests {
start: Position { line: fenced_line, character: 0 },
end: Position { line: fenced_line, character: 0 },
};
let actions = code_actions(&uri(), doc, at, Some(&[CodeActionKind::QUICKFIX]), 2);
let actions = code_actions(
&LintRun::default(),
&uri(),
doc,
at,
Some(&[CodeActionKind::QUICKFIX]),
2,
);
assert!(actions.is_empty(), "no quick fix inside a fence: {actions:#?}");
// The unfenced tab one line further down still has one.
let at = Range {
start: Position { line: 4, character: 0 },
end: Position { line: 4, character: 0 },
};
assert_eq!(code_actions(&uri(), doc, at, Some(&[CodeActionKind::QUICKFIX]), 2).len(), 1);
assert_eq!(
code_actions(
&LintRun::default(),
&uri(),
doc,
at,
Some(&[CodeActionKind::QUICKFIX]),
2
)
.len(),
1
);
}
#[test]
@@ -370,14 +397,19 @@ mod tests {
let doc = ws.document(&uri()).expect("open");
let whole = doc.positions().whole_document();
let fix_all_only = [CodeActionKind::new(FIX_ALL)];
let actions = code_actions(&uri(), doc, whole, Some(&fix_all_only), 2);
let actions = code_actions(&LintRun::default(), &uri(), doc, whole, Some(&fix_all_only), 2);
assert_eq!(actions.len(), 1, "no quick fixes when only fixAll was asked for");
// `source` is a prefix filter for `source.fixAll.lucisv`.
let source = [CodeActionKind::SOURCE];
assert_eq!(code_actions(&uri(), doc, whole, Some(&source), 2).len(), 1);
assert_eq!(
code_actions(&LintRun::default(), &uri(), doc, whole, Some(&source), 2).len(),
1
);
// And an unrelated filter selects nothing.
let refactor = [CodeActionKind::REFACTOR];
assert!(code_actions(&uri(), doc, whole, Some(&refactor), 2).is_empty());
assert!(
code_actions(&LintRun::default(), &uri(), doc, whole, Some(&refactor), 2).is_empty()
);
}
#[test]
@@ -386,7 +418,14 @@ mod tests {
let ws = workspace(text);
let doc = ws.document(&uri()).expect("open");
let whole = doc.positions().whole_document();
let actions = code_actions(&uri(), doc, whole, Some(&[CodeActionKind::QUICKFIX]), 4);
let actions = code_actions(
&LintRun::default(),
&uri(),
doc,
whole,
Some(&[CodeActionKind::QUICKFIX]),
4,
);
let CodeActionOrCommand::CodeAction(fix) = &actions[0] else { panic!("an action") };
assert_eq!(applied(text, fix), "module m;\n wire a;\nendmodule\n");
}
@@ -407,4 +446,28 @@ mod tests {
assert!(out.contains("é 🎉"), "comments are never dropped: {out:?}");
assert_eq!(out, "module m;\n // é 🎉 wire a;\nendmodule\n");
}
#[test]
fn an_externally_waived_finding_gets_no_quick_fix_and_fix_all_leaves_it() {
// §39 QA's HIGH: `fixable` used `default_rules()` and no waivers, so
// fix-on-save rewrote a line a checked-in waiver file had waived.
let src = "module m;\n\twire a;\nendmodule\n";
let ws = workspace(src);
let doc = ws.document(&uri()).expect("open");
let whole = doc.positions().whole_document();
let (external, problems) = vlog_linter::ExternalWaivers::parse(
std::path::Path::new("team.waiver"),
"waive --rule=no-tabs\n",
);
assert!(problems.is_empty(), "{problems:?}");
let waived = LintRun::default().with_external(external);
assert!(
code_actions(&waived, &uri(), doc, whole, None, 2).is_empty(),
"no quick fix and no fix-all for a waived finding"
);
assert!(
!code_actions(&LintRun::default(), &uri(), doc, whole, None, 2).is_empty(),
"the same buffer without the waiver is fixable"
);
}
}
+86
View File
@@ -755,6 +755,92 @@ endmodule
assert_eq!(labels, ["clk_renamed:", "rst_n:", "data:"]);
}
// ------------------------------------------------------------------
// the default scope (TODO §37.2 / `performance_take2.md` §4b, §8)
// ------------------------------------------------------------------
/// An opentitan-shaped tree: an IP block with its RTL and its testbench,
/// and a shared library folder outside that block. Opening
/// `ip/aes/dv/tb/tb.sv` at the shipped `scopeDepth` of 2 raises to
/// `ip/aes`, so `ip/aes/rtl/sub.sv` is indexed and `dv/common/far.sv` is
/// not — which is exactly the shape `hw/ip/aes/dv/tb/tb.sv` has against
/// `hw/dv/sv/common_ifs/pins_if.sv`.
fn default_scoped(name: &str) -> (Tree, Workspace, Uri, &'static str) {
const TB: &str =
"module tb;\n sub u_sub (clk, rst_n, data);\n far u_far (a);\nendmodule\n";
let tree = Tree::new(name);
fs::create_dir_all(tree.path.join("ip/aes/rtl")).expect("dirs");
fs::create_dir_all(tree.path.join("ip/aes/dv/tb")).expect("dirs");
fs::create_dir_all(tree.path.join("dv/common")).expect("dirs");
tree.write("ip/aes/rtl/sub.sv", SUB);
tree.write("dv/common/far.sv", "module far (\n input logic a\n);\nendmodule\n");
let tb = tree.write("ip/aes/dv/tb/tb.sv", TB);
let mut ws = Workspace::default();
// The shipped default: no `index.scope`, `scopeDepth` 2.
ws.set_client_settings(crate::settings::ClientSettings::default());
ws.adopt_roots(vec![tree.path.clone()]);
let uri = path_to_uri(&tb).expect("uri");
ws.set_document(uri.clone(), TB.to_string());
ws.rebuild_index();
(tree, ws, uri, TB)
}
#[test]
fn the_default_scope_hints_a_module_the_didopen_widen_reached() {
// `performance_take2.md` §4b measured 0 hints at the default scope
// where the workspace scope gives 4, and §8 filed it as a correctness
// gap. It is not one: the hints that scope answers are exactly the
// instantiations whose module the widen reached.
let (tree, ws, uri, _) = default_scoped("default_scope");
assert!(
ws.index().files().iter().any(|f| f.ends_with("sub.sv")),
"the widen reached the block's own RTL: {:?}",
ws.index().files()
);
assert!(
!ws.index().files().iter().any(|f| f.ends_with("far.sv")),
"and not the library folder beside it"
);
let hints = inlay_hints(&ws, &uri, everything());
let labels: Vec<String> = hints
.into_iter()
.map(|h| {
let InlayHintLabel::String(s) = h.label else { panic!("string") };
s
})
.collect();
assert_eq!(labels, ["clk:", "rst_n:", "data:"], "the in-scope instantiation is hinted");
drop(tree);
}
#[test]
fn an_out_of_scope_module_is_unhinted_exactly_as_it_is_undefined() {
// The other half of the same finding: the `far` instantiation gets no
// hints — and go-to-definition and hover give nothing for it either.
// The zero is the scope's, not this module's; inlay uses the same
// `module_definition` lookup its neighbours do.
let (tree, ws, uri, tb) = default_scoped("out_of_scope");
let hints = inlay_hints(&ws, &uri, everything());
assert!(
hints.iter().all(|hint| hint.position.line != 2),
"nothing on the `far` line: {hints:#?}"
);
let far = tb.find("far u_far").expect("the instantiation") as u32;
assert!(crate::nav::definition(&ws, &uri, far).is_empty(), "nor does F12 answer");
assert!(crate::hover::hover(&ws, &uri, far).is_none(), "nor does hover");
// And the moment the scope reaches it, all three answer.
let mut wide = Workspace::default();
wide.open_whole_workspace(vec![tree.path.clone()]);
wide.set_document(uri.clone(), tb.to_string());
let hints = inlay_hints(&wide, &uri, everything());
assert_eq!(hints.len(), 4, "three ports plus `far`'s one: {hints:#?}");
assert_eq!(crate::nav::definition(&wide, &uri, far).len(), 1);
}
/// Order-of-magnitude perf checks, not run as part of the ordinary suite:
/// timing assertions in a shared CI runner are flaky by nature. Run with
/// `cargo test --release -p lucisv_server --bin lucisv-server qa_perf -- --ignored --nocapture`.
+135 -13
View File
@@ -12,12 +12,14 @@
//! `docs/features/server-lint/README.md`.
use std::collections::BTreeSet;
use std::path::{Path, PathBuf};
use lsp_types::{Diagnostic, DiagnosticSeverity, NumberOrString};
use lucisv_core::config::FileConfig;
use vlog_formatter::fence::{self, Region};
use vlog_linter::{
default_rules, lint, workspace_rules, LintContext, MentionOracle, ModuleInterface, Rule,
RuleOptions, Severity, Violation,
default_rules, lint_with, workspace_rules, ExternalWaivers, LintContext, MentionOracle,
ModuleInterface, Rule, RuleOptions, Severity, Violation,
};
use vlog_semantic::{FileId, SymbolKind, WorkspaceIndex};
@@ -41,6 +43,10 @@ pub struct LintRun<'a> {
/// The width `line-length` holds this buffer to — the width the formatter
/// would wrap it to, so the two halves of lucisv cannot disagree.
line_length: usize,
/// The external waiver files in force for this buffer, from its
/// `lucisv.toml` and from `lucisv.lint.waivers`. Empty unless one is
/// configured, and then costing the pass nothing.
external: ExternalWaivers,
}
impl Default for LintRun<'_> {
@@ -50,6 +56,7 @@ impl Default for LintRun<'_> {
oracle: None,
options: RuleOptions::new(),
line_length: DEFAULT_LINE_LENGTH,
external: ExternalWaivers::default(),
}
}
}
@@ -73,8 +80,17 @@ impl<'a> LintRun<'a> {
let workspace = index.files().len() > usize::from(own.is_some());
let rules = enabled_rules(ws.client_settings(), workspace);
let oracle = workspace.then_some(IndexMentions { index, own });
let (options, line_length) = configured(ws.client_settings(), doc);
LintRun { rules, oracle, options, line_length }
let (options, line_length, file) = configured(ws.client_settings(), doc);
let external = external_waivers(&waiver_paths(ws.client_settings(), ws.roots(), &file)).0;
LintRun { rules, oracle, options, line_length, external }
}
/// A run carrying these external waivers — for the tests that pin what a
/// waiver keeps out of the code actions.
#[cfg(test)]
pub(crate) fn with_external(mut self, external: ExternalWaivers) -> Self {
self.external = external;
self
}
/// This run's context over a buffer's own parse products.
@@ -109,7 +125,7 @@ impl<'a> LintRun<'a> {
/// reads it per formatting request: a `lucisv.toml` edited while the server
/// runs takes effect at the next publish, and the read is a few stats beside
/// a parse and an analysis the same pass already paid for.
fn configured(client: &ClientSettings, doc: &Document) -> (RuleOptions, usize) {
fn configured(client: &ClientSettings, doc: &Document) -> (RuleOptions, usize, FileConfig) {
let file = doc
.path
.as_deref()
@@ -125,7 +141,51 @@ fn configured(client: &ClientSettings, doc: &Document) -> (RuleOptions, usize) {
}
options.overlay(&client.lint_options);
let width = file.line_length.or(client.line_length).unwrap_or(DEFAULT_LINE_LENGTH);
(options, width)
(options, width, file)
}
/// The waiver files governing one buffer: its `lucisv.toml`'s `[lint] waivers`
/// first, then `lucisv.lint.waivers` from the editor.
///
/// The two **add up**, the way they do on the command line — a waiver file
/// only ever suppresses findings, so there is nothing here for one list to
/// take back from the other. A relative setting path is resolved against the
/// first workspace root, exactly as `lucisv.filelist` is; a `lucisv.toml`'s
/// paths were already resolved against that file's own directory.
pub fn waiver_paths(client: &ClientSettings, roots: &[PathBuf], file: &FileConfig) -> Vec<PathBuf> {
let mut paths: Vec<PathBuf> = file.lint_waivers.iter().flatten().cloned().collect();
for setting in &client.lint_waivers {
let path = Path::new(setting);
paths.push(match roots.first() {
Some(root) if path.is_relative() => root.join(path),
_ => path.to_path_buf(),
});
}
paths
}
/// Those files, read: the waivers and one message per file or line that could
/// not be used.
///
/// **Nothing here is fatal.** A push arrives on a socket and a bad path in it
/// must never cost a user every diagnostic in their file — this module's
/// standing rule, and `settings::rule_options`'. The messages are logged once,
/// when the settings arrive (`server::notification::apply_settings`); the lint
/// pass, which runs on every keystroke, drops them silently rather than
/// logging the same line a hundred times.
pub fn external_waivers(paths: &[PathBuf]) -> (ExternalWaivers, Vec<String>) {
let mut waivers = ExternalWaivers::default();
let mut problems = Vec::new();
for path in paths {
match ExternalWaivers::read(path) {
Ok((file, bad)) => {
problems.extend(bad);
waivers.absorb(file);
}
Err(problem) => problems.push(problem),
}
}
(waivers, problems)
}
/// Which rules a buffer is linted with, given what the editor's settings say.
@@ -256,8 +316,13 @@ fn context(doc: &Document) -> LintContext<'_> {
///
/// This is the diagnostics path, which never looks at a fix, so the width a
/// `no-tabs` fix would expand a tab to is left at the linter's own default.
/// The external waivers apply here exactly as the inline ones do, as a union.
/// Which of them *fired* is discarded: only a whole run can tell whether a
/// waiver was dead, and a server never has one — it lints the buffers a user
/// happens to have open. `lucisv check` is what reports an unused external
/// waiver; see `docs/features/waiver-files/README.md`.
pub fn violations_in(doc: &Document, run: &LintRun) -> Vec<Violation> {
lint(&run.context(doc), &run.rules)
lint_with(&run.context(doc), &run.rules, &run.external).0
}
/// The findings a code action may offer a fix for, with their fixes built for
@@ -274,8 +339,14 @@ pub fn violations_in(doc: &Document, run: &LintRun) -> Vec<Violation> {
/// just has no lightbulb. Which bytes count as fenced is
/// [`fence::protected_regions`]' answer, the one the CLI asks too; see
/// `docs/features/shared-fence-filter/README.md`.
pub fn fixable(doc: &Document, tab_width: usize) -> Vec<Violation> {
let found = lint(&context(doc).with_tab_width(tab_width), &default_rules());
pub fn fixable(run: &LintRun, doc: &Document, tab_width: usize) -> Vec<Violation> {
// The buffer's own run: its enabled rules and its external waiver files,
// so a fix is never offered — nor applied by fix-on-save — for a finding
// the diagnostics pass would not have shown. Found by §39's QA: with
// `default_rules()` and no waivers here, `source.fixAll.lucisv` rewrote a
// line a checked-in waiver file had waived.
let ctx = run.context(doc).with_tab_width(tab_width);
let found = lint_with(&ctx, &run.rules, &run.external).0;
// One tolerant parse per code-action request: `protected_regions` takes
// text and parses internally, on purpose — one fence answer for every
// front end, none of which can feed it a stale tree (see
@@ -449,7 +520,7 @@ mod tests {
let doc = ws.document(&uri).expect("open");
let diags = diagnostics(doc);
assert_eq!(diags.len(), 2, "both tabs are reported: {diags:#?}");
let offered = fixable(doc, 2);
let offered = fixable(&LintRun::default(), doc, 2);
assert_eq!(offered.len(), 1, "only the unfenced one may be fixed: {offered:#?}");
let free = text.find("\twire b").expect("the unfenced tab") as u32;
assert_eq!(offered[0].span.start, free);
@@ -469,7 +540,7 @@ mod tests {
.any(|d| d.code == Some(NumberOrString::String("no-tabs".into()))),
"still reported"
);
assert!(fixable(doc, 2).is_empty(), "and still not fixable");
assert!(fixable(&LintRun::default(), doc, 2).is_empty(), "and still not fixable");
}
#[test]
@@ -711,7 +782,7 @@ mod tests {
#[test]
fn an_unfenced_file_offers_every_fix() {
let (ws, uri) = doc_of("module m;\n// just a note\n\twire a;\nendmodule\n");
assert_eq!(fixable(ws.document(&uri).expect("open"), 2).len(), 1);
assert_eq!(fixable(&LintRun::default(), ws.document(&uri).expect("open"), 2).len(), 1);
}
#[test]
@@ -719,9 +790,60 @@ mod tests {
let (ws, uri) = doc_of("module m;\n\twire a;\nendmodule\n");
let doc = ws.document(&uri).expect("open");
for width in [2usize, 4] {
let found = fixable(doc, width);
let found = fixable(&LintRun::default(), doc, width);
let fix = found[0].fix.as_ref().expect("no-tabs offers a fix");
assert_eq!(fix.edits[0].1, " ".repeat(width));
}
}
/// The two waiver lists add up, and only the setting's relative paths are
/// anchored at the first root — a `lucisv.toml`'s were resolved against
/// that file's own directory before they got here. TODO §39.
#[test]
fn the_config_files_waivers_come_first_and_the_settings_are_rooted() {
let file = FileConfig {
lint_waivers: Some(vec![PathBuf::from("/proj/rtl/project.waiver")]),
..Default::default()
};
let client = ClientSettings {
lint_waivers: vec!["team.waiver".to_string(), "/etc/global.waiver".to_string()],
..Default::default()
};
let roots = vec![PathBuf::from("/work/top")];
assert_eq!(
waiver_paths(&client, &roots, &file),
vec![
PathBuf::from("/proj/rtl/project.waiver"),
PathBuf::from("/work/top/team.waiver"),
PathBuf::from("/etc/global.waiver"),
]
);
// With no root at all a relative path is left as written rather than
// guessed at, exactly as `filelist_path` leaves it.
assert_eq!(
waiver_paths(&client, &[], &FileConfig::default()),
vec![PathBuf::from("team.waiver"), PathBuf::from("/etc/global.waiver")]
);
assert!(waiver_paths(&ClientSettings::default(), &roots, &FileConfig::default()).is_empty());
}
/// A waiver file that is missing, and one with a bad line, are both
/// described rather than fatal — and the good directives of the second
/// still apply. TODO §39.
#[test]
fn a_bad_waiver_file_is_described_and_its_good_directives_still_apply() {
let dir = std::env::temp_dir().join(format!("lucisv_waiver_paths_{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir).expect("temp dir");
let good = dir.join("good.waiver");
std::fs::write(&good, "waive --rule=no-tabs\nwaive --rule=nope\n").expect("write");
let (waivers, problems) = external_waivers(&[good.clone(), dir.join("missing.waiver")]);
assert!(!waivers.is_empty(), "the good directive survived its neighbour");
assert_eq!(problems.len(), 2, "{problems:?}");
assert!(problems[0].contains("good.waiver:2: unknown rule `nope`"), "{problems:?}");
assert!(problems[1].contains("missing.waiver"), "{problems:?}");
let _ = std::fs::remove_dir_all(&dir);
}
}
+236 -1
View File
@@ -7,11 +7,18 @@
//! buffer's own line index when there is one, and otherwise through
//! `Workspace::file_view`, which reads a closed file at most once per
//! generation of it rather than once per question about it.
//!
//! One span never needs that read at all: a **file-scope declaration**'s own
//! name, whose client-side range the index recorded when the file was scanned
//! ([`vlog_semantic::DeclPositions`]). [`definition_location`] is that path,
//! and it is what `textDocument/definition` and `workspace/symbol` answer
//! from — see `docs/features/lazy-code-action/README.md`.
use std::path::Path;
use lsp_types::Location;
use lsp_types::{Location, Position, Range};
use vlog_parser::TextRange;
use vlog_semantic::{Def, Utf16Range};
use crate::convert::Positions;
use crate::state::Workspace;
@@ -27,6 +34,40 @@ pub fn location(ws: &Workspace, path: &Path, span: TextRange) -> Option<Location
Some(Location { uri, range: Positions::new(&view.text, &view.lines).range(span) })
}
/// Where an **indexed** declaration is written — its name's own range.
///
/// The index converted that range to client positions while it was scanning
/// the file ([`vlog_semantic::DeclLines::positions`]), so pointing an editor
/// at a module nobody has open is a map lookup rather than a file read: the
/// same eight numbers, computed once at index time instead of once per
/// question. Only **file-scope** declarations carry them; a member (a port, a
/// parameter, a class field) records none and falls through to
/// [`location`]'s read, which is the whole reason this is a separate function
/// rather than a change inside that one.
///
/// **An open buffer keeps the read.** Its text may have moved since it was
/// indexed, and every other answer about that buffer is computed against the
/// text it holds now; answering this one from the index instead would make
/// go-to-definition disagree with the document symbols beside it.
pub fn definition_location(ws: &Workspace, path: &Path, def: &Def) -> Option<Location> {
if ws.document_for_path(path).is_none() {
if let Some(recorded) = def.lines.positions {
return Some(Location { uri: path_to_uri(path)?, range: range(recorded.name) });
}
}
location(ws, path, def.name_span)
}
/// An index-recorded range as the protocol's own — the same four numbers,
/// both already counted in UTF-16 code units by the file's own
/// `LineIndex::utf16_position`, which is the converter `Positions` uses too.
fn range(recorded: Utf16Range) -> Range {
Range {
start: Position { line: recorded.start.line, character: recorded.start.character },
end: Position { line: recorded.end.line, character: recorded.end.character },
}
}
/// The 1-based line a byte offset falls on, for hover text that names a file
/// and a line rather than jumping to it.
///
@@ -49,3 +90,197 @@ pub fn line_number(ws: &Workspace, path: &Path, offset: u32) -> Option<u32> {
pub fn display_name(path: &Path) -> String {
path.file_name().and_then(|n| n.to_str()).unwrap_or("?").to_string()
}
#[cfg(test)]
mod tests {
use super::*;
use std::fs;
use std::path::PathBuf;
/// A scratch workspace root. Removed on drop.
struct Tree {
path: PathBuf,
}
impl Tree {
fn new(name: &str) -> Tree {
let path = std::env::temp_dir()
.join(format!("lucisv_server_locate_{}_{name}", std::process::id()));
let _ = fs::remove_dir_all(&path);
fs::create_dir_all(&path).expect("temp dir");
Tree { path }
}
/// Write a file as **bytes**, so a test can put a BOM or CRLF in one.
fn write(&self, rel: &str, text: &str) -> PathBuf {
let path = self.path.join(rel);
fs::write(&path, text.as_bytes()).expect("write");
path
}
/// An indexed workspace over everything written so far.
fn indexed(&self) -> Workspace {
let mut ws = Workspace::default();
ws.open_whole_workspace(vec![self.path.clone()]);
ws
}
}
impl Drop for Tree {
fn drop(&mut self) {
let _ = fs::remove_dir_all(&self.path);
}
}
/// The one declaration of `name` in the index, and the file it is in.
fn only_def<'w>(ws: &'w Workspace, name: &str) -> (&'w Def, &'w Path) {
let index = ws.index();
let [def] = index.units(name) else { panic!("exactly one `{name}`") };
(def, index.path(def.file).expect("a path"))
}
#[test]
fn a_file_scope_definition_is_located_without_reading_its_file() {
let tree = Tree::new("no_read");
tree.write("sub.sv", "module sub (\n input logic clk\n);\nendmodule\n");
let ws = tree.indexed();
let (def, path) = only_def(&ws, "sub");
let indexed = definition_location(&ws, path, def).expect("a location");
assert!(ws.held_views().is_empty(), "no file was read: {:?}", ws.held_views());
// Only now, so the comparison cannot be what filled the cache.
let read = location(&ws, path, def.name_span).expect("a location");
assert_eq!(indexed, read);
assert_eq!(ws.held_views().len(), 1, "the file-read path really does read one");
}
#[test]
fn the_two_paths_agree_over_multi_byte_astral_crlf_and_a_bom() {
// Everything that has ever made a UTF-16 conversion disagree, in one
// file: a BOM at offset 0, CRLF line endings, a two-byte character, a
// three-byte one, and an astral character that is *two* UTF-16 code
// units on its own.
let tree = Tree::new("encodings");
tree.write(
"wide.sv",
"\u{feff}// é ✓ 𝛼𝛽 — a comment\r\n\
// 𝟘𝟙𝟚 more\r\n\
module wide (\r\n input logic clk\r\n);\r\nendmodule\r\n",
);
let ws = tree.indexed();
let (def, path) = only_def(&ws, "wide");
let indexed = definition_location(&ws, path, def).expect("a location");
assert!(ws.held_views().is_empty(), "still no read");
let read = location(&ws, path, def.name_span).expect("a location");
assert_eq!(indexed, read, "the index-only range must be the file-read one");
// And it really is the name, not the line: `module ` is seven UTF-16
// units into line 2 (0-based), whatever the lines above it hold.
assert_eq!(indexed.range.start.line, 2);
assert_eq!(indexed.range.start.character, 7);
assert_eq!(indexed.range.end.character, 11);
}
#[test]
fn an_open_buffer_still_answers_from_the_buffer() {
// The index saw the file on disk; the buffer has since gained a line
// above the declaration, and has not been re-indexed. An indexed span
// is stale either way — the byte offset is the disk file's — and what
// this pins is that the *conversion* is unchanged by this round: the
// buffer's own line index, exactly as before, so go-to-definition and
// the document symbols beside it still agree with each other.
let tree = Tree::new("open_buffer");
let path = tree.write("sub.sv", "module sub;\nendmodule\n");
let mut ws = tree.indexed();
let uri = crate::uri::path_to_uri(&path).expect("uri");
ws.set_document(uri, "// typed since\nmodule sub;\nendmodule\n".to_string());
let (def, path) = only_def(&ws, "sub");
let located = definition_location(&ws, path, def).expect("a location");
assert_eq!(
located,
location(&ws, path, def.name_span).expect("a location"),
"an open buffer takes the file-read path, index positions or not"
);
assert_eq!(located.range.start.line, 0, "byte 7 of the buffer, not of the index's file");
assert!(ws.held_views().is_empty(), "an open buffer is never viewed");
}
#[test]
fn a_member_keeps_the_file_read_path() {
// Members carry no `DeclPositions` — see `DeclLines` — so the fallback
// is not decoration: it is the only answer for a port.
let tree = Tree::new("member");
tree.write("sub.sv", "module sub (\n input logic clk\n);\nendmodule\n");
let ws = tree.indexed();
let index = ws.index();
let [port] = index.member("sub", "clk") else { panic!("one `clk`") };
assert!(port.lines.positions.is_none(), "a member records no client positions");
let path = index.path(port.file).expect("a path");
assert_eq!(
definition_location(&ws, path, port),
location(&ws, path, port.name_span),
"and the fallback answers exactly what it always did"
);
assert_eq!(ws.held_views().len(), 1, "which cost the read");
}
/// `LUCISV_PERF_CORPUS=/path/to/project cargo test --release -p lucisv_server --bin lucisv-server locate::tests::defining -- --ignored --nocapture --test-threads=1`
#[test]
#[ignore = "perf measurement over a corpus this repository does not ship — see docs/perf/README.md"]
fn defining_over_a_real_project() {
// TODO §37.3's own number, beside the code it measures rather than in
// `perf.rs` — the precedent `perf::mean`'s `pub(crate)` exists for.
// Two columns over the same corpus and the same targets: converting an
// indexed span by reading its file, and reading it off the index.
// **Read-only** — the corpus is opened, never written.
let Ok(root) = std::env::var("LUCISV_PERF_CORPUS") else {
eprintln!("LUCISV_PERF_CORPUS is unset — nothing to measure");
return;
};
let mut ws = Workspace::default();
ws.set_client_settings(crate::settings::ClientSettings {
index_scope: crate::settings::IndexScope::Workspace,
..Default::default()
});
let started = std::time::Instant::now();
ws.open_whole_workspace(vec![PathBuf::from(&root)]);
let scan = started.elapsed();
// The targets: modules the corpus instantiates somewhere, whose single
// declaration the index can name — what an F12 on an instantiation
// lands on, and each in a different file.
let names: Vec<String> =
ws.index().instantiations().map(|(name, _)| name.to_string()).collect();
let targets: Vec<(PathBuf, vlog_semantic::Def)> = names
.iter()
.filter_map(|name| {
let path = vlog_refactor::module_definition(ws.index(), name).ok()?;
let [def] = ws.index().units(name) else { return None };
def.lines.positions.is_some().then(|| (path.to_path_buf(), def.clone()))
})
.take(200)
.collect();
let indexed = crate::perf::mean(5, || {
for (path, def) in &targets {
std::hint::black_box(definition_location(&ws, path, def));
}
});
let read = crate::perf::mean(5, || {
for (path, def) in &targets {
std::hint::black_box(location(&ws, path, def.name_span));
}
});
let each = targets.len().max(1) as u32;
eprintln!(
"definition over {} indexed files of {root} (scan {scan:?}), {} targets:\n \
index-only {indexed:?}, file-read {read:?} — {:?} vs {:?} per definition",
ws.index().files().len(),
targets.len(),
indexed / each,
read / each,
);
}
}
+66 -2
View File
@@ -126,6 +126,7 @@ fn main() -> Result<(), Box<dyn Error + Sync + Send>> {
configuration: configuration_support(&params),
token_server_cancel: token_server_cancel_support(&params),
hierarchy_view,
code_action_resolve: code_action_resolve_support(&params),
};
connection.initialize_finish(id, initialize_value(ranges_formatting)?)?;
@@ -261,8 +262,13 @@ fn capabilities() -> ServerCapabilities {
CodeActionKind::new(ports::REFACTOR_PORTS),
]),
work_done_progress_options: WorkDoneProgressOptions::default(),
// Every action is returned complete; there is nothing to resolve.
resolve_provider: None,
// The quick fixes are complete when they are offered; the port
// refactorings are not, for a client that can ask
// (`docs/features/lazy-code-action/README.md`). Advertised
// unconditionally because the server can always answer a resolve
// — including for an action that already carries its edit, which
// it hands straight back.
resolve_provider: Some(true),
})),
// The port refactorings. `lucisv.addPort` needs a declaration typed by
// the user, which no code action can carry, and a Vim user has no
@@ -499,6 +505,24 @@ fn snippet_support(params: &InitializeParams) -> bool {
.unwrap_or(false)
}
/// Whether the client can fetch a code action's `edit` after the fact —
/// `textDocument.codeAction.resolveSupport.properties` listing `"edit"`.
///
/// The property list is the capability: a client that can resolve `title`
/// alone cannot be offered an action without its edit, so nothing short of
/// `"edit"` counts. A client that says nothing gets every action complete, as
/// every client did before this was read
/// (`docs/features/lazy-code-action/README.md`).
fn code_action_resolve_support(params: &InitializeParams) -> bool {
params
.capabilities
.text_document
.as_ref()
.and_then(|text_document| text_document.code_action.as_ref())
.and_then(|code_action| code_action.resolve_support.as_ref())
.is_some_and(|resolve| resolve.properties.iter().any(|property| property == "edit"))
}
/// Whether the client applies a `workspace/applyEdit` request.
///
/// A client that did not say so gets a command's edit back as the request
@@ -1148,6 +1172,46 @@ mod tests {
assert!(kinds.contains(&CodeActionKind::QUICKFIX));
assert!(kinds.contains(&CodeActionKind::new(code_action::FIX_ALL)));
assert!(kinds.contains(&CodeActionKind::new(ports::REFACTOR_PORTS)));
assert_eq!(
options.resolve_provider,
Some(true),
"the port refactorings are offered without their edits to a client that can ask"
);
}
#[test]
fn code_action_resolve_support_is_read_from_the_clients_own_capabilities() {
use lsp_types::{
ClientCapabilities, CodeActionCapabilityResolveSupport, CodeActionClientCapabilities,
TextDocumentClientCapabilities,
};
assert!(
!code_action_resolve_support(&InitializeParams::default()),
"silence means the whole edit up front"
);
let saying = |properties: &[&str]| InitializeParams {
capabilities: ClientCapabilities {
text_document: Some(TextDocumentClientCapabilities {
code_action: Some(CodeActionClientCapabilities {
resolve_support: Some(CodeActionCapabilityResolveSupport {
properties: properties.iter().map(|p| p.to_string()).collect(),
}),
..Default::default()
}),
..Default::default()
}),
..Default::default()
},
..Default::default()
};
assert!(code_action_resolve_support(&saying(&["edit"])));
assert!(code_action_resolve_support(&saying(&["documentation", "edit"])));
assert!(
!code_action_resolve_support(&saying(&["documentation"])),
"resolving anything but the edit is no use to us"
);
assert!(!code_action_resolve_support(&saying(&[])));
}
#[test]
+34 -2
View File
@@ -7,7 +7,7 @@ use vlog_semantic::{Def, Definition, ExternalTarget, Semantics, Symbol, SymbolId
use crate::convert::Positions;
use crate::includes;
use crate::locate::location;
use crate::locate::{definition_location, location};
use crate::state::{Document, Workspace};
use crate::uri::path_to_uri;
@@ -60,7 +60,9 @@ pub fn definition(ws: &Workspace, uri: &Uri, offset: u32) -> Vec<Location> {
.iter()
.filter_map(|def| {
let path = ws.index().path(def.file)?;
location(ws, path, def.name_span)
// A file-scope declaration's range is already in the index, so
// the jump costs no read of the file it lands in.
definition_location(ws, path, def)
})
.collect(),
None => Vec::new(),
@@ -691,6 +693,36 @@ mod tests {
let _ = fs::remove_dir_all(&dir);
}
#[test]
fn a_cross_file_definition_reads_no_file() {
// The jump above, asked again for what it *costs*: the target module's
// range is in the index (`DeclPositions`), so nothing opens `sub.sv`.
// Pinned through the view cache, which is where a read would land.
let dir = temp_dir("no_read");
let sub = dir.join("sub.sv");
fs::write(&sub, "module sub (input clk);\nendmodule\n").expect("write");
let top_path = dir.join("top.sv");
let top_text = "module top;\n sub u_sub (.clk(1'b0));\nendmodule\n";
fs::write(&top_path, top_text).expect("write");
let mut ws = Workspace::default();
ws.open_whole_workspace(vec![dir.clone()]);
let uri = path_to_uri(&top_path).expect("uri");
ws.set_document(uri.clone(), top_text.to_string());
let locations = definition(&ws, &uri, at(top_text, "sub u_sub"));
assert_eq!(locations.len(), 1);
assert_eq!(locations[0].range.start.character, 7, "and it is still the right answer");
assert!(ws.held_views().is_empty(), "no file was read: {:?}", ws.held_views());
// `workspace/symbol` answers the same way, over the same index.
let hits = crate::symbols::workspace_symbols(&ws, "sub");
assert!(hits.iter().any(|hit| hit.name == "sub"), "{hits:#?}");
assert!(ws.held_views().is_empty(), "nor did the symbol search");
let _ = fs::remove_dir_all(&dir);
}
#[test]
fn an_ambiguous_workspace_name_returns_every_location() {
let dir = temp_dir("ambig");
+10 -1
View File
@@ -1022,6 +1022,14 @@ fn a_code_action_at_an_instantiation_before_and_after() {
let after = mean(20, || {
black_box(crate::ports::code_actions(&ws, &uri, black_box(offset)));
});
// TODO §37.1's column: the *offer* a client that can resolve receives,
// which reads the buffer and — at an instantiation — one more file,
// whatever the fan-out is. The edit is computed by `resolve`, which is the
// `after` column above, once, when the user clicks.
let position = ws.document(&uri).expect("open").positions().position(offset);
let offer = mean(20, || {
black_box(crate::ports::offers(&ws, &uri, black_box(position), black_box(offset)));
});
let read = mean(3, || {
black_box(ws.sources());
});
@@ -1035,9 +1043,10 @@ fn a_code_action_at_an_instantiation_before_and_after() {
});
// A measurement of an answer that was not given is worthless.
assert_eq!(crate::ports::code_actions(&ws, &uri, offset).len(), 1);
assert_eq!(crate::ports::offers(&ws, &uri, position, offset).len(), 1);
eprintln!(
"codeAction on a port of a module instantiated in 3 of {} files ({lines} lines each): \
whole workspace {before:?}, fan-out {after:?} \
whole workspace {before:?}, fan-out {after:?}, offer {offer:?} \
(`sources()` alone: {read:?}; prepareRename, untouched: {prepare:?})",
ws.index().files().len()
);
+507
View File
@@ -12,6 +12,13 @@
//! and `lucisv.propagatePorts` take a position and exist for the same reason a
//! Vim user has no lightbulb: a command works everywhere a keybinding does.
//! See `docs/features/refactor-ports/README.md`.
//!
//! **Two shapes of code action.** A client that can resolve is *offered*
//! actions with no edit ([`offers`]) and asks for the edit when the user picks
//! one ([`resolve`]); a client that cannot gets the edit up front
//! ([`code_actions`]). The offer reads one or two files whatever the module's
//! fan-out is, which is the whole point — see
//! `docs/features/lazy-code-action/README.md`.
// See `rename.rs` for why this is a `WorkspaceEdit`'s problem and not ours.
#![allow(clippy::mutable_key_type)]
@@ -22,6 +29,7 @@ use std::path::{Path, PathBuf};
use lsp_types::{
CodeAction, CodeActionKind, CodeActionOrCommand, Position, TextEdit, Uri, WorkspaceEdit,
};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use vlog_parser::LineIndex;
use vlog_refactor::{ModuleRef, RefactorEdit};
@@ -48,6 +56,12 @@ pub fn commands() -> Vec<String> {
/// The port actions available at a position, each carrying its own computed
/// edit — nothing to resolve, and nothing offered that would be refused.
///
/// What a client without `codeAction/resolve` gets, and what [`resolve`]
/// re-runs to answer one that has. It reads the module's whole fan-out
/// ([`Workspace::module_sources`]), which is ~1.4 ms per instantiating file:
/// fine once, when the user has clicked, and not fine on every cursor move,
/// which is why [`offers`] exists.
pub fn code_actions(ws: &Workspace, uri: &Uri, offset: u32) -> Vec<CodeActionOrCommand> {
let Some(doc) = ws.document(uri) else { return Vec::new() };
let Some(path) = doc.path.clone() else { return Vec::new() };
@@ -76,6 +90,183 @@ pub fn code_actions(ws: &Workspace, uri: &Uri, offset: u32) -> Vec<CodeActionOrC
.collect()
}
/// What a lazily-offered action carries in place of its edit: enough to ask
/// the same question again when the user picks it.
///
/// The position rather than the offset, because that is what the client
/// speaks and what the buffer it will be re-read against is indexed by.
#[derive(Serialize, Deserialize)]
struct Offer {
uri: Uri,
position: Position,
title: String,
}
/// The sentence a resolve that finds nothing answers with. Not a silent empty
/// edit: an action that has stopped applying is news, and applying nothing
/// while saying nothing is how a user comes to distrust the lightbulb.
const GONE: &str = "the action is no longer available.";
/// A resolve of something this server never offered.
const NOT_OURS: &str = "this code action carries no lucisv port refactoring to resolve.";
/// The port actions available at a position, **without their edits** — the
/// offer a client that can `codeAction/resolve` is sent.
///
/// The question "is there an action here at all" is answered over the buffer
/// itself plus, for a cursor on an instantiation, the instantiated module's
/// own declaration ([`offer_sources`]) — one or two files, whatever the
/// module's fan-out is. The edits those two files produce are thrown away;
/// [`resolve`] computes the real one over the whole fan-out when the user
/// clicks.
///
/// **The count in the title comes from the index**, since the fan-out has not
/// been read: [`instances_of`] counts every *instance* the index has seen of
/// the module, so `sub u1(), u2();` counts two. The eager title counts the
/// instances the plan really rewrites, which is the same number except where
/// the index cannot know — an unsaved buffer's new instantiation, a
/// file-scope instantiation site (which records no edge), an instance
/// connecting with `.*`. The two are therefore matched on the part of the
/// title *before* that count; see [`key`].
pub fn offers(
ws: &Workspace,
uri: &Uri,
position: Position,
offset: u32,
) -> Vec<CodeActionOrCommand> {
let Some(doc) = ws.document(uri) else { return Vec::new() };
let Some(path) = doc.path.clone() else { return Vec::new() };
let modules = vlog_refactor::port_action_modules(&doc.text, offset);
// A name the workspace declares twice is a refusal the engine makes over
// the fan-out, where it can see both declarations. The offer cannot, so it
// asks the index the same question rather than offering an action that
// resolve would then decline.
if modules.is_empty() || modules.iter().any(|name| declared_twice(ws, name)) {
return Vec::new();
}
let sources = offer_sources(ws, &path, &doc.text, &modules);
vlog_refactor::port_actions(&sources, &path, offset)
.into_iter()
.map(|action| {
let title = counted(ws, action.title, &modules);
let data =
serde_json::to_value(Offer { uri: uri.clone(), position, title: title.clone() })
.ok();
CodeActionOrCommand::CodeAction(CodeAction {
title,
kind: Some(CodeActionKind::new(REFACTOR_PORTS)),
data,
..Default::default()
})
})
.collect()
}
/// The files an [`offers`] call reads: the buffer the request names, and the
/// declaration of every module an instantiation under the cursor names.
///
/// The second is the same two steps `inlay.rs`'s `Plans::read` takes — the
/// index says which file declares the module, and that one file is read —
/// and it is what lets the engine answer "this instantiation is missing
/// ports" without any file that *instantiates* the module. A cursor on a port
/// declaration names its own module, whose declaring file is the buffer
/// itself, so that case reads nothing at all.
///
/// `pub(crate)` for the test that pins exactly this set.
pub(crate) fn offer_sources(
ws: &Workspace,
path: &Path,
text: &str,
modules: &[String],
) -> Vec<(PathBuf, String)> {
let mut sources = vec![(path.to_path_buf(), text.to_string())];
for name in modules {
let Ok(declared_in) = vlog_refactor::module_definition(ws.index(), name) else { continue };
if sources.iter().any(|(held, _)| held == declared_in) {
continue;
}
if let Some(text) = ws.text_of(declared_in) {
sources.push((declared_in.to_path_buf(), text));
}
}
sources
}
/// The edit for one offered action, computed now that the user has picked it.
///
/// Today's eager answer at the offer's own position, narrowed to the action
/// whose title the client is holding. An action already carrying its edit is
/// returned untouched — a client may resolve anything it likes, and the quick
/// fixes in `code_action.rs` are complete when they are offered.
pub fn resolve(ws: &Workspace, action: CodeAction) -> Result<CodeAction, String> {
if action.edit.is_some() {
return Ok(action);
}
let offer: Offer = action
.data
.clone()
.and_then(|data| serde_json::from_value(data).ok())
.ok_or_else(|| NOT_OURS.to_string())?;
// A `codeAction/resolve` carries a `CodeAction`, not a `textDocument`, so
// the large-file fast path's gate (which reads the URI out of the params)
// never sees this request. A buffer that has grown past the threshold
// since it was offered an action is refused here instead: the fast path's
// whole contract is that a large buffer is never parsed, and one stale
// lightbulb is not a reason to break it.
let doc = ws.document(&offer.uri).filter(|doc| !doc.large).ok_or_else(|| GONE.to_string())?;
let offset = doc.positions().offset(offer.position);
code_actions(ws, &offer.uri, offset)
.into_iter()
.find_map(|offered| match offered {
CodeActionOrCommand::CodeAction(found) if key(&found.title) == key(&offer.title) => {
Some(found)
}
_ => None,
})
.map(|mut resolved| {
resolved.data = action.data;
resolved
})
.ok_or_else(|| GONE.to_string())
}
/// An action's identity: its title without the count phrase the offer and the
/// eager path can honestly disagree about.
///
/// `"lucisv: remove port `rst` (updates 3 instantiations)"` keys as
/// ``"lucisv: remove port `rst`"``; a title with no such suffix
/// (`"lucisv: connect 1 missing port"`, whose count is the cursor's own file's
/// and therefore exact) keys as itself. An escaped identifier cannot contain a
/// space, so `" ("` never occurs inside a port name.
fn key(title: &str) -> &str {
title.strip_suffix(')').and_then(|head| head.rsplit_once(" (")).map_or(title, |(head, _)| head)
}
/// An offered title with the workspace's own instantiation count in it,
/// replacing the one the offer's one or two files could see.
fn counted(ws: &Workspace, title: String, modules: &[String]) -> String {
let Some(head) = title.strip_suffix(')').and_then(|head| head.rsplit_once(" (")) else {
return title;
};
let sites = modules.iter().map(|name| instances_of(ws, name)).sum();
format!("{} ({})", head.0, vlog_refactor::sites_phrase(sites))
}
/// Every instance of `name` the index has seen. An edge is one written
/// statement, so its instances are counted rather than the edges themselves —
/// `sub u1 (), u2 ();` is two connection lists to rewrite and the title says
/// two.
fn instances_of(ws: &Workspace, name: &str) -> usize {
ws.index().instantiations_of(name).iter().map(|edge| edge.instances.len()).sum()
}
/// Whether the index holds more than one declaration of `name` a module
/// reference could mean — the ambiguity `vlog_refactor::module_definition`
/// refuses to guess between, and the one the engine refuses a refactoring
/// over.
fn declared_twice(ws: &Workspace, name: &str) -> bool {
ws.index().units(name).iter().filter(|def| def.kind.is_instantiable()).count() > 1
}
/// Run one of the three commands, or say why it cannot run.
///
/// The answer is the `WorkspaceEdit` to apply plus the engine's warnings. How
@@ -809,6 +1000,322 @@ mod tests {
assert_eq!(edits_for(action.edit.as_ref().expect("edit"), &new_uri).len(), 2);
}
// ------------------------------------------------------------------
// the lazy offer and its resolve (TODO §37.1)
// ------------------------------------------------------------------
/// The offer a client that can resolve receives at `offset`.
fn offered(ws: &Workspace, uri: &Uri, offset: u32) -> Vec<CodeActionOrCommand> {
let position = ws.document(uri).expect("an open document").positions().position(offset);
offers(ws, uri, position, offset)
}
/// One action's title and kind — what a lightbulb draws, and all an offer
/// promises.
fn menu(actions: &[CodeActionOrCommand]) -> Vec<(String, Option<String>)> {
actions
.iter()
.map(|action| {
let CodeActionOrCommand::CodeAction(action) = action else {
return ("a command".to_string(), None);
};
(action.title.clone(), action.kind.as_ref().map(|k| k.as_str().to_string()))
})
.collect()
}
/// The one action an offer holds.
fn only(actions: &[CodeActionOrCommand]) -> &CodeAction {
let [CodeActionOrCommand::CodeAction(action)] = actions else {
panic!("exactly one action, got {actions:#?}")
};
action
}
#[test]
fn the_lazy_offer_names_exactly_what_the_eager_one_names() {
let tree = Tree::new("lazy_menu");
let mut ws = crowded(&tree, 40);
let sub_uri = path_to_uri(&tree.path.join("sub.sv")).expect("uri");
ws.set_document(sub_uri.clone(), SUB.to_string());
let offset = SUB.find("input logic rst").expect("rst") as u32 + 12;
let lazy = offered(&ws, &sub_uri, offset);
assert_eq!(menu(&lazy), menu(&code_actions(&ws, &sub_uri, offset)));
assert_eq!(
menu(&lazy)[0].0,
"lucisv: remove port `rst` (updates 3 instantiations)",
"counted from the index, and it agrees with the plan's own count"
);
let action = only(&lazy);
assert!(action.edit.is_none(), "an offer carries no edit");
assert!(action.data.is_some(), "it carries what resolve needs instead");
}
#[test]
fn the_offer_reads_the_buffer_and_at_most_the_declaring_file() {
// The pin `the_files_a_code_action_reads_are_the_modules_own_fan_out`
// is to the eager path; this is the same question asked of the offer,
// through the set it hands the engine. Neither the 40 noise files nor
// — and this is the point — any of the three instantiating tops.
let tree = Tree::new("lazy_reads");
let mut ws = crowded(&tree, 40);
let sub = tree.path.join("sub.sv");
let sub_uri = path_to_uri(&sub).expect("uri");
ws.set_document(sub_uri.clone(), SUB.to_string());
assert_eq!(ws.sources().len(), 44, "the whole workspace");
assert_eq!(ws.module_sources(&sub, &["sub".to_string()]).len(), 4, "the eager fan-out");
// A cursor on a port declaration: the module is the buffer's own.
let read = offer_sources(&ws, &sub, SUB, &["sub".to_string()]);
let names: Vec<String> = read
.iter()
.map(|(path, _)| path.file_name().expect("name").to_string_lossy().to_string())
.collect();
assert_eq!(names, ["sub.sv"], "one file, and it is the buffer itself");
// A cursor on an instantiation: the buffer, plus the one file the
// index says declares the module.
let top = tree.path.join("top0.sv");
let top_text = std::fs::read_to_string(&top).expect("read");
let read = offer_sources(&ws, &top, &top_text, &["sub".to_string()]);
let mut names: Vec<String> = read
.iter()
.map(|(path, _)| path.file_name().expect("name").to_string_lossy().to_string())
.collect();
names.sort();
assert_eq!(names, ["sub.sv", "top0.sv"], "and never top1, top2 or a noise file");
}
#[test]
fn a_resolved_action_carries_the_eager_edit_at_a_port_declaration() {
let tree = Tree::new("resolve_port");
let mut ws = crowded(&tree, 40);
let sub_uri = path_to_uri(&tree.path.join("sub.sv")).expect("uri");
ws.set_document(sub_uri.clone(), SUB.to_string());
let offset = SUB.find("input logic rst").expect("rst") as u32 + 12;
let resolved = resolve(&ws, only(&offered(&ws, &sub_uri, offset)).clone()).expect("edit");
let eager = only(&code_actions(&ws, &sub_uri, offset)).clone();
assert_eq!(resolved.title, eager.title);
assert_eq!(resolved.kind, eager.kind);
assert_eq!(resolved.edit, eager.edit, "the same WorkspaceEdit, to the byte");
assert!(resolved.data.is_some(), "the offer's own data survives the round trip");
}
#[test]
fn a_resolved_action_carries_the_eager_edit_at_an_instantiation() {
// The other cursor shape: an instantiation missing a connection, where
// the offer has to read the *instantiated* module's declaration to
// know there is anything to offer at all.
let tree = Tree::new("resolve_inst");
let text = "module top;\n logic clk, rst;\n sub u_sub (.clk(clk));\nendmodule\n";
tree.write("sub.sv", SUB);
let top = tree.write("top.sv", text);
let mut ws = Workspace::default();
ws.open_whole_workspace(vec![tree.path.clone()]);
let uri = path_to_uri(&top).expect("uri");
ws.set_document(uri.clone(), text.to_string());
let offset = text.find("sub u_sub").expect("the instantiation") as u32;
let lazy = offered(&ws, &uri, offset);
assert_eq!(menu(&lazy), menu(&code_actions(&ws, &uri, offset)));
assert_eq!(menu(&lazy)[0].0, "lucisv: connect 1 missing port");
assert!(only(&lazy).edit.is_none());
let resolved = resolve(&ws, only(&lazy).clone()).expect("edit");
assert_eq!(resolved.edit, only(&code_actions(&ws, &uri, offset)).edit);
assert_eq!(
edits_for(resolved.edit.as_ref().expect("edit"), &uri)[0].new_text,
", .rst(rst)"
);
}
#[test]
fn the_resolved_edit_sees_an_unsaved_buffer_the_offer_could_not_count() {
// The pin `an_unsaved_buffer_contributes_the_instantiation_the_index
// _has_not_seen` moved to the lazy path. The offer counts instances
// from the index, which has not seen the unsaved one, so the title
// says three; the *edit* is computed over the fan-out plus every open
// buffer, so it disconnects all four. Exactness lives in the edit,
// which is what the user actually applies.
let tree = Tree::new("lazy_unsaved");
let mut ws = crowded(&tree, 20);
let extra = tree.path.join("noise0.sv");
let extra_uri = path_to_uri(&extra).expect("uri");
let typed = "module noise0;\n logic c, r;\n sub u_new (.clk(c), .rst(r));\nendmodule\n";
ws.set_document(extra_uri.clone(), typed.to_string());
let sub_uri = path_to_uri(&tree.path.join("sub.sv")).expect("uri");
ws.set_document(sub_uri.clone(), SUB.to_string());
let offset = SUB.find("input logic rst").expect("rst") as u32 + 12;
let lazy = offered(&ws, &sub_uri, offset);
assert_eq!(
menu(&lazy)[0].0,
"lucisv: remove port `rst` (updates 3 instantiations)",
"the index has not seen the fourth"
);
let resolved = resolve(&ws, only(&lazy).clone()).expect("edit");
assert_eq!(
resolved.title, "lucisv: remove port `rst` (updates 4 instantiations)",
"and the resolve says so"
);
let edit = resolved.edit.as_ref().expect("an edit");
assert_eq!(edits_for(edit, &extra_uri).len(), 2, "the unsaved buffer is disconnected too");
assert_eq!(resolved.edit, only(&code_actions(&ws, &sub_uri, offset)).edit);
}
#[test]
fn a_resolve_of_an_action_the_buffer_no_longer_carries_is_refused() {
let tree = Tree::new("lazy_stale");
let mut ws = crowded(&tree, 10);
let sub_uri = path_to_uri(&tree.path.join("sub.sv")).expect("uri");
ws.set_document(sub_uri.clone(), SUB.to_string());
let offset = SUB.find("input logic rst").expect("rst") as u32 + 12;
let offered = only(&offered(&ws, &sub_uri, offset)).clone();
// The user kept typing: the port the lightbulb was about is gone.
ws.set_document(sub_uri.clone(), "module sub (\n input logic clk\n);\nendmodule\n".into());
let message = resolve(&ws, offered.clone()).expect_err("nothing to resolve");
assert_eq!(message, GONE);
// And a document that has been closed altogether says the same.
ws.close_document(&sub_uri);
assert_eq!(resolve(&ws, offered).expect_err("no buffer"), GONE);
}
#[test]
fn a_resolve_against_a_buffer_on_the_large_file_fast_path_is_refused() {
// `codeAction/resolve`'s params are a `CodeAction`, so the fast path's
// own gate — which reads a `textDocument` out of the params — never
// sees this request. A buffer that grew past the threshold since it
// was offered an action must still not be parsed.
let tree = Tree::new("lazy_large");
let mut ws = crowded(&tree, 5);
let sub_uri = path_to_uri(&tree.path.join("sub.sv")).expect("uri");
ws.set_document(sub_uri.clone(), SUB.to_string());
let offset = SUB.find("input logic rst").expect("rst") as u32 + 12;
let offered = only(&offered(&ws, &sub_uri, offset)).clone();
let _ = ws.set_client_settings(crate::settings::ClientSettings {
large_file_threshold: 8,
..Default::default()
});
ws.set_document(sub_uri.clone(), SUB.to_string());
assert!(ws.document(&sub_uri).expect("open").large, "the buffer is on the fast path");
assert_eq!(resolve(&ws, offered).expect_err("not parsed"), GONE);
}
#[test]
fn a_resolve_of_something_this_server_never_offered_says_so() {
let tree = Tree::new("lazy_foreign");
let (ws, uri, _) = opened(&tree);
let bare = CodeAction { title: "someone else's action".to_string(), ..Default::default() };
assert_eq!(resolve(&ws, bare.clone()).expect_err("no data"), NOT_OURS);
// Data that is not ours either — a shape `serde` cannot read as an
// offer. Refused, not guessed at.
let junk = CodeAction { data: Some(serde_json::json!({"nope": 1})), ..bare.clone() };
assert_eq!(resolve(&ws, junk).expect_err("junk data"), NOT_OURS);
// An action that already carries its edit — every quick fix in
// `code_action.rs`, and the port actions a non-resolving client is
// sent — comes straight back, because there is nothing to add to it.
let complete =
CodeAction { edit: Some(WorkspaceEdit::new(HashMap::from([(uri, vec![])]))), ..bare };
assert_eq!(resolve(&ws, complete.clone()).expect("nothing to do"), complete);
}
#[test]
fn a_name_the_workspace_declares_twice_is_not_offered_either() {
// The eager path refuses because both declaring files are in the set
// it reads (`a_module_declared_twice_is_refused_through_the_subset_as
// _well`). The offer reads neither, so it asks the index the same
// question — otherwise it would offer an action resolve then refuses.
let tree = Tree::new("lazy_ambiguous");
let mut ws = crowded(&tree, 10);
tree.write("clone.sv", SUB);
ws.rebuild_index();
let sub_uri = path_to_uri(&tree.path.join("sub.sv")).expect("uri");
ws.set_document(sub_uri.clone(), SUB.to_string());
let offset = SUB.find("input logic rst").expect("rst") as u32 + 12;
assert!(offered(&ws, &sub_uri, offset).is_empty());
assert!(code_actions(&ws, &sub_uri, offset).is_empty(), "as the eager path does");
}
#[test]
fn a_title_keys_on_everything_but_its_count() {
assert_eq!(
key("lucisv: remove port `rst` (updates 3 instantiations)"),
key("lucisv: remove port `rst` (no instantiation in scope)")
);
assert_eq!(key("lucisv: connect 1 missing port"), "lucisv: connect 1 missing port");
assert_ne!(
key("lucisv: remove port `rst` (updates 1 instantiation)"),
key("lucisv: remove port `clk` (updates 1 instantiation)")
);
}
/// `cargo test --release -p lucisv_server --bin lucisv-server ports::tests::the_offer_is_flat -- --ignored --nocapture --test-threads=1`
#[test]
#[ignore = "perf measurement, not a correctness assertion — see docs/perf/README.md"]
fn the_offer_is_flat_where_the_eager_answer_grows() {
// `performance_take2.md` §6a measured the eager answer growing with
// the module's fan-out — ~1.4 ms per instantiating file plus a ~13 ms
// floor, 185 ms at 128 files, to offer *zero* actions. The offer reads
// one file (a cursor on a port declaration) or two (a cursor on an
// instantiation), so its column should be flat. Beside the code it
// measures rather than in `perf.rs`, which is what `perf::mean` is
// `pub(crate)` for.
for instantiators in [3usize, 40, 128] {
let tree = Tree::new(&format!("perf_offer_{instantiators}"));
tree.write("sub.sv", SUB);
for n in 0..instantiators {
tree.write(
&format!("top{n:03}.sv"),
&format!(
"module top{n:03};\n logic c, r;\n \
sub u_sub (.clk(c), .rst(r));\nendmodule\n"
),
);
}
for n in 0..200 {
tree.write(
&format!("noise{n:03}.sv"),
&format!(
"module noise{n:03};\n logic a;\n wire b;\n \
assign b = a;\nendmodule\n"
),
);
}
let mut ws = Workspace::default();
ws.open_whole_workspace(vec![tree.path.clone()]);
for (what, file, needle, skip) in [
("a port declaration", "sub.sv", "input logic rst", 12u32),
("an instantiation ", "top000.sv", "sub u_sub", 0),
] {
let path = tree.path.join(file);
let text = std::fs::read_to_string(&path).expect("read");
let uri = path_to_uri(&path).expect("uri");
ws.set_document(uri.clone(), text.clone());
let offset = text.find(needle).expect("the cursor") as u32 + skip;
let eager = crate::perf::mean(5, || {
std::hint::black_box(code_actions(&ws, &uri, offset));
});
let offer = crate::perf::mean(20, || {
std::hint::black_box(offered(&ws, &uri, offset));
});
eprintln!(
" fan-out {instantiators:>3}, cursor on {what}: eager {eager:?}, \
offer {offer:?} ({} actions)",
offered(&ws, &uri, offset).len()
);
}
}
}
#[test]
fn an_unknown_command_is_declined() {
let tree = Tree::new("unknown");
+33 -16
View File
@@ -14,22 +14,22 @@
use lsp_server::{Request, RequestId, Response};
use lsp_types::request::{
CallHierarchyIncomingCalls, CallHierarchyOutgoingCalls, CallHierarchyPrepare,
CodeActionRequest, CodeLensRequest, Completion, DocumentDiagnosticRequest,
DocumentHighlightRequest, DocumentLinkRequest, DocumentSymbolRequest, ExecuteCommand,
FoldingRangeRequest, Formatting, GotoDefinition, GotoTypeDefinition, GotoTypeDefinitionParams,
GotoTypeDefinitionResponse, HoverRequest, InlayHintRequest, InlineCompletionRequest,
LinkedEditingRange, OnTypeFormatting, PrepareRenameRequest, RangeFormatting, References,
Rename, Request as _, SelectionRangeRequest, SemanticTokensFullDeltaRequest,
SemanticTokensFullRequest, SemanticTokensRangeRequest, SignatureHelpRequest,
TypeHierarchyPrepare, TypeHierarchySubtypes, TypeHierarchySupertypes, WillRenameFiles,
WillSaveWaitUntil, WorkspaceDiagnosticRequest, WorkspaceSymbolRequest,
CodeActionRequest, CodeActionResolveRequest, CodeLensRequest, Completion,
DocumentDiagnosticRequest, DocumentHighlightRequest, DocumentLinkRequest,
DocumentSymbolRequest, ExecuteCommand, FoldingRangeRequest, Formatting, GotoDefinition,
GotoTypeDefinition, GotoTypeDefinitionParams, GotoTypeDefinitionResponse, HoverRequest,
InlayHintRequest, InlineCompletionRequest, LinkedEditingRange, OnTypeFormatting,
PrepareRenameRequest, RangeFormatting, References, Rename, Request as _, SelectionRangeRequest,
SemanticTokensFullDeltaRequest, SemanticTokensFullRequest, SemanticTokensRangeRequest,
SignatureHelpRequest, TypeHierarchyPrepare, TypeHierarchySubtypes, TypeHierarchySupertypes,
WillRenameFiles, WillSaveWaitUntil, WorkspaceDiagnosticRequest, WorkspaceSymbolRequest,
};
use lsp_types::{
CallHierarchyIncomingCallsParams, CallHierarchyOutgoingCallsParams, CallHierarchyPrepareParams,
CodeActionKind, CodeActionParams, CodeLensParams, CompletionParams, DocumentDiagnosticParams,
DocumentDiagnosticReportResult, DocumentHighlightParams, DocumentLinkParams,
DocumentSymbolParams, DocumentSymbolResponse, ExecuteCommandParams, FoldingRangeParams,
GotoDefinitionParams, GotoDefinitionResponse, HoverParams, InlayHintParams,
CodeAction, CodeActionKind, CodeActionParams, CodeLensParams, CompletionParams,
DocumentDiagnosticParams, DocumentDiagnosticReportResult, DocumentHighlightParams,
DocumentLinkParams, DocumentSymbolParams, DocumentSymbolResponse, ExecuteCommandParams,
FoldingRangeParams, GotoDefinitionParams, GotoDefinitionResponse, HoverParams, InlayHintParams,
InlineCompletionParams, LinkedEditingRangeParams, Position, ReferenceParams, RenameFilesParams,
RenameParams, SelectionRangeParams, SemanticTokens, SemanticTokensDeltaParams,
SemanticTokensParams, SemanticTokensRangeParams, SemanticTokensRangeResult,
@@ -45,7 +45,7 @@ use super::client::ms;
use super::Server;
use crate::{
code_action, completion, design_hierarchy, file_ops, folding, format, hierarchy, hover,
includes, inlay, inline, lens, linked, nav, pairs, ports, rename, selection, signature,
includes, inlay, inline, lens, linked, lint, nav, pairs, ports, rename, selection, signature,
symbols, tokens, type_def, type_hierarchy,
};
@@ -251,17 +251,34 @@ impl Server {
// or from the built-in default.
let tab_width =
format::indent_width(doc.path.as_deref(), self.workspace.client_settings());
let run = lint::LintRun::for_document(&self.workspace, doc);
let mut actions =
code_action::code_actions(&uri, doc, p.range, only.as_deref(), tab_width);
code_action::code_actions(&run, &uri, doc, p.range, only.as_deref(), tab_width);
// The port refactorings answer for the cursor, not for a range:
// the request's start is where the user is.
if code_action::wanted(only.as_deref(), &CodeActionKind::new(ports::REFACTOR_PORTS))
{
let offset = doc.positions().offset(p.range.start);
actions.extend(ports::code_actions(&self.workspace, &uri, offset));
// A client that can resolve is offered the actions without
// their edits, which is what keeps a cursor resting on an
// instantiation off the module's fan-out; one that cannot
// gets the whole edit, exactly as before.
actions.extend(match self.abilities.code_action_resolve {
true => ports::offers(&self.workspace, &uri, p.range.start, offset),
false => ports::code_actions(&self.workspace, &uri, offset),
});
}
to_value(actions)
}),
// The edit for an action offered without one. An action that
// already carries its edit comes straight back, so a client that
// resolves everything it is offered is answered too.
CodeActionResolveRequest::METHOD => decode(request).and_then(|action: CodeAction| {
match ports::resolve(&self.workspace, action) {
Ok(resolved) => to_value(resolved),
Err(message) => Err(Failure::Request(message)),
}
}),
// Custom method, so it is matched by name rather than through a
// `lsp_types::request` type. Nothing advertises it: a client that
// does not know it never asks.
+7
View File
@@ -104,6 +104,13 @@ pub struct ClientAbilities {
/// Whether the client hosts the custom lucisv hierarchy sidebar and wants
/// a notification whenever the installed workspace index changes.
pub hierarchy_view: bool,
/// Whether the client can fetch a code action's `edit` through
/// `codeAction/resolve` — `textDocument.codeAction.resolveSupport`
/// listing `"edit"`. Only then are the port refactorings *offered* without
/// their edits; a client that said nothing gets the whole edit up front,
/// which is what every client got before this was read
/// (`docs/features/lazy-code-action/README.md`).
pub code_action_resolve: bool,
}
/// Everything the server owns.
@@ -25,7 +25,7 @@ use serde::de::DeserializeOwned;
use super::batch::{widen_of, Widen};
use super::client::ms;
use super::Server;
use crate::{file_ops, settings, sync, watch};
use crate::{file_ops, lint, settings, sync, watch};
impl Server {
/// Handle one notification, timing it when `--verbose` asked. A
@@ -259,6 +259,21 @@ impl Server {
},
);
}
// And the same for `lucisv.lint.waivers`: a file that is not there, or
// a directive that does not parse, is dropped and said once — here,
// where the setting arrives, rather than on every keystroke from the
// lint pass that reads the files. Only the setting's own files are
// checked; a `lucisv.toml`'s `[lint] waivers` is that file's problem
// and `lucisv check` fails the run over it.
for problem in waiver_problems(&settings, self.workspace.roots()) {
self.notify(
LogMessage::METHOD,
LogMessageParams {
typ: MessageType::WARNING,
message: format!("lucisv: lucisv.lint.waivers: {problem}; ignored"),
},
);
}
// Only `exclude` and `filelist` change which files exist as far as
// this server is concerned; the other settings are read afresh by the
// next request that wants them and need no invalidation.
@@ -322,3 +337,22 @@ fn closing_uri(notification: &Notification) -> Option<Uri> {
fn folder_paths(folders: &[WorkspaceFolder]) -> Vec<std::path::PathBuf> {
folders.iter().filter_map(|folder| crate::uri::uri_to_path(&folder.uri)).collect()
}
/// What `lucisv.lint.waivers` names that could not be used: a file that is not
/// there, or a directive that does not parse.
///
/// Read here rather than trusted, because a path is not something a settings
/// parser can validate: only opening the file says whether it exists. The
/// files are read again by the lint pass that actually applies them — a few
/// small files beside a parse and an analysis — which keeps one reader for
/// both and no cache to go stale when the user edits a waiver file.
fn waiver_problems(
settings: &settings::ClientSettings,
roots: &[std::path::PathBuf],
) -> Vec<String> {
if settings.lint_waivers.is_empty() {
return Vec::new();
}
let paths = lint::waiver_paths(settings, roots, &lucisv_core::config::FileConfig::default());
lint::external_waivers(&paths).1
}
+49 -2
View File
@@ -202,6 +202,16 @@ pub struct ClientSettings {
/// One line per refused `lucisv.lint.options` entry, ready for a
/// `window/logMessage`. Empty for a settings push that was all valid.
pub lint_option_warnings: Vec<String>,
/// `lucisv.lint.waivers`: external waiver files, each absolute or relative
/// to the first workspace root — the editor's spelling of
/// `lucisv check --waiver-file` and of `waivers` under `[lint]` in a
/// `lucisv.toml`. They **add** to whatever that table names.
///
/// The paths are taken as written and nothing is read here: whether a file
/// exists and whether its directives parse is answered where the files are
/// read (`lint::external_waivers`), and reported once through the log when
/// this value arrives.
pub lint_waivers: Vec<String>,
}
/// The settings a client that said nothing is treated as having asked for.
@@ -232,6 +242,7 @@ impl Default for ClientSettings {
lint_rules: BTreeMap::new(),
lint_options: RuleOptions::new(),
lint_option_warnings: Vec::new(),
lint_waivers: Vec::new(),
}
}
}
@@ -246,8 +257,14 @@ fn every_class_on() -> BTreeMap<Severity, bool> {
///
/// Its only use is equality — the server compares it across a settings change
/// to decide whether every open file must be published again.
pub type LintSelection =
(Vec<String>, Vec<String>, BTreeMap<Severity, bool>, BTreeMap<String, bool>, RuleOptions);
pub type LintSelection = (
Vec<String>,
Vec<String>,
BTreeMap<Severity, bool>,
BTreeMap<String, bool>,
RuleOptions,
Vec<String>,
);
/// The lint settings of `settings`, as one comparable value.
///
@@ -262,6 +279,9 @@ pub fn lint_selection(settings: &ClientSettings) -> LintSelection {
settings.lint_severity.clone(),
settings.lint_rules.clone(),
settings.lint_options.clone(),
// A waiver file added or dropped changes which findings survive, so it
// republishes for exactly the reason a changed option does.
settings.lint_waivers.clone(),
)
}
@@ -342,6 +362,9 @@ pub fn from_payload(settings: &Value) -> ClientSettings {
lint_rules: rule_toggles(lint.and_then(|l| l.get("rules"))),
lint_options: options,
lint_option_warnings: warnings,
// Paths, not rule names: nothing to validate against the registry, and
// a path that names nothing is reported when the file is read.
lint_waivers: strings(lint.and_then(|l| l.get("waivers"))),
}
}
@@ -957,6 +980,30 @@ mod tests {
assert_eq!(found.max_file_size, DEFAULT_MAX_FILE_SIZE);
}
/// `lucisv.lint.waivers` is a list of paths, taken as written: this module
/// has no filesystem to check them against, and whether a file exists or
/// parses is answered where it is read. TODO §39.
#[test]
fn the_waivers_setting_is_a_list_of_paths_taken_as_written() {
let found = settings(json!({"lucisv": {"lint": {
"waivers": ["project.waiver", "/abs/other.waiver", 7, null]
}}}));
assert_eq!(found.lint_waivers, vec!["project.waiver", "/abs/other.waiver"]);
assert!(settings(json!({"lucisv": {"lint": {}}})).lint_waivers.is_empty());
// Wrong-typed altogether: the whole list is "no opinion", never a
// guess, exactly as `select` and `exclude` are.
for bad in [json!("project.waiver"), json!(3), json!(null), json!({"a": 1})] {
assert!(
settings(json!({"lucisv": {"lint": {"waivers": bad}}})).lint_waivers.is_empty(),
"waivers {bad} must be ignored"
);
}
// A changed list republishes, for the reason a changed option does.
let one = settings(json!({"lucisv": {"lint": {"waivers": ["a.waiver"]}}}));
let two = settings(json!({"lucisv": {"lint": {"waivers": ["b.waiver"]}}}));
assert_ne!(lint_selection(&one), lint_selection(&two));
}
/// A settings payload with no options object is exactly today's
/// behaviour: every rule reads its own default.
#[test]
+20
View File
@@ -625,6 +625,15 @@ impl Workspace {
!self.roots.is_empty()
}
/// The workspace folders, in the order the client named them.
///
/// The first one is what a relative path in a setting is resolved against,
/// which is what [`Workspace::filelist_path`] does inline and what
/// `lucisv.lint.waivers` needs too.
pub fn roots(&self) -> &[PathBuf] {
&self.roots
}
/// The directories the folder scope walks: every directory a buffer has
/// been opened from this session, each raised `lucisv.index.scopeDepth`
/// levels. **Empty when the folder scope is not the active rung** — a
@@ -1797,6 +1806,17 @@ impl Workspace {
Some(view)
}
/// The files the view cache is holding, newest first.
///
/// Test-only, and it exists for one question: whether an answer read a
/// file at all. A `Location` computed from the index alone must leave this
/// empty, which is the whole point of `locate::definition_location` — see
/// `docs/features/lazy-code-action/README.md`.
#[cfg(test)]
pub(crate) fn held_views(&self) -> Vec<PathBuf> {
self.views.borrow().iter().map(|view| view.path.clone()).collect()
}
/// The held view for `path`, moved to the front so the bounds below drop
/// whatever has gone longest unused.
fn cached_view(&self, path: &Path) -> Option<Rc<FileView>> {
+6 -2
View File
@@ -4,7 +4,7 @@
use lsp_types::{Location, SymbolInformation, SymbolKind as LspKind};
use vlog_semantic::{Symbol, SymbolKind};
use crate::locate::location;
use crate::locate::definition_location;
use crate::state::{Document, Workspace, WORKSPACE_SYMBOL_LIMIT};
/// How a declaration reads in hover text.
@@ -129,7 +129,11 @@ pub fn workspace_symbols(ws: &Workspace, query: &str) -> Vec<SymbolInformation>
.take(WORKSPACE_SYMBOL_LIMIT)
.filter_map(|hit| {
let path = index.path(hit.def.file)?;
let location: Location = location(ws, path, hit.def.name_span)?;
// A unit's range is in the index; a member's is not, and falls
// back to the file read. `workspace/symbol` answers up to
// `WORKSPACE_SYMBOL_LIMIT` hits at once, so this is the request
// the index-carried positions matter most to.
let location: Location = definition_location(ws, path, hit.def)?;
// `deprecated` is a deprecated protocol field that is still a
// named field of the struct.
#[allow(deprecated)]
+181
View File
@@ -1484,6 +1484,106 @@ fn a_port_code_action_and_the_port_commands_round_trip_over_the_wire() {
);
assert!(conditional["result"].is_null(), "a refusal carries no edits: {conditional:#?}");
// 7. The client above sent `"capabilities":{}`, so every action came back
// complete — which is the whole of the no-resolveSupport contract.
assert!(port_action["data"].is_null(), "nothing to resolve for this client: {port_action:#?}");
let _ = std::fs::remove_dir_all(&dir);
}
#[test]
fn a_client_that_resolves_is_offered_the_port_action_without_its_edit() {
// The lazy half of the same feature (TODO §37.1): a client that declares
// `codeAction.resolveSupport.properties: ["edit"]` is offered the action
// with `data` and no `edit`, and gets the edit from `codeAction/resolve`.
// Only an e2e test can check that the `data` really survives the round
// trip through the client — it is opaque JSON the server never sees again
// until the client hands it back.
let dir = temp_dir("resolve");
let sub = dir.join("sub.sv");
std::fs::write(&sub, PORTS_SUB).expect("write");
let top = dir.join("top.sv");
std::fs::write(&top, PORTS_TOP).expect("write");
let root = format!("file://{}", dir.display());
let top_uri = format!("file://{}", top.display());
let session = [
frame(&format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"initialize","params":{{"processId":null,"rootUri":"{root}","capabilities":{{"textDocument":{{"codeAction":{{"resolveSupport":{{"properties":["edit"]}}}}}}}}}}}}"#
)),
frame(r#"{"jsonrpc":"2.0","method":"initialized","params":{}}"#),
frame(&format!(
r#"{{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{{"textDocument":{{"uri":"{top_uri}","languageId":"systemverilog","version":1,"text":{}}}}}}}"#,
serde_json::to_string(PORTS_TOP).expect("json")
)),
// The cursor on `u_sub`, whose instantiation is missing `.rst`.
frame(&format!(
r#"{{"jsonrpc":"2.0","id":2,"method":"textDocument/codeAction","params":{{"textDocument":{{"uri":"{top_uri}"}},"range":{{"start":{{"line":2,"character":6}},"end":{{"line":2,"character":6}}}},"context":{{"diagnostics":[]}}}}}}"#
)),
frame(r#"{"jsonrpc":"2.0","id":9,"method":"shutdown","params":null}"#),
frame(r#"{"jsonrpc":"2.0","method":"exit","params":null}"#),
]
.concat();
let messages = talk(&session);
// 1. The capability says a resolve is answered.
let initialize = messages.iter().find(|m| m["id"] == 1).expect("initialize response");
let provider = &initialize["result"]["capabilities"]["codeActionProvider"];
assert_eq!(provider["resolveProvider"], true, "{provider:#?}");
// 2. The offer carries `data` and no `edit`.
let actions = messages.iter().find(|m| m["id"] == 2).expect("codeAction response");
let offered = actions["result"].as_array().expect("an array of actions");
let action = offered
.iter()
.find(|a| a["kind"] == "refactor.rewrite.lucisv.ports")
.unwrap_or_else(|| panic!("no port action in {offered:#?}"));
assert_eq!(action["title"], "lucisv: connect 1 missing port");
assert!(action["edit"].is_null(), "an offer carries no edit: {action:#?}");
assert_eq!(action["data"]["uri"], top_uri.as_str());
assert_eq!(action["data"]["title"], action["title"]);
// 3. Handing that same action back gets the edit. A second session,
// because the action has to be echoed verbatim and it is only known now.
let resolve = [
frame(&format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"initialize","params":{{"processId":null,"rootUri":"{root}","capabilities":{{"textDocument":{{"codeAction":{{"resolveSupport":{{"properties":["edit"]}}}}}}}}}}}}"#
)),
frame(r#"{"jsonrpc":"2.0","method":"initialized","params":{}}"#),
frame(&format!(
r#"{{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{{"textDocument":{{"uri":"{top_uri}","languageId":"systemverilog","version":1,"text":{}}}}}}}"#,
serde_json::to_string(PORTS_TOP).expect("json")
)),
frame(&format!(
r#"{{"jsonrpc":"2.0","id":3,"method":"codeAction/resolve","params":{}}}"#,
serde_json::to_string(action).expect("json")
)),
// ...and an action this server never offered is refused with a
// sentence rather than an empty edit.
frame(
r#"{"jsonrpc":"2.0","id":4,"method":"codeAction/resolve","params":{"title":"someone else's action"}}"#,
),
frame(r#"{"jsonrpc":"2.0","id":9,"method":"shutdown","params":null}"#),
frame(r#"{"jsonrpc":"2.0","method":"exit","params":null}"#),
]
.concat();
let messages = talk(&resolve);
let resolved = messages.iter().find(|m| m["id"] == 3).expect("resolve response");
let edits = resolved["result"]["edit"]["changes"][&top_uri]
.as_array()
.unwrap_or_else(|| panic!("no edit in {resolved:#?}"));
assert_eq!(edits.len(), 1);
assert_eq!(edits[0]["newText"], ", .rst(rst)");
assert_eq!(edits[0]["range"]["start"]["line"], 2);
assert_eq!(resolved["result"]["title"], "lucisv: connect 1 missing port");
let foreign = messages.iter().find(|m| m["id"] == 4).expect("refusal response");
assert_eq!(foreign["error"]["code"], -32803, "LSP's RequestFailed");
assert!(
foreign["error"]["message"].as_str().is_some_and(|m| m.contains("no lucisv port")),
"{foreign:#?}"
);
let _ = std::fs::remove_dir_all(&dir);
}
@@ -7442,6 +7542,87 @@ fn the_lint_options_setting_changes_what_is_published_and_a_bad_entry_is_logged(
let _ = std::fs::remove_dir_all(&dir);
}
/// `lucisv.lint.waivers` over the wire — TODO §39.
///
/// Four claims a unit test cannot make: that a `[lint] waivers` in a checked-in
/// `lucisv.toml` suppresses a finding the editor would otherwise draw; that the
/// setting *adds* a second file mid-session and the squiggle goes away without
/// a reload; that a waiver file with one bad directive is dropped **line by
/// line** — the good directives still apply — and logged once; and that the
/// server never publishes an `unused-waiver` for an external waiver, because
/// it never sees a whole run.
#[test]
fn the_waivers_setting_suppresses_findings_and_a_bad_directive_is_logged() {
let dir = temp_dir("lintwaivers");
std::fs::write(dir.join("lucisv.toml"), "[lint]\nwaivers = [ \"project.waiver\" ]\n")
.expect("write");
std::fs::write(dir.join("project.waiver"), "waive --rule=no-tabs --line=2\n").expect("write");
// One good directive and one that does not parse: the good one must still
// apply, which is what "drops the line, never the file" means.
std::fs::write(
dir.join("extra.waiver"),
"waive --rule=no-tabs --line=3\nwaive --rule=no-such-rule\n",
)
.expect("write");
let file = dir.join("tabs.sv");
let text = "module tabs;\n\twire a;\n\twire b;\nendmodule\n";
std::fs::write(&file, text).expect("write");
let root = format!("file://{}", dir.display());
let uri = format!("file://{}", file.display());
let session = [
frame(&format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"initialize","params":{{"processId":null,"rootUri":"{root}","capabilities":{{}}}}}}"#
)),
frame(r#"{"jsonrpc":"2.0","method":"initialized","params":{}}"#),
frame(&format!(
r#"{{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{{"textDocument":{{"uri":"{uri}","languageId":"systemverilog","version":1,"text":{}}}}}}}"#,
serde_json::to_string(text).expect("json")
)),
// The editor's list adds to the `lucisv.toml`'s, relative to the root.
frame(
r#"{"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"lucisv":{"lint":{"waivers":["extra.waiver","gone.waiver"]}}}}}"#,
),
frame(r#"{"jsonrpc":"2.0","id":9,"method":"shutdown","params":null}"#),
frame(r#"{"jsonrpc":"2.0","method":"exit","params":null}"#),
]
.concat();
let messages = talk(&session);
let tabs: Vec<Vec<&str>> = messages
.iter()
.filter(|m| m["method"] == "textDocument/publishDiagnostics")
.filter(|m| m["params"]["uri"] == uri.as_str())
.map(|m| {
m["params"]["diagnostics"]
.as_array()
.map(|list| list.iter().filter_map(|d| d["code"].as_str()).collect())
.unwrap_or_default()
})
.collect();
assert!(tabs.len() >= 2, "one publish per state: {tabs:?}");
assert_eq!(tabs[0], vec!["no-tabs"], "the toml waived line 2, line 3 is left: {tabs:?}");
assert!(
tabs[tabs.len() - 1].is_empty(),
"the setting's good directive waived line 3 without a reload: {tabs:?}"
);
for published in &tabs {
assert!(!published.contains(&"unused-waiver"), "never from the server: {tabs:?}");
}
let logged: Vec<&str> = messages
.iter()
.filter(|m| m["method"] == "window/logMessage")
.filter_map(|m| m["params"]["message"].as_str())
.filter(|text| text.contains("lucisv.lint.waivers"))
.collect();
assert_eq!(logged.len(), 2, "the bad directive and the missing file: {logged:?}");
assert!(logged.iter().any(|line| line.contains("unknown rule")), "{logged:?}");
assert!(logged.iter().any(|line| line.contains("gone.waiver")), "{logged:?}");
let _ = std::fs::remove_dir_all(&dir);
}
/// `lucisv.instantiate` — `docs/topo.md` §2.9-19. What only an e2e test can
/// check: that the command is advertised in `initialize`, that its three
/// arguments survive the wire, and that the skeleton arrives as a
+16 -5
View File
@@ -298,20 +298,31 @@ impl<'a> Fmt<'a> {
if let Some(net) = &d.net {
docs.push(text(format!("{net} ")));
}
if let Some(delay) = &d.delay {
docs.push(text("#"));
docs.push(self.expr(delay));
docs.push(text(" "));
}
self.net_delay(d, false, &mut docs);
self.qualifier_run(&d.qualifiers, &mut docs);
if let Some(t) = self.data_type(&d.ty) {
docs.push(t);
docs.push(text(" "));
}
self.net_delay(d, true, &mut docs);
docs.push(self.declarators(&d.declarators));
concat(docs)
}
/// `#5 ` — the declaration's net delay and the space after it, but only
/// when it was written on the side of the data type `after_type` names.
/// IEEE 1800 §6.7 allows either side and lucisv prints it where the
/// source put it; moving it across the type would reorder tokens, which
/// `verify.rs` refuses.
fn net_delay(&self, d: &DataDecl, after_type: bool, docs: &mut Vec<Doc>) {
let Some(delay) = d.delay.as_ref().filter(|n| n.after_type == after_type) else {
return;
};
docs.push(text("#"));
docs.push(self.expr(&delay.expr));
docs.push(text(" "));
}
pub(super) fn port_decl(&self, d: &PortDecl) -> Doc {
let mut docs = vec![text(format!("{} ", d.dir))];
if let Some(net) = &d.net {
@@ -0,0 +1,83 @@
# TODO §38.2 — a net delay is printed on the side of the data type it was
# written on. IEEE 1800 §6.7 puts `delay3` after the type; the rest of the
# corpus puts it before. Neither spelling is normalised into the other.
# docs/features/parser-skips/README.md
module m;
wire #5 before_the_type;
wire [31:0] #0.1 after_the_type = y;
endmodule
----
module m;
wire #5 before_the_type;
wire [31:0] #0.1 after_the_type = y;
endmodule
====
# after a packed dimension, after a plain `logic`-typed net, and after a
# signing keyword — with the min:typ:max spelling of the delay itself
module m;
wire [7:0] #1 a;
wire logic #2 b;
wire signed [7:0] #(1:2:3) c;
wire #(1:2:3) signed [7:0] d;
endmodule
----
module m;
wire [7:0] #1 a;
wire logic #2 b;
wire signed [7:0] #(1:2:3) c;
wire #(1:2:3) signed [7:0] d;
endmodule
====
# the real lines: hw/vendor/pulp_riscv_dbg/tb/unused/SimDTM.sv:38-41
# (opentitan, read-only there), the §11 skip this item closes
module SimDTM (
input clk,
output [31:0] exit
);
bit r_reset;
wire #0.1 __debug_req_ready = debug_req_ready;
wire #0.1 __debug_resp_valid = debug_resp_valid;
wire [31:0] #0.1 __debug_resp_bits_resp = {30'b0, debug_resp_bits_resp};
wire [31:0] #0.1 __debug_resp_bits_data = debug_resp_bits_data;
endmodule
----
module SimDTM (input clk, output [31:0] exit);
bit r_reset;
wire #0.1 __debug_req_ready = debug_req_ready;
wire #0.1 __debug_resp_valid = debug_resp_valid;
wire [31:0] #0.1 __debug_resp_bits_resp = {30'b0, debug_resp_bits_resp};
wire [31:0] #0.1 __debug_resp_bits_data = debug_resp_bits_data;
endmodule
====
# SKIP a comment written directly in front of the `#` has no slot to be
# printed from, so `verify.rs` refuses the file rather than moving it. This
# is *pre-existing* for the before-the-type position — it behaves the same
# way with no `[7:0]` in front — and the after-the-type position inherits
# it unchanged. Recorded, not fixed: giving the delay a comment slot is a
# `comment-slots` change, not a §38 one.
module m;
wire /* c */ #5 x;
wire [7:0] /* d */ #1 z;
endmodule
----
module m;
wire /* c */ #5 x;
wire [7:0] /* d */ #1 z;
endmodule
====
# the other three gaps around a delay do have slots and round-trip
module m;
(* keep *) wire [3:0] #2 k = j;
wire #5 /* after */ x;
endmodule
----
module m;
(* keep *)
wire [3:0] #2 k = j;
wire #5 /* after */
x;
endmodule
@@ -0,0 +1,386 @@
# TODO §38.1 — two rival, bracket-balanced unit headers written across the
# arms of one `ifdef region. The whole unit is one verbatim item, so it comes
# back byte for byte apart from the block's own re-indent.
# docs/features/parser-skips/README.md
`ifdef A
interface i ();
`else
interface i ();
`endif
wire tck;
endinterface
parameter int AFTER = 1;
----
`ifdef A
interface i ();
`else
interface i ();
`endif
wire tck;
endinterface
parameter int AFTER = 1;
====
# a module spelling with a real port list and a closing label
`ifdef SYNTHESIS
module m (input a, output b);
`else
module m (input a, output b);
`endif
wire x;
endmodule : m
----
`ifdef SYNTHESIS
module m (input a, output b);
`else
module m (input a, output b);
`endif
wire x;
endmodule : m
====
# the block's *relative* layout is what survives: the whole unit is dedented
# to the item's own indent, exactly as every other verbatim block is
`ifdef A
interface i #(parameter int P = 1) ();
`else
interface i #(parameter int P = 2) ();
`endif
wire tck;
endinterface
----
`ifdef A
interface i #(parameter int P = 1) ();
`else
interface i #(parameter int P = 2) ();
`endif
wire tck;
endinterface
====
# the real file: hw/dv/sv/jtag_agent/jtag_if.sv (opentitan), the §11
# skip this item closes. Read-only there; copied here verbatim.
// Copyright lowRISC contributors (OpenTitan project).
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
// TODO(#24580): A JTAG UVM agent should configure the JTAG frequency (and not this interface)
`ifdef GATE_LEVEL
// jtag interface with default 24MHz tck for GLS
interface jtag_if #(parameter int unsigned JtagDefaultTckPeriodPs = 41_664) ();
`else
// jtag interface with default 50MHz tck for faster DV simulations
interface jtag_if #(parameter int unsigned JtagDefaultTckPeriodPs = 20_000) ();
`endif
// interface pins
wire tck;
wire trst_n;
wire tms;
wire tdi;
wire tdo;
// Is this interface being driven (through _drive_active and the clocking blocks), or is it just
// observing some signals from the wider simulation?
//
// The flag is defined as a wire with a weak pull-up. This ensures that a testbench that doesn't
// customise is_active will see the interface be driven actively, but allows a testbench that
// *does* want to customise the signal to pull it low.
wire is_active;
assign (weak0, weak1) is_active = 1'b1;
// Should this interface generate a local tck signal? To enable that, set tck_en as well as
// is_active.
bit tck_en;
// Output-enable flags for tms, tdi, tdo (which only have an effect if is_active is true). The
// default configuration enables tms and tdi, so acts as the root of the JTAG tree plus the
// "previous device in the scan chain".
bit tms_oe = 1'b1;
bit tdi_oe = 1'b1;
bit tdo_oe = 1'b0;
logic _tck_internal, _trst_n_internal, _tms_internal, _tdi_internal, _tdo_internal;
assign tck = (is_active === 1'b1) ? _tck_internal : 'z;
assign trst_n = (is_active === 1'b1) ? _trst_n_internal : 'z;
assign tms = ((is_active === 1'b1) && tms_oe) ? _tms_internal : 'z;
assign tdi = ((is_active === 1'b1) && tdi_oe) ? _tdi_internal : 'z;
assign tdo = ((is_active === 1'b1) && tdo_oe) ? _tdo_internal : 'z;
// Use negedge to drive jtag inputs because design also use posedge clock edge to sample.
clocking host_cb @(negedge tck);
default output #1ns;
output tms = _tms_internal;
output tdi = _tdi_internal;
input tdo;
endclocking
modport host_mp(clocking host_cb, output trst_n);
clocking device_cb @(posedge tck);
input tms;
input tdi;
output tdo = _tdo_internal;
endclocking
modport device_mp(clocking device_cb, input trst_n);
clocking mon_cb @(posedge tck);
input tms;
input tdi;
input tdo;
endclocking
modport mon_mp (clocking mon_cb, input trst_n);
// Signals for local tck
int unsigned _tck_period_ps = JtagDefaultTckPeriodPs;
int unsigned _clk_hi_ps, _clk_lo_ps;
assign _clk_hi_ps = _tck_period_ps / 2;
assign _clk_lo_ps = _tck_period_ps - _clk_hi_ps;
// Sets the TCK frequency.
function automatic void set_tck_period_ps(int unsigned value);
_tck_period_ps = value;
endfunction
function automatic int unsigned get_tck_period_ps();
return _tck_period_ps;
endfunction
// Wait for one TCK cycle
//
// This waits for TCK to clear and then be asserted (so is waiting for the next posedge), but
// bounds the wait by _tck_period_ps (in case the clock has stopped).
//
// Waiting for !tck, then for tck ensures that we don't get any strange races when the clock is
// enabled: no matter what the relative phase, we will definitely wait at least a half cycle.
task automatic wait_one_tck();
fork : isolation_fork begin
fork
begin
wait(!tck);
wait(tck);
end
#(_tck_period_ps * 1ps);
join_any
disable fork;
end join
endtask
// Wait for the given number of cycles of TCK
task automatic wait_tck(int cycles);
repeat (cycles) wait_one_tck();
endtask
// Start asserting a test reset through trst_n (no effect if the interface is not active)
function automatic void assert_test_reset();
_trst_n_internal <= 1'b0;
endfunction
// Clear any test reset asserted through trst_n (no effect if the interface is not active)
function automatic void clear_test_reset();
_trst_n_internal <= 1'b1;
endfunction
// Assert a test reset through trst_n (no effect if the interface is not active)
task automatic do_trst_n(int cycles = $urandom_range(5, 20));
assert_test_reset();
wait_tck(cycles);
clear_test_reset();
endtask
// Drive _tck_internal with period _tck_period_ps whenever tck_en is high. If active is true, this
// gets used to drive the tck signal.
task automatic _drive_active();
forever begin
wait(tck_en);
fork : isolation_fork begin
fork
wait(!tck_en);
forever begin
_tck_internal = 1'b1;
#(_clk_hi_ps * 1ps);
_tck_internal = 1'b0;
#(_clk_lo_ps * 1ps);
end
join_any
disable fork;
end join
end
endtask
initial begin
_tck_internal = 1'b1;
forever begin
wait(is_active === 1'b1);
fork : isolation_fork begin
fork
wait(is_active !== 1'b1);
_drive_active();
join_any
disable fork;
end join
end
end
endinterface
----
// Copyright lowRISC contributors (OpenTitan project).
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
// TODO(#24580): A JTAG UVM agent should configure the JTAG frequency (and not this interface)
`ifdef GATE_LEVEL
// jtag interface with default 24MHz tck for GLS
interface jtag_if #(parameter int unsigned JtagDefaultTckPeriodPs = 41_664) ();
`else
// jtag interface with default 50MHz tck for faster DV simulations
interface jtag_if #(parameter int unsigned JtagDefaultTckPeriodPs = 20_000) ();
`endif
// interface pins
wire tck;
wire trst_n;
wire tms;
wire tdi;
wire tdo;
// Is this interface being driven (through _drive_active and the clocking blocks), or is it just
// observing some signals from the wider simulation?
//
// The flag is defined as a wire with a weak pull-up. This ensures that a testbench that doesn't
// customise is_active will see the interface be driven actively, but allows a testbench that
// *does* want to customise the signal to pull it low.
wire is_active;
assign (weak0, weak1) is_active = 1'b1;
// Should this interface generate a local tck signal? To enable that, set tck_en as well as
// is_active.
bit tck_en;
// Output-enable flags for tms, tdi, tdo (which only have an effect if is_active is true). The
// default configuration enables tms and tdi, so acts as the root of the JTAG tree plus the
// "previous device in the scan chain".
bit tms_oe = 1'b1;
bit tdi_oe = 1'b1;
bit tdo_oe = 1'b0;
logic _tck_internal, _trst_n_internal, _tms_internal, _tdi_internal, _tdo_internal;
assign tck = (is_active === 1'b1) ? _tck_internal : 'z;
assign trst_n = (is_active === 1'b1) ? _trst_n_internal : 'z;
assign tms = ((is_active === 1'b1) && tms_oe) ? _tms_internal : 'z;
assign tdi = ((is_active === 1'b1) && tdi_oe) ? _tdi_internal : 'z;
assign tdo = ((is_active === 1'b1) && tdo_oe) ? _tdo_internal : 'z;
// Use negedge to drive jtag inputs because design also use posedge clock edge to sample.
clocking host_cb @(negedge tck);
default output #1ns;
output tms = _tms_internal;
output tdi = _tdi_internal;
input tdo;
endclocking
modport host_mp(clocking host_cb, output trst_n);
clocking device_cb @(posedge tck);
input tms;
input tdi;
output tdo = _tdo_internal;
endclocking
modport device_mp(clocking device_cb, input trst_n);
clocking mon_cb @(posedge tck);
input tms;
input tdi;
input tdo;
endclocking
modport mon_mp (clocking mon_cb, input trst_n);
// Signals for local tck
int unsigned _tck_period_ps = JtagDefaultTckPeriodPs;
int unsigned _clk_hi_ps, _clk_lo_ps;
assign _clk_hi_ps = _tck_period_ps / 2;
assign _clk_lo_ps = _tck_period_ps - _clk_hi_ps;
// Sets the TCK frequency.
function automatic void set_tck_period_ps(int unsigned value);
_tck_period_ps = value;
endfunction
function automatic int unsigned get_tck_period_ps();
return _tck_period_ps;
endfunction
// Wait for one TCK cycle
//
// This waits for TCK to clear and then be asserted (so is waiting for the next posedge), but
// bounds the wait by _tck_period_ps (in case the clock has stopped).
//
// Waiting for !tck, then for tck ensures that we don't get any strange races when the clock is
// enabled: no matter what the relative phase, we will definitely wait at least a half cycle.
task automatic wait_one_tck();
fork : isolation_fork begin
fork
begin
wait(!tck);
wait(tck);
end
#(_tck_period_ps * 1ps);
join_any
disable fork;
end join
endtask
// Wait for the given number of cycles of TCK
task automatic wait_tck(int cycles);
repeat (cycles) wait_one_tck();
endtask
// Start asserting a test reset through trst_n (no effect if the interface is not active)
function automatic void assert_test_reset();
_trst_n_internal <= 1'b0;
endfunction
// Clear any test reset asserted through trst_n (no effect if the interface is not active)
function automatic void clear_test_reset();
_trst_n_internal <= 1'b1;
endfunction
// Assert a test reset through trst_n (no effect if the interface is not active)
task automatic do_trst_n(int cycles = $urandom_range(5, 20));
assert_test_reset();
wait_tck(cycles);
clear_test_reset();
endtask
// Drive _tck_internal with period _tck_period_ps whenever tck_en is high. If active is true, this
// gets used to drive the tck signal.
task automatic _drive_active();
forever begin
wait(tck_en);
fork : isolation_fork begin
fork
wait(!tck_en);
forever begin
_tck_internal = 1'b1;
#(_clk_hi_ps * 1ps);
_tck_internal = 1'b0;
#(_clk_lo_ps * 1ps);
end
join_any
disable fork;
end join
end
endtask
initial begin
_tck_internal = 1'b1;
forever begin
wait(is_active === 1'b1);
fork : isolation_fork begin
fork
wait(is_active !== 1'b1);
_drive_active();
join_any
disable fork;
end join
end
end
endinterface
+6
View File
@@ -12,6 +12,12 @@ vlog_parser = { path = "../vlog_parser" }
# workspace crate that answers that, and it depends on `vlog_parser` alone, so
# this adds no external code — see docs/features/semantic-lints/README.md.
vlog_semantic = { path = "../vlog_semantic" }
# A waiver file's `--location` is matched exactly the way an `--exclude`
# pattern is, and that matcher is `lucisv_core::walk::is_excluded`. Depending
# on it rather than copying it is the only way the two can be *the same*
# semantics; `lucisv_core` itself has no dependencies at all, so this adds no
# external code and closes no loop — see docs/features/waiver-files/README.md.
lucisv_core = { path = "../lucisv_core" }
[dev-dependencies]
# Tests only: the .lint case harness asserts that a lint fix never produces
+47 -3
View File
@@ -39,6 +39,7 @@ mod violation;
mod visit;
mod vscode;
mod waiver;
mod waiver_file;
use std::path::PathBuf;
@@ -58,6 +59,7 @@ pub use violation::{apply_fixes, Applicability, Fix, Fixed, Violation};
pub use vlog_semantic::words;
pub use vscode::{rule_setting, severity_setting, vscode_lint_settings, RULE_CHOICES};
pub use waiver::UNUSED_WAIVER;
pub use waiver_file::{ExternalWaivers, UnusedReport, WaiverUse};
use waiver::Waivers;
@@ -74,14 +76,32 @@ pub fn run(source: &str, path: Option<PathBuf>, enabled: &[&'static dyn Rule]) -
/// The result is sorted by position, then by rule name, so two runs over the
/// same file print in the same order whatever order the registry has.
pub fn lint(ctx: &LintContext, enabled: &[&'static dyn Rule]) -> Vec<Violation> {
lint_with(ctx, enabled, &ExternalWaivers::default()).0
}
/// [`lint`] with the run's external waiver files applied too, reporting which
/// of their directives fired.
///
/// **Precedence is union**: a violation is dropped when an inline waiver *or*
/// an external one covers it, and one both cover marks both used, so neither
/// is then reported as dead. The usage half is the caller's to keep — only a
/// whole run knows whether a `--location` matched some file somewhere, which
/// is why `lucisv check` reports unused external waivers and the server does
/// not. See `docs/features/waiver-files/README.md`.
pub fn lint_with(
ctx: &LintContext,
enabled: &[&'static dyn Rule],
external: &ExternalWaivers,
) -> (Vec<Violation>, WaiverUse) {
let names: Vec<&'static str> = enabled.iter().map(|rule| rule.name()).collect();
let mut waivers = Waivers::collect(ctx);
let mut used = WaiverUse::default();
let mut found = Vec::new();
for rule in enabled {
found.extend(rule.check(ctx));
}
let mut kept = waivers.filter(ctx, found);
let mut kept = waive(ctx, &mut waivers, external, &mut used, found);
if names.contains(&UNUSED_WAIVER) {
// `unused-waiver` findings are themselves waivable, which is circular:
@@ -92,7 +112,7 @@ pub fn lint(ctx: &LintContext, enabled: &[&'static dyn Rule]) -> Vec<Violation>
loop {
let before = waivers.used_count();
let unused = waivers.unused(&names);
let surviving = waivers.filter(ctx, unused);
let surviving = waive(ctx, &mut waivers, external, &mut used, unused);
if waivers.used_count() == before {
kept.extend(surviving);
break;
@@ -104,7 +124,31 @@ pub fn lint(ctx: &LintContext, enabled: &[&'static dyn Rule]) -> Vec<Violation>
(a.span.start, a.span.end, a.rule).cmp(&(b.span.start, b.span.end, b.rule))
});
stamp_severities(&mut kept);
kept
(kept, used)
}
/// The violations neither an inline waiver nor an external one covers.
///
/// Both are always asked — never `||` short-circuited — because a violation
/// two waivers cover has to mark both of them used.
fn waive(
ctx: &LintContext,
inline: &mut Waivers,
external: &ExternalWaivers,
used: &mut WaiverUse,
violations: Vec<Violation>,
) -> Vec<Violation> {
let path = ctx.path();
violations
.into_iter()
.filter(|violation| {
let (line, _) = ctx.line_index().line_col(violation.span.start);
let inline_waived = inline.covers(violation.rule, line);
let external_waived =
!external.is_empty() && external.covers(path, violation.rule, line, used);
!(inline_waived || external_waived)
})
.collect()
}
/// Gives every finding the class its rule declares.
+14 -20
View File
@@ -113,26 +113,20 @@ impl Waivers {
Waivers { entries }
}
/// Drops the violations a waiver covers, marking those waivers used.
pub(crate) fn filter(
&mut self,
ctx: &LintContext,
violations: Vec<Violation>,
) -> Vec<Violation> {
violations
.into_iter()
.filter(|violation| {
let (line, _) = ctx.line_index().line_col(violation.span.start);
let mut waived = false;
for entry in &mut self.entries {
if entry.rule == violation.rule && entry.scope.covers(line) {
entry.used = true;
waived = true;
}
}
!waived
})
.collect()
/// True when some waiver covers `rule` at `line`, marking every waiver
/// that does used.
///
/// Every one, not the first: a finding two waivers cover has both of them
/// doing their job, and reporting the second as dead would be a lie.
pub(crate) fn covers(&mut self, rule: &str, line: u32) -> bool {
let mut waived = false;
for entry in &mut self.entries {
if entry.rule == rule && entry.scope.covers(line) {
entry.used = true;
waived = true;
}
}
waived
}
/// How many waivers have suppressed something so far. Grows only, which
+570
View File
@@ -0,0 +1,570 @@
//! External waiver files: Verible's `waive` directives, written in a file of
//! their own rather than in a comment in the RTL.
//!
//! Grammar (Verible's, so an existing `.waiver` file carries over unchanged) —
//! one directive per line, `#` comments and blank lines ignored:
//!
//! ```text
//! waive --rule=<rule> every line of every file
//! waive --rule=<rule> --line=12 one line
//! waive --rule=<rule> --line=12-20 a range, both ends included
//! waive --rule=<rule> --location=legacy_top.sv the files that pattern names
//! ```
//!
//! The one deliberate difference from Verible: `--location` is **not** a
//! regular expression. It is matched exactly the way an `--exclude` pattern is
//! ([`lucisv_core::walk::is_excluded`]), so a pattern means one thing across
//! the whole tool; a pattern that looks like a regex is refused with a message
//! saying so rather than silently matching nothing.
//!
//! Precedence is **union** with the inline waivers of `waiver.rs`: a violation
//! is suppressed when either covers it, and a violation both cover marks both
//! used. See `docs/features/waiver-files/README.md`.
use std::path::{Path, PathBuf};
use vlog_parser::span::TextRange;
use crate::registry::rule_by_name;
use crate::severity::Severity;
use crate::violation::Violation;
use crate::waiver::UNUSED_WAIVER;
/// Every external waiver of one run, from any number of files.
#[derive(Default)]
pub struct ExternalWaivers {
sources: Vec<Source>,
directives: Vec<Directive>,
}
/// One waiver file that was read. Its text is kept because an unused
/// directive is reported at the line it was written on, and only the text
/// turns that directive's span into a line and a column.
struct Source {
path: PathBuf,
text: String,
}
/// One `waive` directive.
struct Directive {
/// Index into [`ExternalWaivers::sources`].
source: usize,
/// The directive's own line, where an `unused-waiver` finding points.
span: TextRange,
/// The rule waived; always a name the registry knows.
rule: String,
/// `--line`: 1-based, both ends included. `None` is the whole file.
lines: Option<(u32, u32)>,
/// `--location`: an `--exclude` pattern. `None` is every file.
location: Option<String>,
}
/// Which external waivers have suppressed something.
///
/// One run's worth: the CLI lints its files in parallel and merges what each
/// one used, because a `--location` pattern may cover files linted on several
/// workers. Usage only ever grows.
#[derive(Debug, Default, Clone)]
pub struct WaiverUse {
used: Vec<bool>,
}
impl WaiverUse {
/// Folds another pass's usage into this one.
pub fn merge(&mut self, other: &WaiverUse) {
if self.used.len() < other.used.len() {
self.used.resize(other.used.len(), false);
}
for (slot, fired) in self.used.iter_mut().zip(&other.used) {
*slot |= *fired;
}
}
fn mark(&mut self, index: usize) {
if self.used.len() <= index {
self.used.resize(index + 1, false);
}
self.used[index] = true;
}
fn fired(&self, index: usize) -> bool {
self.used.get(index).copied().unwrap_or(false)
}
}
/// One waiver file's dead directives, ready to be reported: the file, its
/// text — for the line and column — and one finding each.
pub struct UnusedReport {
/// The waiver file the directives were written in.
pub path: PathBuf,
/// That file's text.
pub text: String,
/// One `unused-waiver` violation per directive that suppressed nothing.
pub violations: Vec<Violation>,
}
impl ExternalWaivers {
/// Reads one waiver file: the directives that parsed, and one
/// `<file>:<line>: message` per line that did not.
///
/// A file that cannot be read at all is the `Err`; a file that reads and
/// has bad lines is an `Ok` carrying both halves, so a front end may
/// choose between failing the run (the CLI) and dropping the line and
/// logging it (the server).
pub fn read(path: &Path) -> Result<(ExternalWaivers, Vec<String>), String> {
let text = std::fs::read_to_string(path).map_err(|e| format!("{}: {e}", path.display()))?;
Ok(ExternalWaivers::parse(path, &text))
}
/// [`ExternalWaivers::read`] over text already in hand.
pub fn parse(path: &Path, text: &str) -> (ExternalWaivers, Vec<String>) {
let source = Source { path: path.to_path_buf(), text: text.to_string() };
let mut waivers = ExternalWaivers { sources: vec![source], directives: Vec::new() };
let mut problems = Vec::new();
// `split_inclusive` rather than `lines`, so the offsets stay right in
// a file with CRLF endings: `lines` drops bytes this has to count.
let mut offset: u32 = 0;
for (index, raw) in text.split_inclusive('\n').enumerate() {
let trimmed = raw.trim_end_matches(['\n', '\r']);
let span = TextRange::new(offset, offset + trimmed.len() as u32);
offset += raw.len() as u32;
// A BOM is not a directive, and an editor that writes one should
// not turn the first line into an error naming an invisible byte.
let line = trimmed.trim().trim_start_matches('\u{feff}');
if line.is_empty() || line.starts_with('#') {
continue;
}
match parse_directive(line, span) {
Ok(directive) => waivers.directives.push(directive),
Err(problem) => {
problems.push(format!("{}:{}: {problem}", path.display(), index + 1))
}
}
}
(waivers, problems)
}
/// Adds another file's directives to these.
pub fn absorb(&mut self, other: ExternalWaivers) {
let offset = self.sources.len();
self.sources.extend(other.sources);
self.directives.extend(other.directives.into_iter().map(|mut directive| {
directive.source += offset;
directive
}));
}
/// True when no waiver file contributed a directive — the everyday case,
/// and the one the linter must pay nothing for.
pub fn is_empty(&self) -> bool {
self.directives.is_empty()
}
/// True when some directive waives this finding, marking every directive
/// that does used.
///
/// Every one, not the first: a finding two waivers cover has both of them
/// doing their job, and reporting the second as dead afterwards would be a
/// lie.
pub(crate) fn covers(
&self,
path: Option<&Path>,
rule: &str,
line: u32,
used: &mut WaiverUse,
) -> bool {
let mut waived = false;
for (index, directive) in self.directives.iter().enumerate() {
if directive.covers(path, rule, line) {
used.mark(index);
waived = true;
}
}
waived
}
/// The `unused-waiver` findings for directives that suppressed nothing,
/// grouped by the file they were written in.
///
/// `enabled` is every rule the run had switched on. A waiver for a rule
/// that never ran is silent, exactly as an inline one is — it never had a
/// chance to fire — and so is everything here when `unused-waiver` itself
/// is off.
pub fn unused(&self, used: &WaiverUse, enabled: &[&'static str]) -> Vec<UnusedReport> {
if !enabled.contains(&UNUSED_WAIVER) {
return Vec::new();
}
let severity = rule_by_name(UNUSED_WAIVER).map_or(Severity::Style, |rule| rule.severity());
let mut reports: Vec<UnusedReport> = self
.sources
.iter()
.map(|source| UnusedReport {
path: source.path.clone(),
text: source.text.clone(),
violations: Vec::new(),
})
.collect();
for (index, directive) in self.directives.iter().enumerate() {
if used.fired(index) || !enabled.contains(&directive.rule.as_str()) {
continue;
}
let message = format!("unused waiver for `{}`", directive.rule);
let mut violation = Violation::new(UNUSED_WAIVER, message, directive.span);
// Built outside `lint`, which is what stamps every other finding.
violation.severity = severity;
if let Some(report) = reports.get_mut(directive.source) {
report.violations.push(violation);
}
}
reports.retain(|report| !report.violations.is_empty());
reports
}
}
impl Directive {
/// True when this directive waives `rule` at `line` of `path`.
///
/// A buffer with no path (stdin) is covered by a directive with no
/// `--location` and by no other: a pattern cannot match a name that does
/// not exist.
fn covers(&self, path: Option<&Path>, rule: &str, line: u32) -> bool {
if self.rule != rule {
return false;
}
if let Some((start, end)) = self.lines {
if line < start || end < line {
return false;
}
}
match &self.location {
None => true,
Some(pattern) => path.is_some_and(|path| {
lucisv_core::walk::is_excluded(path, std::slice::from_ref(pattern))
}),
}
}
}
/// One directive line: its rule, its line range and its location pattern.
///
/// `span` is that line's own range in the waiver file, carried into the
/// directive so an unused one can be reported where it was written. The
/// source index is filled in by [`ExternalWaivers::absorb`].
fn parse_directive(line: &str, span: TextRange) -> Result<Directive, String> {
let mut words = line.split_whitespace();
// The line was trimmed and is not empty, so there is a first word.
let keyword = words.next().unwrap_or_default();
if keyword != "waive" {
return Err(format!("expected a `waive` directive, found `{keyword}`"));
}
let mut rule: Option<String> = None;
let mut lines: Option<(u32, u32)> = None;
let mut location: Option<String> = None;
for word in words {
let (flag, value) = split_flag(word)?;
match flag {
"--rule" => set_once(&mut rule, flag, parse_rule(value)?)?,
"--line" => set_once(&mut lines, flag, parse_lines(value)?)?,
_ => set_once(&mut location, flag, parse_location(value)?)?,
}
}
let rule = rule.ok_or("`waive` needs a `--rule=<rule-name>`")?;
Ok(Directive { source: 0, span, rule, lines, location })
}
/// Fills a slot the directive may only fill once.
fn set_once<T>(slot: &mut Option<T>, flag: &str, value: T) -> Result<(), String> {
if slot.is_some() {
return Err(format!("`{flag}` is given twice"));
}
*slot = Some(value);
Ok(())
}
/// The `--flag=value` one word of a directive is.
fn split_flag(word: &str) -> Result<(&str, &str), String> {
let (flag, value) = word.split_once('=').unwrap_or((word, ""));
match flag {
"--rule" | "--line" | "--location" => {}
// Verible's third matcher waives by the *text* of the line, which
// needs the regex engine lucisv deliberately does not have.
"--regex" => {
return Err("`--regex` is not supported; waive by `--line` or `--location`".to_string())
}
other => {
return Err(format!(
"unknown option `{other}` (the options are `--rule`, `--line` and `--location`)"
))
}
}
if !word.contains('=') {
return Err(format!("`{flag}` takes a value: write `{flag}=<value>`"));
}
if value.is_empty() {
return Err(format!("`{flag}` has an empty value"));
}
Ok((flag, value))
}
/// A `--rule` value: one rule the registry knows.
///
/// A severity word is refused rather than expanded. `--select style` turns a
/// whole class on for a run the user is watching; a waiver file is checked in,
/// and one word there quietly silencing every style rule in the project is not
/// a thing anyone should be able to write by accident.
fn parse_rule(value: &str) -> Result<String, String> {
if rule_by_name(value).is_some() {
return Ok(value.to_string());
}
if Severity::from_name(value).is_some() {
return Err(format!(
"`--rule={value}` names a severity class; a waiver names one rule at a time"
));
}
Err(format!("unknown rule `{value}`"))
}
/// A `--line` value: `N` or `N-M`, 1-based, both ends included.
fn parse_lines(value: &str) -> Result<(u32, u32), String> {
let malformed =
|| format!("`--line={value}` is not a line or a line range (`--line=5`, `--line=5-9`)");
let (start, end) = value.split_once('-').unwrap_or((value, value));
let start: u32 = start.parse().map_err(|_| malformed())?;
let end: u32 = end.parse().map_err(|_| malformed())?;
if start == 0 {
return Err(format!("`--line={value}` starts at 0; lines are numbered from 1"));
}
if end < start {
return Err(format!("`--line={value}` counts backwards"));
}
Ok((start, end))
}
/// A `--location` value: an `--exclude` pattern, never a regex.
fn parse_location(value: &str) -> Result<String, String> {
match regex_hint(value) {
Some(found) => Err(format!(
"`--location={value}` looks like a regular expression (`{found}`); lucisv matches a \
location the way `--exclude` does — `*` stands for any run of characters within one \
path component, a pattern with `/` matches a path suffix and one without matches the \
file name, and nothing else is a metacharacter"
)),
None => Ok(value.to_string()),
}
}
/// The first regex metacharacter in a pattern, if it has one.
///
/// A bare `.` is not one: `foo.sv` is a file name. `.*` and `.+` are, and so
/// is every character that means nothing in a glob and something in a regex.
fn regex_hint(pattern: &str) -> Option<String> {
for token in [".*", ".+"] {
if pattern.contains(token) {
return Some(token.to_string());
}
}
pattern.chars().find(|c| "\\^$[]()|?+{}".contains(*c)).map(|c| c.to_string())
}
#[cfg(test)]
mod tests {
use super::*;
fn waivers(text: &str) -> (ExternalWaivers, Vec<String>) {
ExternalWaivers::parse(Path::new("project.waiver"), text)
}
/// The one problem `text` produces, without the `file:line: ` prefix.
fn problem(text: &str) -> String {
let (waivers, problems) = waivers(text);
assert!(waivers.is_empty(), "a bad line contributes no directive");
assert_eq!(problems.len(), 1, "{problems:?}");
problems[0].split_once(": ").expect("a `file:line: message`").1.to_string()
}
/// Whether the file's directives waive `rule` at `line` of `path`.
fn covered(text: &str, path: Option<&str>, rule: &str, line: u32) -> bool {
let (waivers, problems) = waivers(text);
assert!(problems.is_empty(), "{problems:?}");
let mut used = WaiverUse::default();
waivers.covers(path.map(Path::new), rule, line, &mut used)
}
#[test]
fn every_directive_shape_parses() {
let (waivers, problems) = waivers(
"# a comment\n\
\n\
waive --rule=no-tabs\n\
waive --rule=no-tabs --line=12\n\
waive --rule=no-tabs --line=12-20\n\
waive --rule=no-tabs --location=legacy.sv\n\
\x20 waive --rule=no-tabs --line=3 --location=rtl/legacy.sv\n\
waive --location=a.sv --rule=no-tabs\n",
);
assert!(problems.is_empty(), "{problems:?}");
assert_eq!(waivers.directives.len(), 6);
assert_eq!(waivers.directives[1].lines, Some((12, 12)));
assert_eq!(waivers.directives[2].lines, Some((12, 20)));
assert_eq!(waivers.directives[3].location.as_deref(), Some("legacy.sv"));
}
#[test]
fn crlf_line_endings_do_not_shift_a_directives_span() {
let (waivers, problems) = waivers("# note\r\nwaive --rule=no-tabs\r\n");
assert!(problems.is_empty(), "{problems:?}");
let span = waivers.directives[0].span;
assert_eq!(span.start as usize, "# note\r\n".len());
assert_eq!(span.end as usize, "# note\r\nwaive --rule=no-tabs".len());
}
#[test]
fn every_error_names_the_file_the_line_and_the_difference() {
let (_, problems) = waivers("waive --rule=no-such-rule\n");
assert_eq!(problems[0], "project.waiver:1: unknown rule `no-such-rule`");
assert_eq!(problem("waive\n"), "`waive` needs a `--rule=<rule-name>`");
assert_eq!(problem("waive --line=3\n"), "`waive` needs a `--rule=<rule-name>`");
assert!(problem("skip --rule=no-tabs\n").contains("found `skip`"));
assert!(problem("waive --rule=style\n").contains("names a severity class"));
assert!(problem("waive --rule=no-tabs --line=0\n").contains("numbered from 1"));
assert!(problem("waive --rule=no-tabs --line=9-5\n").contains("counts backwards"));
assert!(problem("waive --rule=no-tabs --line=x\n").contains("is not a line or a line"));
assert!(problem("waive --rule=no-tabs --line=5-\n").contains("is not a line or a line"));
assert!(problem("waive --rule=no-tabs --rule=no-tabs\n").contains("given twice"));
assert!(problem("waive --rule=no-tabs --lines=3\n").contains("unknown option `--lines`"));
assert!(problem("waive --rule=no-tabs --regex=x\n").contains("`--regex` is not supported"));
assert!(problem("waive --rule\n").contains("takes a value"));
assert!(problem("waive --rule=\n").contains("empty value"));
assert!(problem("waive --rule=no-tabs --location=x --location=y\n").contains("twice"));
}
#[test]
fn a_regex_looking_location_is_refused_and_a_glob_is_not() {
for pattern in [".*_pkg.sv", "top\\.sv", "^a.sv$", "(a|b).sv", "a?.sv", "a+.sv", "[ab].sv"]
{
let text = format!("waive --rule=no-tabs --location={pattern}\n");
let message = problem(&text);
assert!(message.contains("looks like a regular expression"), "{pattern}: {message}");
assert!(message.contains("`--exclude`"), "{pattern}: {message}");
}
for pattern in ["a.sv", "*_gen.sv", "rtl/*.sv", "legacy/top.sv", "*"] {
let text = format!("waive --rule=no-tabs --location={pattern}\n");
let (_, problems) = waivers(&text);
assert!(problems.is_empty(), "{pattern}: {problems:?}");
}
}
#[test]
fn a_directive_with_no_line_and_no_location_covers_everything() {
let text = "waive --rule=no-tabs\n";
assert!(covered(text, Some("rtl/a.sv"), "no-tabs", 1));
assert!(covered(text, Some("elsewhere/b.sv"), "no-tabs", 900));
assert!(covered(text, None, "no-tabs", 1), "a stdin buffer too");
assert!(!covered(text, Some("rtl/a.sv"), "no-trailing-whitespace", 1), "another rule");
}
#[test]
fn a_line_covers_itself_and_a_range_covers_both_ends() {
let one = "waive --rule=no-tabs --line=12\n";
assert!(covered(one, Some("a.sv"), "no-tabs", 12));
assert!(!covered(one, Some("a.sv"), "no-tabs", 11));
assert!(!covered(one, Some("a.sv"), "no-tabs", 13));
let range = "waive --rule=no-tabs --line=12-14\n";
for line in [12, 13, 14] {
assert!(covered(range, Some("a.sv"), "no-tabs", line), "line {line}");
}
assert!(!covered(range, Some("a.sv"), "no-tabs", 11));
assert!(!covered(range, Some("a.sv"), "no-tabs", 15));
}
/// The `--exclude` semantics, at the waiver file's end of them: a pattern
/// without `/` matches the file name at any depth, one with `/` matches a
/// path suffix, and `*` stays inside one component.
#[test]
fn a_location_matches_the_way_an_exclude_pattern_does() {
let by_name = "waive --rule=no-tabs --location=legacy.sv\n";
assert!(covered(by_name, Some("a/b/legacy.sv"), "no-tabs", 1));
assert!(!covered(by_name, Some("a/b/other.sv"), "no-tabs", 1));
let by_suffix = "waive --rule=no-tabs --location=vendor/legacy.sv\n";
assert!(covered(by_suffix, Some("a/vendor/legacy.sv"), "no-tabs", 1));
assert!(!covered(by_suffix, Some("a/rtl/legacy.sv"), "no-tabs", 1));
let glob = "waive --rule=no-tabs --location=*_gen.sv\n";
assert!(covered(glob, Some("rtl/top_gen.sv"), "no-tabs", 1));
assert!(!covered(glob, Some("rtl/top.sv"), "no-tabs", 1));
// `*` does not cross a `/`, exactly as in a walk's exclude.
let anchored = "waive --rule=no-tabs --location=rtl/*.sv\n";
assert!(covered(anchored, Some("top/rtl/b.sv"), "no-tabs", 1));
assert!(!covered(anchored, Some("rtl/a/b.sv"), "no-tabs", 1));
// A buffer with no path is covered by nothing that names a location.
assert!(!covered(by_name, None, "no-tabs", 1));
}
#[test]
fn a_directive_that_fired_is_not_reported_and_one_that_did_not_is() {
let (waivers, problems) =
waivers("waive --rule=no-tabs\nwaive --rule=no-trailing-whitespace\n");
assert!(problems.is_empty(), "{problems:?}");
let enabled = ["no-tabs", "no-trailing-whitespace", UNUSED_WAIVER];
let mut used = WaiverUse::default();
assert!(waivers.covers(Some(Path::new("a.sv")), "no-tabs", 1, &mut used));
let reports = waivers.unused(&used, &enabled);
assert_eq!(reports.len(), 1, "one waiver file, one group");
assert_eq!(reports[0].path, PathBuf::from("project.waiver"));
assert_eq!(reports[0].violations.len(), 1, "only the one that never fired");
assert!(reports[0].violations[0].message.contains("no-trailing-whitespace"));
assert_eq!(reports[0].violations[0].rule, UNUSED_WAIVER);
assert_eq!(reports[0].violations[0].severity, Severity::Style, "stamped here");
// The finding points at the dead directive's own line.
assert_eq!(reports[0].violations[0].span.start as usize, "waive --rule=no-tabs\n".len());
}
#[test]
fn a_waiver_for_a_rule_the_run_did_not_enable_is_silent() {
let (waivers, _) = waivers("waive --rule=no-tabs\n");
let used = WaiverUse::default();
assert!(waivers.unused(&used, &["no-trailing-whitespace", UNUSED_WAIVER]).is_empty());
// And so is everything when `unused-waiver` itself is off.
assert!(waivers.unused(&used, &["no-tabs"]).is_empty());
}
#[test]
fn absorbing_a_second_file_keeps_each_directive_with_its_own_file() {
let (mut first, _) =
ExternalWaivers::parse(Path::new("a.waiver"), "waive --rule=no-tabs\n");
let (second, _) =
ExternalWaivers::parse(Path::new("b.waiver"), "waive --rule=no-trailing-whitespace\n");
first.absorb(second);
assert_eq!(first.directives.len(), 2);
let mut used = WaiverUse::default();
assert!(first.covers(Some(Path::new("a.sv")), "no-tabs", 1, &mut used));
let reports = first.unused(&used, &["no-tabs", "no-trailing-whitespace", UNUSED_WAIVER]);
assert_eq!(reports.len(), 1, "only the file with a dead directive: {}", reports.len());
assert_eq!(reports[0].path, PathBuf::from("b.waiver"));
}
#[test]
fn usage_merges_across_the_files_a_run_linted_in_parallel() {
let (waivers, _) = waivers(
"waive --rule=no-tabs --location=a.sv\n\
waive --rule=no-tabs --location=b.sv\n",
);
let enabled = ["no-tabs", UNUSED_WAIVER];
let mut first = WaiverUse::default();
waivers.covers(Some(Path::new("a.sv")), "no-tabs", 1, &mut first);
assert_eq!(waivers.unused(&first, &enabled)[0].violations.len(), 1, "b.sv's is dead");
let mut second = WaiverUse::default();
waivers.covers(Some(Path::new("b.sv")), "no-tabs", 1, &mut second);
first.merge(&second);
assert!(waivers.unused(&first, &enabled).is_empty(), "both fired, over two files");
}
}
+20 -2
View File
@@ -235,12 +235,30 @@ pub struct ParamDecl {
pub declarators: Vec<Declarator>,
}
/// A net delay and the side of the data type it was written on.
///
/// IEEE 1800 §6.7 puts `delay3` *after* the type —
/// `wire [31:0] #0.1 x = y;`, which is how
/// `pulp_riscv_dbg/tb/unused/SimDTM.sv:38` writes it — while the spelling
/// the rest of the corpus uses puts it between the net keyword and the type.
/// Both are read, never both at once, and printed back where they were
/// written: moving a delay across the type reorders tokens, which
/// `verify.rs` rightly refuses.
#[derive(Debug)]
pub struct NetDelay {
/// The delay itself: the `5` of `wire #5 w;`.
pub expr: Expr,
/// True when it stood between the data type and the declarators.
pub after_type: bool,
}
#[derive(Debug)]
pub struct DataDecl {
/// Net type (`wire`, `tri`, ...) if any.
pub net: Option<String>,
/// Net delay: the `5` in `wire #5 w;`
pub delay: Option<Expr>,
/// Net delay, if any: the `5` in `wire #5 w;` or the `0.1` in
/// `wire [31:0] #0.1 x = y;`.
pub delay: Option<NetDelay>,
/// Qualifiers written before the type, in source order: `var`,
/// `automatic`, `static`, `const`, and — inside a class body — `rand`,
/// `randc`, `local`, `protected`, and the `virtual [interface]` of a
+24 -6
View File
@@ -249,12 +249,7 @@ impl<'a> Parser<'a> {
break;
}
}
let delay = if net.is_some() && self.cur().is_sym("#") {
self.bump();
Some(self.parse_delay_value()?)
} else {
None
};
let before = self.parse_net_delay(net.is_some(), false)?;
// A declaration reaches here with its `virtual` already in
// `qualifiers`, so `parse_opt_data_type`'s own modport branch cannot
// fire: `virtual spi_if.tb tb_sif = sif.tb;`
@@ -265,11 +260,34 @@ impl<'a> Parser<'a> {
} else {
self.parse_opt_data_type()?
};
// IEEE 1800 §6.7 writes the delay *here*, after the data type
// (`wire [31:0] #0.1 x = y;`, `pulp_riscv_dbg/tb/unused/SimDTM.sv:38`);
// everything else in the corpus writes it before. Either is read and
// printed back where it stood, but a declaration with one on each
// side is not a shape the LRM has.
let after = self.parse_net_delay(net.is_some(), true)?;
let delay = match (before, after) {
(Some(_), Some(_)) => {
return self.error("a net delay is written before or after the type, not both")
}
(before, after) => before.or(after),
};
let declarators = self.parse_declarators()?;
self.expect_sym(";")?;
Ok(DataDecl { net, delay, qualifiers, ty, declarators })
}
/// The net delay at the cursor, if one is written there: `#5`, `#0.1`,
/// `#(1:2:3)`. Only a net declaration may carry one, so `is_net` gates
/// the whole read — a `#` anywhere else belongs to whoever comes next.
fn parse_net_delay(&mut self, is_net: bool, after_type: bool) -> PResult<Option<NetDelay>> {
if !is_net || !self.cur().is_sym("#") {
return Ok(None);
}
self.bump();
Ok(Some(NetDelay { expr: self.parse_delay_value()?, after_type }))
}
pub(super) fn parse_port_decl(&mut self) -> PResult<PortDecl> {
let dir = self.bump().text;
let net = {
+12
View File
@@ -2,6 +2,7 @@
//! belong only to them: parameter ports, ports (ANSI and non-ANSI),
//! modports and clocking blocks.
use super::split::UnitHead;
use super::*;
/// The three pieces a `#( parameter ... )` port list yields, so module and
@@ -21,6 +22,7 @@ impl<'a> Parser<'a> {
/// one header grammar (IEEE 1800 §23.2.1, §25.3) and one body item list —
/// only the closing keyword differs, so `end_kw` is the whole difference.
pub(super) fn parse_module(&mut self, end_kw: &str) -> PResult<Module> {
let conds = self.open_conds;
let kw = self.bump().text;
let before_name = self.take_gap();
let Name { text: name, span: name_span } = self.expect_name()?;
@@ -47,8 +49,18 @@ impl<'a> Parser<'a> {
// behind it is what the module is for.
self.expect_after_recovery(";", self.recovered_since(mark))?;
let mut items = Vec::new();
let mut head = UnitHead { kw: &kw, name: &name, conds, floor: conds };
while !self.at_body_end(end_kw) {
// Two rival headers written across the arms of one `ifdef region
// are bracket-balanced, so nothing else in the grammar objects
// until this unit runs out of file looking for its `end` keyword.
// Failing here instead routes the whole unit into the split
// recovery; see `docs/features/parser-skips/README.md`.
if self.at_rival_header(&head) {
return self.error(format!("rival header for `{name}` in a conditional region"));
}
items.push(self.item_or_recover()?);
head.floor = head.floor.min(self.open_conds);
}
let dangling = self.take_dangling();
self.expect_closer(end_kw)?;
+121 -8
View File
@@ -10,8 +10,10 @@
//! The recovery is deliberately hard to reach. It fires only after a real
//! parse failure, and only when that failure is the grammar refusing a
//! `else / `elsif / `endif that closes a region which is genuinely open
//! and which the failed item did not open, with a bracket the arm left
//! open. Everything else — a plain syntax error that merely sits near a
//! and which the failed item did not open — with a bracket the arm left
//! open, or with the arm behind the directive re-writing the very header
//! the failed item began with (`docs/features/parser-skips/README.md`).
//! Everything else — a plain syntax error that merely sits near a
//! directive, a garbage token run with directives in it, an unterminated
//! region, a stray closer with nothing open — still refuses.
//! See `docs/features/directive-split/README.md`.
@@ -106,7 +108,92 @@ fn construct_end(head: &[Token]) -> ConstructEnd {
ConstructEnd::Unknown
}
/// The unit whose body a loop is reading, as [`Parser::at_rival_header`]
/// needs it.
pub(super) struct UnitHead<'h> {
/// The unit's keyword, as written: `module`, `macromodule`, `interface`
/// or `program`.
pub(super) kw: &'h str,
/// The unit's name.
pub(super) name: &'h str,
/// Item-scope conditional regions open at the unit's own first token.
pub(super) conds: u32,
/// The lowest item-scope nesting the body has reached since it started.
/// Below `conds` means the region that stood open at the header was
/// closed inside the body, so a directive at the cursor continues some
/// later region rather than that one.
pub(super) floor: u32,
}
/// The keyword that closes a unit, given its opening keyword — or `None` for
/// a keyword that opens no unit. `interface class` is a class and closes with
/// `endclass`; the caller rules it out by requiring a name after the keyword.
fn unit_end_kw(t: &Token) -> Option<&'static str> {
if t.kind != TokenKind::Keyword {
return None;
}
match t.text.as_str() {
"module" | "macromodule" => Some("endmodule"),
"interface" => Some("endinterface"),
"program" => Some("endprogram"),
_ => None,
}
}
/// True when `t` opens a unit that `close` ends. Its own test, so a unit
/// *nested* in a captured body cannot end the extent scan on its closer.
fn opens_unit(t: &Token, close: &str) -> bool {
unit_end_kw(t) == Some(close)
}
impl<'a> Parser<'a> {
/// True when the cursor stands on the `` `else `` / `` `elsif `` of a
/// region opened *before* `head` was written, and the arm behind it
/// re-writes `head`'s own keyword and name.
///
/// That is one header written twice across the arms of a region — the
/// `jtag_if.sv` shape — not a unit nested inside another one. Both
/// spellings are bracket-balanced, so nothing fails until the outer unit
/// reaches EOF looking for its closer; the body loop asks this before
/// each item instead, and fails where the evidence is.
/// See `docs/features/parser-skips/README.md`.
pub(super) fn at_rival_header(&self, head: &UnitHead) -> bool {
if !continues_conditional(self.cur()) {
return false;
}
// A region must have been open at the header, must still be the live
// one (nothing opened since is still open) and must never have been
// closed inside the body.
if head.conds == 0 || self.open_conds != head.conds || head.floor != head.conds {
return false;
}
self.nth(1).is_kw(head.kw)
&& self.nth(2).kind == TokenKind::Ident
&& self.nth(2).text == head.name
}
/// The closing keyword of the unit a rival header opened, or `None` when
/// the item that failed at `mark` is not one.
///
/// The mirror of [`Parser::at_rival_header`], read from the tokens rather
/// than from a flag on the error: [`ParseError`] is public and carries
/// only a message and a position, and every other condition of this
/// trigger is already read from the mark and the cursor — so all of the
/// evidence stays in one place and no error path can set the flag by
/// accident.
fn rival_end_kw(&self, mark: &ItemMark) -> Option<&'static str> {
let head = self.tokens.get(mark.pos)?;
let end = unit_end_kw(head)?;
let name = self.tokens.get(mark.pos + 1)?;
if name.kind != TokenKind::Ident {
return None;
}
let rival = self.nth(1).is_kw(&head.text)
&& self.nth(2).kind == TokenKind::Ident
&& self.nth(2).text == name.text;
rival.then_some(end)
}
/// Count the conditional-compilation directive standing at the cursor,
/// which the caller is about to consume as an `ItemKind::Directive`.
///
@@ -150,7 +237,9 @@ impl<'a> Parser<'a> {
err: ParseError,
) -> PResult<ItemKind> {
if self.at_split_conditional(mark) {
if let Some((end_pos, conds_after)) = self.scan_split_extent(mark) {
if let Some((end_pos, conds_after)) =
self.scan_split_extent(mark, self.rival_end_kw(mark))
{
// The block swallowed the region's own `else / `endif, which
// *are* item-scope nesting even though they now sit inside
// opaque bytes. The extent scan already worked out what they
@@ -202,9 +291,12 @@ impl<'a> Parser<'a> {
/// and ends nothing: it is broken input, and the parse error stands;
/// 3. the item's own conditional nesting is back to zero there, so the
/// live region is one opened *before* the item rather than by it;
/// 4. the arm left a bracket open, i.e. it is structurally a fragment.
/// A missing `;` leaves nothing open and is indistinguishable from a
/// typo, so it is refused.
/// 4. the arm is structurally a fragment. Two spellings qualify: it left
/// a bracket open (`(`, `[` or `{` unmatched), or it is a **unit
/// header the next arm writes again** ([`Parser::rival_end_kw`]) — a
/// header written twice is as much a fragment as an unclosed bracket,
/// and it is the only bracket-balanced shape allowed in. A missing `;`
/// leaves neither, is indistinguishable from a typo, and is refused.
fn at_split_conditional(&self, mark: &ItemMark) -> bool {
let at = self.cur();
if !continues_conditional(at) && !closes_conditional(at) {
@@ -228,7 +320,7 @@ impl<'a> Parser<'a> {
brackets -= 1;
}
}
cond == 0 && brackets > 0
cond == 0 && (brackets > 0 || self.rival_end_kw(mark).is_some())
}
/// One past the last token of the construct the split region belongs to,
@@ -248,13 +340,25 @@ impl<'a> Parser<'a> {
/// no region live is a stray closer, not a split, and gives up — the same
/// refusal the trigger makes, repeated here because the scan walks past
/// the point the trigger looked at.
fn scan_split_extent(&self, mark: &ItemMark) -> Option<(usize, u32)> {
///
/// `unit_end` is `Some(closing keyword)` for a rival unit header, whose
/// `;` closes only its *header*: the block is the whole unit, so the scan
/// runs to the matching `endmodule` / `endinterface` / `endprogram`
/// instead — counting units of the same kind on the way, so one nested in
/// the body cannot end it early. (An `interface class` nested in a
/// captured `interface` closes with `endclass`, leaves the count above
/// zero and makes the scan give up: the parse error stands, which is the
/// safe side.)
fn scan_split_extent(&self, mark: &ItemMark, unit_end: Option<&str>) -> Option<(usize, u32)> {
// Regions this scan opened, and regions that were already open when
// it started. A directive at scan level zero belongs to the latter.
let mut cond = 0i32;
let mut live = mark.conds;
let mut closed_outer = false;
let mut brackets = 0i32;
// Units of the head's kind open at `i`, counted only in `unit_end`
// mode. The head at `mark.pos` is itself the first one.
let mut units = 0i32;
let mut i = mark.pos;
while let Some(t) = self.tokens.get(i) {
if t.kind == TokenKind::Eof {
@@ -283,6 +387,15 @@ impl<'a> Parser<'a> {
if brackets < 0 {
return None;
}
} else if let Some(close) = unit_end {
if opens_unit(t, close) {
units += 1;
} else if t.is_kw(close) {
units -= 1;
if units == 0 && cond == 0 && closed_outer {
return Some((self.past_end_label(i + 1), live));
}
}
} else if t.is_sym(";") && brackets == 0 && cond == 0 && closed_outer {
return Some((i + 1, live));
}
@@ -290,3 +290,58 @@ fn a_struct_member_may_be_declared_rand() {
assert!(s.members[2].qualifiers.is_empty());
assert_eq!(s.members[0].declarators[0].name, "cpol");
}
// ------------------------------------------------------------------
// Net delays on either side of the data type (TODO §38.2,
// `docs/features/parser-skips/README.md`)
// ------------------------------------------------------------------
/// The net delay of a single-declaration module, with the side of the data
/// type it was written on.
fn net_delay_of(src: &str) -> (String, bool) {
let f = parse_ok(src);
let d = match &module_of(&f).items[0].kind {
ItemKind::DataDecl(d) => d,
_ => panic!("expected a declaration"),
};
let delay = d.delay.as_ref().expect("a net delay");
(src[delay.expr.span.as_range()].to_string(), delay.after_type)
}
#[test]
fn a_net_delay_is_read_on_either_side_of_the_data_type() {
// Before the type is what the corpus writes; after it is where IEEE
// 1800 §6.7 puts `delay3`, and where
// `pulp_riscv_dbg/tb/unused/SimDTM.sv:38` writes it.
assert_eq!(net_delay_of("module m;\n wire #5 w;\nendmodule\n"), ("5".into(), false));
assert_eq!(
net_delay_of("module m;\n wire [31:0] #0.1 x = y;\nendmodule\n"),
("0.1".into(), true)
);
// After a plain `logic`-typed net, and after a signed keyword run.
assert_eq!(net_delay_of("module m;\n wire logic #3 a;\nendmodule\n"), ("3".into(), true));
assert_eq!(
net_delay_of("module m;\n wire signed [7:0] #(1:2:3) b;\nendmodule\n"),
("(1:2:3)".into(), true)
);
// The before position is unmoved by any of it.
assert_eq!(
net_delay_of("module m;\n wire #(1:2:3) signed [7:0] c;\nendmodule\n"),
("(1:2:3)".into(), false)
);
}
#[test]
fn a_net_delay_written_on_both_sides_is_an_error() {
let msg = parse_err("module m;\n wire #5 [31:0] #6 x;\nendmodule\n");
assert!(msg.contains("before or after the type, not both"), "{msg}");
}
#[test]
fn only_a_net_declaration_reads_a_delay() {
// A variable has no `delay3`, so the `#` is not swallowed here — it is
// an ordinary syntax error, exactly as it was before either position
// was accepted.
assert!(parse_err("module m;\n logic #5 x;\nendmodule\n").contains("expected"));
assert!(parse_err("module m;\n logic [7:0] #5 x;\nendmodule\n").contains("expected"));
}
@@ -628,3 +628,158 @@ fn an_opening_split_that_is_the_last_item_does_not_eat_the_closing_keyword() {
"a directive starting a statement list is pass-through, not a split"
);
}
// ------------------------------------------------------------------
// Rival unit headers written across the arms of one region
// (`docs/features/parser-skips/README.md`)
// ------------------------------------------------------------------
/// The `jtag_if.sv` shape, in the four spellings that differ only in the
/// header: `interface`/`module`, with and without `#( ... )`, with `()` and
/// with a real port list. Every one of them is one verbatim item running
/// from the first header to the unit's own closing keyword.
#[test]
fn rival_unit_headers_across_one_region_become_one_verbatim_item() {
for (why, src, ends) in [
(
"interface, `#( ... ) ()` — hw/dv/sv/jtag_agent/jtag_if.sv:6",
"`ifdef GATE_LEVEL\n interface jtag_if #(parameter int unsigned P = 41_664) \
();\n`else\n interface jtag_if #(parameter int unsigned P = 20_000) \
();\n`endif\n wire tck;\nendinterface\nparameter int AFTER = 1;\n",
"endinterface",
),
(
"interface, no parameter list",
"`ifdef A\ninterface i ();\n`else\ninterface i ();\n`endif\n wire \
tck;\nendinterface\nparameter int AFTER = 1;\n",
"endinterface",
),
(
"module, a real port list",
"`ifdef A\nmodule m (input a, output b);\n`else\nmodule m (input a, output \
b);\n`endif\n wire x;\nendmodule\nparameter int AFTER = 1;\n",
"endmodule",
),
(
"module, a closing label",
"`ifdef A\nmodule m #(parameter int W = 1) ();\n`else\nmodule m #(parameter int W = \
2) ();\n`endif\n wire x;\nendmodule : m\nparameter int AFTER = 1;\n",
"endmodule : m",
),
] {
let f = parse_ok(src);
let kinds = split_items(&f);
assert_eq!(kinds.len(), 3, "{why}: {kinds:?}");
assert!(kinds[0].starts_with("directive:`ifdef"), "{why}: {kinds:?}");
assert_eq!(kinds[2], "param", "{why}: the item after the unit was not swallowed");
let ItemKind::Verbatim(raw) = &f.items[1].kind else { panic!("{why}: expected verbatim") };
assert_eq!(raw.text, src[raw.span.as_range()], "{why}");
assert!(raw.text.ends_with(ends), "{why}: {:?}", raw.text);
assert!(raw.text.contains("`else") && raw.text.contains("`endif"), "{why}: {:?}", raw.text);
// The whole unit is inside the block, its body included.
assert!(raw.text.contains("wire"), "{why}: {:?}", raw.text);
assert_eq!(open_conds_after(src), 0, "{why}: the region's own `endif was accounted for");
}
}
#[test]
fn rival_headers_produce_the_same_tree_in_both_modes() {
let src = "`ifdef GATE_LEVEL\n interface jtag_if #(parameter int unsigned P = 41_664) \
();\n`else\n interface jtag_if #(parameter int unsigned P = 20_000) \
();\n`endif\n wire tck;\nendinterface\n";
let strict = parse_ok(src);
let toks = tokenize(src).expect("lex error");
let (tolerant, diags) = parse_tolerant(toks, src);
assert!(diags.is_empty(), "{diags:?}");
assert_eq!(split_items(&strict), split_items(&tolerant));
}
#[test]
fn comments_written_around_a_rival_header_are_kept() {
// The real file writes a comment inside each arm and one before the
// region; none of them may be dropped.
let src = "// head\n`ifdef GATE_LEVEL // which\n // 24MHz for GLS\n interface jtag_if \
();\n`else\n // 50MHz for DV\n interface jtag_if ();\n`endif\n // pins\n wire \
tck;\nendinterface // done\n";
let f = parse_ok(src);
assert_eq!(texts(&f.items[0].meta.leading), ["// head"]);
assert_eq!(f.items[0].meta.trailing.as_ref().expect("the `ifdef's comment").text, "// which");
// The capture starts at the item's *first token*, so the comment written
// in front of the header is the item's own leading comment — the same
// place every other split puts it — and the rest are inside the block.
assert_eq!(texts(&f.items[1].meta.leading), ["// 24MHz for GLS"]);
let ItemKind::Verbatim(raw) = &f.items[1].kind else { panic!("expected a verbatim block") };
for c in ["// 50MHz for DV", "// pins"] {
assert!(raw.text.contains(c), "{c} was dropped from {:?}", raw.text);
}
assert!(!raw.text.contains("// done"), "the trailing comment was swallowed");
assert_eq!(f.items[1].meta.trailing.as_ref().expect("the comment survived").text, "// done");
}
#[test]
fn a_unit_nested_in_a_captured_body_does_not_end_the_scan_early() {
// The extent scan counts units of the head's kind, so the *inner*
// `endmodule` cannot be mistaken for the rival unit's own.
let src = "`ifdef A\nmodule m ();\n`else\nmodule m ();\n`endif\n module inner ();\n \
endmodule\n wire x;\nendmodule\nparameter int AFTER = 1;\n";
let f = parse_ok(src);
let kinds = split_items(&f);
assert_eq!(kinds.len(), 3, "{kinds:?}");
let ItemKind::Verbatim(raw) = &f.items[1].kind else { panic!("expected a verbatim block") };
assert!(raw.text.contains("module inner"), "{:?}", raw.text);
assert!(raw.text.ends_with("endmodule"), "{:?}", raw.text);
assert_eq!(kinds[2], "param", "{kinds:?}");
}
// -- the three negatives ----------------------------------------------
#[test]
fn a_second_unit_in_an_arm_of_a_region_opened_inside_the_body_is_still_an_error() {
// Two nested units, which is illegal: the region the `else belongs to
// was opened *by the body*, not before the header, so the arm is not a
// rival spelling of anything.
let msg = parse_err(
"`ifdef OUTER\nmodule m;\n`ifdef A\n wire a;\n`else\nmodule m;\n`endif\n wire \
b;\nendmodule\n",
);
assert!(msg.contains("endmodule"), "{msg}");
// The same shape with no region open at all around the outer unit.
let msg = parse_err(
"module m;\n`ifdef A\n wire a;\n`else\nmodule m;\n wire \
b;\n`endif\nendmodule\n",
);
assert!(msg.contains("endmodule"), "{msg}");
}
#[test]
fn a_different_name_after_the_else_is_not_a_rival_header() {
let msg = parse_err(
"`ifdef A\ninterface i ();\n`else\ninterface j ();\n`endif\n wire \
x;\nendinterface\n",
);
assert!(msg.contains("endinterface"), "{msg}");
// Nor is a different keyword for the same name.
let msg = parse_err(
"`ifdef A\ninterface i ();\n`else\nmodule i ();\n`endif\n wire x;\nendinterface\n",
);
assert!(msg.contains("endinterface"), "{msg}");
}
#[test]
fn a_region_closed_before_the_header_leaves_the_else_stray() {
// The region opened at the top of the file is closed before the
// interface begins, so the `else below closes nothing: broken input,
// and the parse error stands.
let msg = parse_err(
"`ifdef A\n wire a;\n`endif\ninterface i ();\n`else\n interface i ();\n`endif\n wire \
x;\nendinterface\n",
);
assert!(msg.contains("endinterface"), "{msg}");
// And a region closed *inside* the body before the `else: the header's
// region is gone, so the live one is not the one it was written under.
let msg = parse_err(
"`ifdef OUTER\ninterface i ();\n`endif\n`ifdef B\n wire a;\n`else\n interface i \
();\n`endif\nendinterface\n",
);
assert!(msg.contains("endinterface"), "{msg}");
}
+1 -1
View File
@@ -42,7 +42,7 @@ pub use instantiate::{
};
pub use ports::{
add_port, enclosing_module, may_have_port_action, port_action_modules, port_actions,
propagate_ports, remove_port, ModuleRef, PortAction,
propagate_ports, remove_port, sites_phrase, ModuleRef, PortAction,
};
pub use rename::{
contains_word, prepare_rename, prepare_rename_here, rename, rename_name_at, RenameTarget,
+6 -1
View File
@@ -236,7 +236,12 @@ pub fn enclosing_module(text: &str, offset: u32) -> Option<String> {
/// "updates 3 instantiations" / "updates 1 instantiation" / "no instantiation
/// in scope".
fn sites_phrase(sites: usize) -> String {
///
/// Public because a server may have to write the same sentence with a count of
/// its own: an offer that has not read the fan-out takes the number from its
/// workspace index instead of from the plan, and the two must not come to be
/// worded differently (`docs/features/lazy-code-action/README.md`).
pub fn sites_phrase(sites: usize) -> String {
match sites {
0 => "no instantiation in scope".to_string(),
1 => "updates 1 instantiation".to_string(),
+1 -1
View File
@@ -179,7 +179,7 @@ impl<'a> Binder<'a> {
pub(super) fn bind_data_decl(&mut self, d: &DataDecl, span: TextRange, scope: ScopeId) {
let kind = if d.net.is_some() { SymbolKind::Net } else { SymbolKind::Var };
self.bind_opt_expr(d.delay.as_ref(), scope);
self.bind_opt_expr(d.delay.as_ref().map(|n| &n.expr), scope);
self.bind_declarators(&d.declarators, kind, &d.ty, span, scope);
}
+22 -3
View File
@@ -1,5 +1,24 @@
# Verilog/SystemVerilog coverage gaps — ranked (2026-09-01)
**Reading this report today (2026-09-04).** The survey below is a historical
v0.21.0 measurement with later amendments, not a fresh list of current failures.
For the current implementation and outstanding contracts, use
[repository-analysis.md](repository-analysis.md) and [topo.md](topo.md).
Since the original survey, interface/modport and struct-member semantics,
statement/class fences, header/list recovery, rule documentation, and three
lint expansion waves have landed. The old probes were not re-run as part of
the documentation audit; their historical counts are retained.
Current follow-ups to the latest addendum: v0.40.0 recovers bare item-level
`begin` blocks as `ItemKind::GenBlock` **in tolerant mode**, so lint rules see
their contents; strict formatting still refuses them. It also improves recovery
for unclosed overrides that would consume the following instance. The
post-v0.41.0 `parser-skips` commit accepts rival conditional unit headers as
verbatim units and preserves net delays before or after the type. Its QA is
accepted; release v0.42.0 is pending. Comments immediately before a net-delay
`#` still cause a formatter verification refusal. External waiver files remain
planned, not implemented.
What lucisv 0.21.0 does not yet handle, ranked by severity, from two
independent sweeps crossed against each other:
@@ -149,8 +168,7 @@ signal named only inside a property edits it, references list it, and the
"at least identifier occurrences" fallback the C1 row asked for was
overtaken rather than built (what the grammar cannot read still rewinds to
the byte-exact capture, and rename *names* those regions instead of going
quiet). What the tables above still leave open, by weight: the second half of
M12 (`--rules-doc`, §2.9-5); L3, L6, L9 and L10. M10's error recovery inside
quiet). What the tables above still leave open, by weight: L3, L6, L9 and L10. M12's second half (`--rules-doc`, §2.9-5) was delivered by macro-word-census. M10's error recovery inside
headers and lists is closed (TODO §32), with the narrowing recorded in its
row: a truncated file reports *more* diagnostics than before, because the
constructs that now survive say what closer they are missing. M13's small
@@ -174,7 +192,8 @@ the generated truth.
Three coverage notes the wave produced, none of them a language gap:
- **`begin` where an item belongs is a parser gap, not a rule gap.** The
- **Historical parser gap, closed in tolerant mode by v0.40.0:** `begin`
where an item belongs. At the time of this addendum, the
parser refuses a module-scope `begin … end` and a bare `begin` inside a
`generate` region rather than recovering either as a block, so recovery
unwinds and the rest of that unit is lost — `module-begin-block` and
+9
View File
@@ -300,6 +300,15 @@ trigger is not too loose.
`Fmt::raw_text`'s `crosses_line_inside_string` path emits a `Doc::Text`
with embedded newlines and leaves the printer's column stale. Pre-existing
(assertions round), no corruption. See Handshakes → Consumed.
- [x] **Two of the "not done, deliberately" items above were delivered by
TODO §38.1** (2026-09-04, `docs/features/parser-skips/README.md`): a
split whose shared tail ends in a **keyword** rather than a `;`, and the
one **bracketless** shape that is not indistinguishable from a missing
terminator — a unit header the next arm writes again (`jtag_if.sv`).
`at_split_conditional`'s fourth condition now reads "bracket open **or**
rival header", and `scan_split_extent` takes the unit's closing keyword.
The rest of the bracketless family stays refused, and the inside of a
split region is still byte-for-byte.
## Work log
+573
View File
@@ -0,0 +1,573 @@
# lazy-code-action
TODO §37 — the three server residues left over from §10: the lazy
`codeAction/resolve` for the port refactorings (§37.1), the `inlayHint` zero at
the default scope (§37.2), and `locate::location` onto `DeclPositions`
(§37.3). One README, one section each.
## Goal
**§37.1.** `textDocument/codeAction` arrives on nearly every cursor move, and
the port refactorings answered it by computing the *whole* edit — over the
instantiated module's entire fan-out plus every open buffer, each file read as
text. `docs/performance_take2.md` §6a measured what that costs on opentitan:
~1.4 ms per instantiating file plus a ~13 ms floor, **185–201 ms at a 128-file
fan-out, to offer zero actions**, above §3's "reads as a hang" line, on the hot
path. The *offer* is now local — the buffer, plus the instantiated module's own
declaration when the cursor is on an instantiation — and the edit is computed
by `codeAction/resolve` when the user picks the action. A client that cannot
resolve is unaffected: it still gets the edit up front.
**§37.2.** `inlayHint` returns 0 hints at the default (folder) scope where the
workspace scope returns 4 (`performance_take2.md` §4b, §8.9), the one §4b row
the `didOpen` widen did not fix. Investigated, and it is **not a bug** — the
finding is written out below, with two tests that pin it.
**§37.3.** Every file-scope declaration's client-side range is already in the
index (`DeclPositions`, added by the design-hierarchy round), so
`textDocument/definition` and `workspace/symbol` need not read a file to
convert an indexed span. They no longer do: **27.7 µs → 0.40 µs per
definition** on opentitan.
## Assumptions
- **The offer may be optimistic; the resolve is exact.** A refusal the engine
can only see over the fan-out — an instantiation elsewhere connecting `sub`'s
ports *by position*, which makes `remove_port` refuse whole — is invisible to
a one-file offer, so the lightbulb can appear and the resolve then decline
with "the action is no longer available". This is the trade LSP's resolve
model is for; the alternative is the 185 ms. The refusals cheap enough to
keep are kept: a module the index declares twice is checked through
`WorkspaceIndex::units` before anything is offered, exactly as the eager path
refuses over the two declaring files it reads.
- **The count in an offered title comes from the index and may be one behind.**
`instantiations_of(name)` records one edge per *written statement* with its
instances, and the title counts **instances** (`sub u1(), u2();` is two), to
match what the eager title counts — the instances the plan really rewrites.
The two disagree exactly where the index cannot know: an unsaved buffer's new
instantiation, a file-scope instantiation site (which records no edge at
all), an instance connecting with `.*`. So the offered and resolved actions
are matched on the title *without* its count phrase (`ports::key`), and the
resolved action carries the exact title.
- **`Def::lines.positions` is `Some` for every file-scope declaration and
`None` for every member**, as `DeclLines` documents. §37.3 relies on that:
members keep the file-read path, which is not a fallback nobody takes — it is
the only answer a port has.
- **`codeAction/resolve` carries no `textDocument`**, so the large-file fast
path's gate — which reads a URI out of the params — never sees it. `resolve`
refuses a buffer on that fast path itself: the mode's contract is that a
large buffer is never parsed, and one stale lightbulb is not a reason to
break it.
- An **open buffer** keeps the file-read path in §37.3 whatever the index
recorded, because the buffer's text may have moved since it was indexed and
every other answer about that buffer is computed against the text it holds
now.
## Handshakes
- **`vlog_refactor` → server.** `ports::sites_phrase` is now `pub` (re-exported
from the crate root as `vlog_refactor::sites_phrase`). The server writes the
same sentence with a count of its own, and one spelling of a user-visible
string is the point. Nothing else in `vlog_refactor` changed; `port_actions`,
`port_action_modules` and `module_definition` are consumed exactly as before.
- **`Workspace` → server.** `Workspace::held_views()` added, `#[cfg(test)]`
and `pub(crate)`: the view cache is how a test asserts that an answer read no
file. No production caller.
- **`main.rs` → `server`.** `ClientAbilities` gains `code_action_resolve`, read
at `initialize` from `textDocument.codeAction.resolveSupport.properties`
containing `"edit"`. The `initialize` result advertises
`codeActionProvider.resolveProvider: true` unconditionally — the server can
always answer a resolve, including for an action that already carries its
edit, which it hands straight back.
- **The wire.** New method answered: `codeAction/resolve`. New field on an
offered port action: `data` (`{uri, position, title}`), opaque to the client.
The quick fixes in `code_action.rs` are unchanged and still complete when
offered.
## Status / TODO
- [x] §37.1 `ports::offers` — the local offer, titles counted from the index,
`data` instead of an edit.
- [x] §37.1 `ports::resolve` — today's eager answer at the offer's position,
matched on `key(title)`; `RequestFailed` with "the action is no longer
available." when nothing matches, and a distinct sentence for an action
this server never offered.
- [x] §37.1 capability gate: `code_action_resolve_support` in `main.rs`,
`ClientAbilities::code_action_resolve`, the dispatch branch.
- [x] §37.1 `resolve_provider: Some(true)` advertised; `codeAction/resolve`
dispatch arm.
- [x] §37.1 tests: the offer's menu equals the eager one over `crowded(40)`;
the offer's source set is the buffer (+ the declaring file); the resolved
edit is byte-equal to the eager one at both cursor shapes; the unsaved
buffer answered by the resolve; a stale and a closed document refused; a
foreign action refused; a complete action returned untouched; the
duplicate-declaration refusal; a buffer that grew onto the large-file
fast path; `key`'s own unit test.
- [x] §37.1 e2e over the wire, both client shapes.
- [x] §37.1 perf: the "offer" column on `perf.rs`'s
`a_code_action_at_an_instantiation_before_and_after`, plus
`ports::tests::the_offer_is_flat_where_the_eager_answer_grows`
(3/40/128 instantiators, both cursor shapes).
- [x] §37.2 investigated; finding written below; two tests at the default
scope.
- [x] §37.3 `locate::definition_location`, routed through `nav::definition`
and `symbols::workspace_symbols`.
- [x] §37.3 pins: the encoding shapes, no `file_view` created, members keep
the read, the open-buffer case.
- [x] §37.3 opentitan timing, read-only
(`locate::tests::defining_over_a_real_project`).
- [ ] Not done, deliberately: **memoising `module_sources`** per (module, index
generation), take 1's other suggestion. The offer makes it unnecessary on
the hot path — the fan-out is now read once per *click* — and a cache
keyed on a generation is a staleness question this round did not need to
open.
- [ ] Not done, deliberately: **the quick fixes stay eager.** They are built
from the buffer's own violations, which the server has already computed
for the diagnostics; there is nothing to defer.
## §37.1 — how the offer stays local
`ports::offers` runs the engine's own `port_actions` over a source set built by
`ports::offer_sources`:
1. **the buffer the request names**, from the open document (no read);
2. **the declaring file of every module `port_action_modules` named**, via
`vlog_refactor::module_definition(index, name)` — the same two steps
`inlay.rs`'s `Plans::read` takes, and one file read at most.
A cursor on a **port declaration** names its own module, whose declaring file
*is* the buffer, so that case reads nothing at all. A cursor on an
**instantiation** names the instantiated module, and its declaration is what
`propagate_ports` needs to know which connections are missing — so the offer
is exact for that action, including its "connect N missing ports" count, which
is a count of edits in the cursor's own file.
The edits `port_actions` computes over those one or two files are thrown away.
Only the titles and the kind survive, plus `data`.
`ports::resolve` re-runs `ports::code_actions` — today's eager path, unchanged
— at the offer's position and returns the action whose `key(title)` matches.
### Measured
This machine, 2026-09-04, release.
`cargo test --release -p lucisv_server perf::a_code_action -- --ignored
--nocapture --test-threads=1` — the original probe (a port of a module
instantiated in 3 of 504 files, 200 lines each), now with the offer column
TODO §37.1 asked for:
| whole workspace | fan-out (eager) | **offer** | `sources()` alone |
|---:|---:|---:|---:|
| 776 ms | 433 µs | **58 µs** | 11.5 ms |
`cargo test --release -p lucisv_server --bin lucisv-server
ports::tests::the_offer_is_flat -- --ignored --nocapture --test-threads=1` —
200 noise modules plus `n` files instantiating `sub`, the shape §6a measured
on opentitan:
| fan-out | cursor | eager | **offer** | actions |
|---:|---|---:|---:|---:|
| 3 | a port declaration | 485 µs | **68 µs** | 1 |
| 3 | an instantiation | 172 µs | **72 µs** | 0 |
| 40 | a port declaration | 4.84 ms | **53 µs** | 1 |
| 40 | an instantiation | 1.45 ms | **55 µs** | 0 |
| 128 | a port declaration | 15.0 ms | **53 µs** | 1 |
| 128 | an instantiation | 4.60 ms | **55 µs** | 0 |
The eager column grows with the fan-out and the offer column does not: 53–72 µs
at every size, both cursors (the two 3-file rows are the first measurements
taken in the process and carry that much warm-up). The two "0 actions" rows are
§6a's own complaint — a cursor on a fully-connected instantiation, where the old
path spent its whole bill to offer nothing.
## §37.2 — the `inlayHint` zero at the default scope is correct
**Finding: not a bug. `performance_take2.md` §4b's last row compares a
different question from every row above it.**
Every other row of that table asks about `aes` — `definition`, `hover`,
`signatureHelp`, `references` on the `aes` instantiation in
`hw/ip/aes/dv/tb/tb.sv`. `aes` is declared in `hw/ip/aes/rtl/aes.sv`, which the
`didOpen` widen reaches: opening `hw/ip/aes/dv/tb/tb.sv` at the shipped
`scopeDepth` of 2 raises to `hw/ip/aes`, 124 files. So those rows answer.
`inlayHint` cannot ask about `aes` at all: that instantiation's connections are
**named** (`.clk_i(clk)`), and a named connection gets no hint by design — the
reader can already see which port is which. The only positional connections in
`tb.sv` are:
```systemverilog
pins_if #($bits(lc_escalate)) lc_escalate_if (lc_escalate);
pins_if #(1) idle_if (idle);
```
Two positional parameter overrides and two positional port connections — **the
4 hints the workspace scope returns**. `pins_if` is declared in
`hw/dv/sv/common_ifs/pins_if.sv`; there is no `pins_if` anywhere under
`hw/ip/aes` (checked). So at the default scope the module is genuinely not in
the index, `vlog_refactor::module_definition` has nothing to answer with, and
`Plans::read` declines — which is the documented contract: an instantiation
whose module the index does not hold gets no hints, because guessing port names
puts a wrong name on screen with no way for the reader to tell.
`inlay.rs` uses **the same lookup its neighbours use**. `signature.rs:28` and
`completion`'s module-header tier call `vlog_refactor::module_definition` on the
same index; hover and definition go through the same overlay. Asked about
`pins_if` at the default scope, every one of them answers nothing too. There is
no lookup inlay is missing.
Two tests pin it (`inlay.rs`), on an opentitan-shaped tree — `ip/aes/rtl`,
`ip/aes/dv/tb`, and a `dv/common` beside the block:
- `the_default_scope_hints_a_module_the_didopen_widen_reached` — at the
**default** scope (no `index.scope`, `scopeDepth` 2), the instantiation of the
block's own module is hinted. The default scope hints; §4b's row is not
evidence that it does not.
- `an_out_of_scope_module_is_unhinted_exactly_as_it_is_undefined` — the
instantiation of the module outside the block gets no hints, **and**
`textDocument/definition` and hover give nothing for it either; widening to
the workspace scope makes all three answer.
For the lead: if the wanted behaviour is that a hint pulls its module's
declaration in from outside the scope, that is a *scope* change (the widen
would have to follow instantiation edges), and it would change what
`definition`, `hover` and `completion` answer at the same time. It is not an
inlay-hint fix, and it is not what this round did.
## §37.3 — `locate::definition_location`
`Def::lines.positions` holds `{name, decl}` as `Utf16Range`s, converted through
the declaring file's own `LineIndex::utf16_position` while it was indexed —
which is the very converter `convert::Positions` uses on the wire, so the two
cannot disagree. `locate::definition_location(ws, path, def)` returns the name's
range straight from there when the file has no open buffer, and falls through to
`locate::location`'s read otherwise (an open buffer, or a member, which records
no positions).
Routed through: `nav::definition`'s `Definition::External` arm and
`symbols::workspace_symbols`. `nav`'s `` `define`` arm keeps the read — a
`DefineTable` entry is not a `Def` and has no recorded positions.
### Pins
- `locate::tests::the_two_paths_agree_over_multi_byte_astral_crlf_and_a_bom` —
one file with a BOM at offset 0, CRLF endings, two- and three-byte
characters and an astral character that is two UTF-16 code units; the
index-only `Location` equals the file-read one exactly.
- `locate::tests::a_file_scope_definition_is_located_without_reading_its_file`
and `nav::tests::a_cross_file_definition_reads_no_file` — asserted through
`Workspace::held_views()`, the view cache a read would land in. Empty after
the definition and after a `workspace/symbol`; one entry after the same
question is asked the old way.
- `locate::tests::a_member_keeps_the_file_read_path` — a port records no
positions and still answers, through the read.
- `locate::tests::an_open_buffer_still_answers_from_the_buffer`.
### Measured, over opentitan, read-only
`LUCISV_PERF_CORPUS=/Users/guoliangchen/repo/opentitan cargo test --release -p
lucisv_server --bin lucisv-server locate::tests::defining -- --ignored
--nocapture --test-threads=1`, 3 976 indexed files, 200 targets (modules the
corpus instantiates, each in a different file):
| | total, 200 definitions | per definition |
|---|---:|---:|
| file-read (before) | 5.54 ms | 27.7 µs |
| index-only (after) | 80.5 µs | **0.40 µs** |
69× on the conversion, and it is the whole of what a cross-file
`textDocument/definition` into a closed file was doing besides the lookup.
`git -C ~/repo/opentitan status --porcelain` unchanged after the run.
## Work log
### 2026-09-04 — dev agent (Opus)
- Read `CLAUDE.md`, TODO §37 and the §10 lines it closes,
`docs/performance_take2.md` §4b/§6a/§7/§8, and the code each item names.
- **§37.3 first** (smallest, independent). `locate::definition_location` plus
`locate::range`; `state.rs` gained `held_views()` (`#[cfg(test)]`,
`pub(crate)`) so a test can assert that no file was read. Routed
`nav::definition` and `symbols::workspace_symbols` through it. Four tests in
`locate.rs` (new test module) and one in `nav.rs`.
- Deviation from the plan's expectation, recorded: the plan said "no
`file_view` created for a file-scope definition"; the assertion is through
`Workspace::held_views()`, a new test-only accessor, rather than a
counter — the cache *is* the counter, and it is already what `state.rs`'s
own tests assert against.
- One thing the plan did not anticipate: an **open buffer** must keep the
file-read path. Its `Def` spans are the disk file's until the next
re-index, and converting them against the buffer's current text is what
every other answer about that buffer does. Pinned by
`an_open_buffer_still_answers_from_the_buffer`, which asserts the
(pre-existing, unchanged) stale-span behaviour rather than pretending this
round fixed it.
- **§37.2 second.** Investigated by reading `hw/ip/aes/dv/tb/tb.sv` and
locating `pins_if` in the opentitan checkout (read-only, `find`/`ls` only).
The zero is correct; the finding is written above, with two tests. No
production code changed for this item.
- **§37.1 last.** `ports::offers`, `ports::offer_sources`, `ports::resolve`,
`ports::key`, `ports::counted`, `ports::instances_of`,
`ports::declared_twice`; `ClientAbilities::code_action_resolve`;
`code_action_resolve_support` in `main.rs`; `resolve_provider: Some(true)`;
the dispatch branch and the `codeAction/resolve` arm.
- **Deviation, flagged:** `vlog_refactor::ports::sites_phrase` was made
`pub` and re-exported. The plan allowed a change to
`crates/vlog_refactor/src/ports/mod.rs` "only if the offer needs a new
one-file question", and this is not one — it is the alternative to writing
a second spelling of a user-visible sentence in the server and letting the
two drift. No behaviour changed in `vlog_refactor`.
- **Deviation, flagged:** the plan said resolve returns "the action whose
title matches". Exact title matching cannot work, because the offer's
count comes from the index and the eager count from the plan, and the
plan's own §37.1 requires the unsaved-buffer case (index 3, plan 4) to
resolve. Matching is therefore on `key(title)` — the title with its
trailing ` (…)` count phrase removed. An escaped identifier cannot contain
a space, so `" ("` never occurs inside a port name; `a_title_keys_on_
everything_but_its_count` pins it.
- **Deviation, flagged:** `resolve` returns an action that already carries an
`edit` unchanged instead of refusing it. A client that declares
`resolveSupport` may resolve anything it was offered, including the quick
fixes, and refusing those would break fix-on-save for exactly the clients
this feature is for.
- `resolve` refuses a large-file buffer, because the fast path's own gate
cannot see a request whose params are a `CodeAction`. Found by reading
`server/large_file.rs`'s `document_uri`, not by a test failing; pinned by
`a_resolve_against_a_buffer_on_the_large_file_fast_path_is_refused`.
- The existing eager pin `an_unsaved_buffer_contributes_the_instantiation_
the_index_has_not_seen` was **kept** rather than moved: the eager path is
still live code for a client without `resolveSupport`. Its lazy sibling
`the_resolved_edit_sees_an_unsaved_buffer_the_offer_could_not_count` is the
moved pin.
- **The two new perf probes live beside the code they measure**, not in
`perf.rs`: `perf.rs` is already the one file over the size rule with a
written reason (895 production lines, `docs/features/decomposition-server`),
and `perf::mean` is `pub(crate)` precisely so a probe can sit next to its
subject — `nav.rs`'s references probes already do. `perf.rs` grew by the
five lines of the offer column and nothing else (900 lines).
- Files touched outside the plan's expected set: **none**
(`crates/vlog_refactor/src/lib.rs` for the re-export is the only file not
named in it; `crates/vlog_refactor/src/ports/mod.rs` was named).
## Gates (dev, guarded, 2026-09-04)
- `cargo fmt -p lucisv_server`, `cargo fmt -p vlog_refactor` — clean
(`--check` verified).
- `cargo clippy --all-targets` — clean, no new `#[allow]`.
- `tools/guard.sh -- cargo test --workspace` — **3 734 passed, 0 failed,
44 ignored** (the ignored are the perf probes).
- `tools/guard.sh -- tools/corpus_check.sh` — **814/820 (99.3 %)**, the same
six failures, `verification-error: none`, `crash: none`.
- `cargo build --release -p lucisv_server` then `tools/guard.sh -- node
editors/vscode/smoke.js target/release/lucisv-server` — OK, 20 messages.
- No guard kill at any point. `git -C ~/repo/opentitan status --porcelain`
after every opentitan read: the same three pre-existing modifications
(`hw/ip/aes/dv/tb/tb.sv`, both `ast.sv`), nothing else.
## QA log
### 2026-09-04 — QA agent (Sonnet)
Read `CLAUDE.md`, TODO §37, the dev's account above in full (Goal, Assumptions,
Handshakes, work log — all five flagged deviations), then the diffs of every
touched file. Attacked the three items over the real code, not just the
dev's own tests; every scratch test below was added as a temporary `#[test]`,
run, and removed before this log was written (`git diff --stat` after cleanup
is byte-identical to the dev's own: 15 modified + this README).
**§37.1 — lazy `codeAction`/`resolve`.**
- Malformed `data` (scratch test in `ports.rs`): a wrong-typed `uri` (a JSON
number) fails to deserialize into `Offer` → `NOT_OURS`; a well-formed `data`
naming a document **never opened at all** (distinct from one that was open
and closed) → `GONE`; a `position` far past EOF → `Positions::offset` clamps
to the text length (confirmed by reading `convert.rs:44-59`) rather than
panicking, `code_actions` at the clamped offset finds nothing, → `GONE`. No
panic in any case.
- A closed document and a document whose port has since been removed: both
already pinned by the dev's `a_resolve_of_an_action_the_buffer_no_longer_
carries_is_refused`; reproduced by re-running it directly.
- The unsaved-buffer "different count" case (index says 3, buffer really has
4): the dev's `the_resolved_edit_sees_an_unsaved_buffer_the_offer_could_not_
see` is exactly this attack — re-run, still resolves with the corrected
title and the wider edit.
- A quick-fix action passed to `resolve`: `code_action.rs`'s `quick_fix`
(line ~76) always sets `edit: Some(...)`, so it always takes `resolve`'s
first branch (`action.edit.is_some()` → returned unchanged) regardless of
origin — confirmed by reading the function rather than by a redundant
integration test, since the logic path is identical to the dev's own
synthetic "complete" case in `a_resolve_of_something_this_server_never_
offered_says_so`.
- Title-key matching with an escaped identifier containing `(` and no interior
space (`\rst(a)`, IEEE 1800-2017 §5.6.1 — an escaped identifier ends at
whitespace): built a real module with this port name, instantiated it in
three files, and drove the actual engine (not a hand-built title) through
`offered`/`code_actions`/`resolve`. The offer's menu matched the eager
menu, the title genuinely carried the literal `` `\rst(a)` `` including the
paren, and `key()` still isolated the trailing count phrase correctly — the
dev's reasoning in the comment on `key` holds under an adversarial name.
(One test-authoring pitfall found and fixed on my own scratch test, not a
product bug: `ports.rs`'s pre-existing `qa_escaped_module_name_
instantiation_parity_with_whole_workspace` also builds a `Tree::new(
"qa_escaped")`, and reusing that same name in my own scratch test raced the
two tests over the same temp directory under parallel `cargo test`
execution, producing spurious failures in both. Renamed my scratch tree and
the collision was gone on repeated runs. `Tree::new` keys its temp directory
on the string name alone with no per-test-function salt, which is a latent
hazard for the *next* test added under the same name — not something this
feature's diff introduced or should fix, flagging it here rather than in
the diff.)
- Capability gate over the wire (scratch test in `tests/e2e.rs`, two shapes in
one loop): `resolveSupport` present but its `properties` list `["documentation"]`
(no `"edit"`), and `capabilities: {}` with no `codeAction` key at all. Both
got the eager shape — `data` null, `edit` inline with the real
`WorkspaceEdit` — over an actual `initialize` → `didOpen` →
`textDocument/codeAction` session, not just the unit test of
`code_action_resolve_support` in isolation.
- Large-file mode: confirmed by reading `server/large_file.rs`'s
`document_uri` (`params.get("textDocument")?...`) — a `codeAction/resolve`
request's params are a bare `CodeAction`, which has no `textDocument` key,
so `large_file_answer` returns `None` unconditionally for this method and
the request falls through to `dispatch.rs`'s normal arm, where `ports::
resolve`'s own `.filter(|doc| !doc.large)` refuses it. Re-ran the dev's
`a_resolve_against_a_buffer_on_the_large_file_fast_path_is_refused` — passes,
no panic.
- Cost/timing, re-derived independently over the wire against the real
opentitan checkout (confirmed still 128 files instantiate `prim_flop_2sync`
today via `grep`), read-only throughout:
- Built `lucisv-server` v0.40.0 in a scratch worktree
(`git worktree add /private/tmp/.../scratchpad/base v0.40.0`, `cargo build
--release -p lucisv_server`, then `git worktree remove` — the one git
command used outside status/diff), and wrote a small throwaway Node driver
(`scratchpad/time_code_action.js`, modeled on `editors/vscode/smoke.js`'s
framing) to time a real `textDocument/codeAction` at the
`prim_flop_2sync` instantiation in `hw/ip/aon_timer/rtl/aon_timer.sv`,
workspace-scoped via `initializationOptions.lucisv.index.scope`.
- v0.40.0 server, eager (no `resolveSupport`): 76.4 / 76.4 / 77.8 ms repeats.
- This branch's server, eager (no `resolveSupport`): 77.3 / 76.2 / 77.7 ms
repeats — statistically identical to v0.40.0, confirming no regression for
a client that cannot resolve.
- This branch's server, **offer** (`resolveSupport: ["edit"]`): 4.76 / 4.38
/ 4.25 ms repeats — about **16× faster**, both with 0 actions returned
(the same "worst case: full cost, nothing offered" shape §6a complained
about).
- Also re-ran the dev's own ignored perf probe
(`ports::tests::the_offer_is_flat_where_the_eager_answer_grows`) directly:
eager 656 µs–15.6 ms across 3/40/128 fan-out, offer 55–78 µs flat — closely
matches the table in this README (§37.1 "Measured").
- **Note, not a finding against this feature:** my repeat numbers (~76 ms
eager) are well under `performance_take2.md` §6a's originally recorded
184.9–186.2 ms for this exact shape. Both old and new servers agree with
each other on *this* machine, so it reads as a machine/measurement-harness
difference from whatever produced §6a's numbers, not a regression — the
relative number this feature is judged on (offer vs. eager, same server,
same request) is the clean ~16× and it holds.
- `offer_sources`'s read set: re-ran the dev's `the_offer_reads_the_buffer_
and_at_most_the_declaring_file` — one file at a port declaration, the buffer
plus the declaring file (never the instantiating tops or noise files) at an
instantiation.
**§37.2 — the `inlayHint` zero at the default scope.**
- Verified the finding independently against the **real** opentitan checkout,
read-only: `find . -iname pins_if.sv` → exactly one hit,
`hw/dv/sv/common_ifs/pins_if.sv`, confirmed outside `hw/ip/aes` entirely (a
sibling library folder the default scope's raise-to-`hw/ip/aes` widen does
not reach).
- Wrote a scratch, `#[ignore]`d test in `inlay.rs` (guarded, read-only) that
opens the real `hw/ip/aes/dv/tb/tb.sv` at the shipped default scope and
asserts: the widen reached files under `hw/ip/aes` but none under
`common_ifs`; `nav::definition`, `hover::hover` and `inlay_hints` all answer
nothing about the `pins_if` instantiation. All three held. Agree with the
dev's finding: this is a scope-reach question, not an inlay-hint bug, and
every neighbour using the same `module_definition` lookup is equally blind
to it at this scope.
- `git -C ~/repo/opentitan status --porcelain` unchanged after every read
(the same three pre-existing modifications).
**§37.3 — `locate::definition_location` index-only path.**
- Re-ran every pin in `locate.rs` and `nav.rs`; all pass.
- Extra encoding attacks beyond the dev's own (BOM, CRLF, multi-byte, astral):
a **tab-indented** declaration, and a declaration **after a lone `\r`**
(old-Mac line ending, not `\n`) — both agree between the index-only and
file-read paths exactly. (First attempt at the lone-`\r` case put it inside
a line comment and found zero declarations at all: `lexer.rs`'s line-comment
scanner runs to the next `\n` only, so a bare `\r` inside a comment does not
end it and the intended module got swallowed into the comment text — a
pre-existing, unrelated lexer property, not a locate.rs bug. Moved the `\r`
outside the comment and the equality attack ran as intended.)
- An open buffer with an edit above the definition still answers from the
buffer's own current text, confirmed via the dev's `an_open_buffer_still_
answers_from_the_buffer` (re-run) plus reasoning: `ws.document_for_path`
gates the index-only branch off whenever a buffer is open, whatever the
index recorded.
- `held_views()` is `#[cfg(test)]` — grep and the diff both confirm no
production caller; it cannot be reached outside a test build.
- Timing re-derived independently, read-only, over the real opentitan
checkout (3 976 indexed files, 200 targets): **index-only 390 ns/definition,
file-read 27.9 µs/definition** — matches the README's 0.40 µs / 27.7 µs
claim within run-to-run noise, same ~69–71× ratio.
`git -C ~/repo/opentitan status --porcelain` unchanged.
**Gates, re-run myself, guarded:**
- `cargo clippy --all-targets` — clean, no warnings (checked both with and
without my scratch tests present).
- `tools/guard.sh -- cargo test --workspace` — **3 734 passed, 0 failed, 44
ignored**, matching the dev's own gate exactly. No guard kill.
- `tools/guard.sh -- tools/corpus_check.sh` — **814/820 (99.3%)**, the same
six failures, `verification-error: none`, `crash: none`.
- `tools/guard.sh -- node editors/vscode/smoke.js target/release/lucisv-server`
— OK, 20 messages.
- `git -C ~/repo/opentitan status --porcelain` after every opentitan read,
throughout the session: unchanged, the same three pre-existing
modifications every time.
- Scratch worktree at `/private/tmp/.../scratchpad/base` (v0.40.0) removed
with `git worktree remove` after use; `git worktree list` shows only the
main tree.
**Findings.** None at HIGH or MEDIUM severity. Two LOW, informational, neither
in this feature's own diff:
- LOW — `ports.rs`'s test-scratch `Tree::new` keys its temp directory on the
caller-supplied string alone, with no per-test salt; two tests choosing the
same name race under parallel execution (reproduced against the pre-existing
`qa_escaped_module_name_instantiation_parity_with_whole_workspace`). Not
part of this diff and not blocking; worth a name-collision guard (e.g.
salt with the test's `#[test]` function name) if it bites again.
- LOW — the offer/eager repeat-timing numbers measured this session (~76 ms
eager, ~4.5 ms offer, both machines) are well under `performance_take2.md`
§6a's recorded 184.9–186.2 ms for the identical 128-file-fan-out shape;
old and new servers agree with each other on this machine, so it reads as
environment drift from whatever produced §6a's numbers rather than a
regression this feature introduced. Recorded for whoever next revisits
§6a's absolute numbers.
**Verdict: PASS.**
## Review
**2026-09-04 — lead.** Accepted; ships in 0.41.0. 37.1 is the shape §10
asked for and the numbers say why: the offer is flat (53–68 µs from a
3-file to a 128-file fan-out, on both cursor shapes) where the eager path
is linear, and over the wire on opentitan's worst case QA measured the
offer at ~4.5 ms against ~77 ms eager — the cursor-move request is off the
fan-out. The dev's five deviations are all right: matching on the title's
key rather than the exact title is forced by the plan's own unsaved-buffer
requirement, and the escaped-identifier attack (`\rst(a)`) shows the key
holds; refusing a resolve on a large buffer closes a gate the fast path's
URI check cannot see; keeping the eager unsaved-buffer pin beside its
lazy sibling is correct because the eager path is still live for clients
that cannot resolve. 37.2 is ruled as the dev framed it: the zero is
correct — `pins_if` is declared outside what the default scope reaches
from `tb.sv`, definition and hover answer nothing there either, and QA
confirmed it on the real tree — so this is a *scope* question, not an
inlay defect, and the §10 line is closed as investigated. 37.3 is a pure
fast path (index-only Location equal to the file-read one over every
encoding shape QA and the dev tried, 69× cheaper, no view created), with
the honest exclusion of open buffers whose indexed spans may be stale.
QA's two LOWs are noted, not actioned: `Tree::new` takes a per-test name
and the existing names are distinct, and §6a's absolute numbers were
measured on a different day's machine state — both servers agree with
each other here, which is what the comparison needed.
+413
View File
@@ -0,0 +1,413 @@
# parser-skips
## Goal
Close the two parser skips TODO §11 left open after the opentitan sweep —
the last two shapes in that sweep that were grammar work rather than
"not SystemVerilog".
1. **Rival unit headers in a conditional region** (`jtag_if.sv`). One
`interface` header written twice across the arms of an
`` `ifdef ``/`` `else `` region, both spellings bracket-*balanced*:
```verilog
`ifdef GATE_LEVEL
interface jtag_if #(parameter int unsigned P = 41_664) ();
`else
interface jtag_if #(parameter int unsigned P = 20_000) ();
`endif
wire tck;
…
endinterface
```
Before this round the first header parsed in full, the `` `else `` became
a directive item of its body, the second `interface jtag_if` became a
*nested* interface, and the outer one ran out of file: `163:1: expected
`endinterface``. `directive-split`'s trigger never fired, because nothing
errored until EOF and neither arm left a bracket open. Now the body loop
recognises the rival before it parses the item, fails there, and the
existing conditional-split recovery turns the **whole unit** into one
`ItemKind::Verbatim` item — the same treatment a bracket-unbalanced split
header has had since `directive-split`.
2. **A net delay written after the type** (`SimDTM.sv`). IEEE 1800 §6.7 puts
`delay3` after the data type — `wire [31:0] #0.1 x = y;` — and lucisv
parsed it only between the net keyword and the type. `DataDecl::delay`
now carries the position it was written in and the formatter prints it
there. No normalisation: moving a delay across the type reorders tokens,
which `verify.rs` rightly refuses.
## Assumptions
- **A rival header is a fragment, the way an unclosed bracket is.** Two
bracket-balanced spellings of one header sharing one body are not a tree
any more than two heads sharing one `{` are: there is no AST for "either
this header or that one". So the unit joins the verbatim bucket rather
than getting a layout. **The standing trade is `directive-split`'s**
(README → Goal, and Status → "any canonical *layout* for the inside of a
split region — it stays byte-for-byte"): the captured bytes come back
exactly as written, so the unit's **body is not formatted**. For
`jtag_if.sv` that means the file's one visible change is the block's own
re-indent — `Fmt::raw_lines` dedents every line by the head's column, so a
unit written two spaces in comes back at column 1 with its *relative*
layout intact (`directive-split` README → Assumptions, "a verbatim block's
relative layout is what survives"). `--check` therefore says "would
reformat", not "unchanged".
- **The rival trigger is five conditions at once**, and every one of them is
read from the tokens — never from a flag someone could set by mistake:
1. the cursor stands on a `` `else `` / `` `elsif ``;
2. a conditional region was open at the unit's own first token
(`open_conds > 0` there);
3. that region is still the live one — nothing opened inside the body is
still open (`open_conds` is back to the header's value) **and** the
header's own region was never closed inside the body (the body's
lowest nesting never dipped below it). Without the second half, a body
that closes the outer region and opens another would present a
`` `else `` that continues the *new* region at the same count;
4. the token after the directive is the unit's own keyword;
5. the token after that is the unit's own name.
- **The evidence is re-derived at the split, not carried on the error.**
`ParseError` is a public struct with three public fields and no room for a
flag; adding one would touch every construction site in the crate and give
every error path a way to reach the recovery. `Parser::rival_end_kw` reads
the same shape back out of `ItemMark::pos` and the cursor instead, which
is exactly how the other three conditions of `at_split_conditional` are
already checked. Cost: the shape is spelled twice (`at_rival_header` for
the body loop, `rival_end_kw` for the split). Benefit: the whole trigger
stays in one file and is provable from the token stream alone.
- **The extent scan ends at the unit's closing keyword.** A unit header's
own `;` closes only the header, so the `;` rule `scan_split_extent` has
always used would have ended the block at the first body declaration.
With `unit_end = Some(kw)` the scan runs to the matching `endmodule` /
`endinterface` / `endprogram`, counting units of the same kind so one
nested in the body cannot end it early, and swallowing an
`endinterface : name` label the way the opening split already does.
An `interface class` nested inside a captured `interface` closes with
`endclass`, leaves the unit count above zero and makes the scan give up —
the parse error stands, which is the safe side of the trade.
- **Both delay positions, never both at once.** `wire #5 [31:0] #6 x;` is a
parse error naming the rule. Only a *net* declaration reads a delay in
either position, so `logic #5 x;` and `logic [7:0] #5 x;` are the ordinary
syntax errors they always were.
- **A comment written directly in front of the `#` has no slot.** It is
refused by `verify.rs` (token reorder), for the after-type position and
for the before-type position alike. That is **pre-existing** — the
before-type spelling has behaved this way since the delay was first
parsed — and the new position inherits it unchanged. Recorded as a `#SKIP`
case in `net_delay_position.cases`, not fixed: giving the delay a comment
slot is a `comment-slots` change. The other gaps around a delay (an
attribute in front of the declaration, a comment after the delay) do
round-trip.
## Handshakes
### Consumed
- `Parser::split_conditional_item` / `capture_split` / `verbatim_since` /
`Fmt::raw_lines` — the `directive-split` recovery and its verbatim
printer, used unchanged. `ItemKind::Verbatim` gains no new producer: the
same call in `parse_item_inner` produces it.
- `Parser::open_conds` and `ItemMark::conds` — the item-scope conditional
nesting `directive-split` maintains in `note_item_conditional`. Read, not
written, by the rival path; the one write is the existing
`self.open_conds = conds_after` in `split_conditional_item`.
- `Parser::parse_delay_value` (`parser/instance.rs`) — reads `#5`, `#0.1`
and `#(1:2:3)`. Used unchanged for both positions.
### Promised / changed for others
- **`at_split_conditional`'s fourth condition widened**, from "the arm left
a bracket open" to "the arm left a bracket open **or** the arm behind the
directive re-writes this item's own unit header". Recorded in
`docs/features/directive-split/README.md` → Status. Everything that
refused before still refuses; the three negatives are pinned as tests.
- **`scan_split_extent` gained a second parameter**, `unit_end:
Option<&str>`. `None` is byte-identical to the old behaviour and is what
every pre-existing caller path passes.
- **`DataDecl::delay` changed type**, `Option<Expr>` → `Option<NetDelay>`
where `NetDelay { expr: Expr, after_type: bool }`. Two readers existed in
the whole workspace and both were one-line changes
(`vlog_formatter/src/format/decl.rs`, `vlog_semantic/src/bind/decl.rs`),
so the struct was preferred over a second `DataDecl` field: it makes
"after_type set with no delay" unrepresentable, at no cost to consumers.
- **`verify.rs` is untouched.** No normalization was added and no
forgiveness widened. Both halves of this round are the *opposite* of
forgiveness — the delay is printed where it was written precisely so the
token order the safety net compares is unchanged, and a verbatim block is
re-lexed as ordinary tokens on both sides.
- **`ast::size_pins` still green, unchanged.** It pins `Expr`, `Stmt` and
`StmtKind`; `NetDelay` adds a `bool` to `DataDecl`, which none of the
three contains.
### Requests to other clusters
- **`comment-slots`**: a net delay has no slot for the comment written
immediately in front of its `#`, so such a file is refused by the safety
net rather than reformatted. Pre-existing, both positions, recorded as a
`#SKIP` case (see Assumptions).
## Status / TODO
- [x] 38.1 rival-header detection in `parse_module`'s body loop
(`parser/module.rs`), `at_rival_header` / `rival_end_kw` / `opens_unit`
and the widened trigger (`parser/split.rs`), the keyword-ended extent
scan.
- [x] 38.1 tests: the four header spellings, both modes' trees equal,
comments kept, a unit nested in a captured body, the three negatives —
`parser/tests/split.rs`; four formatter cases including the real
`jtag_if.sv` in full — `tests/cases/rival_headers.cases`.
- [x] 38.2 `NetDelay` with its position (`ast/decl.rs`), `parse_net_delay`
for either side and the both-sides error (`parser/decl.rs`),
`Fmt::net_delay` printing it where it was written
(`format/decl.rs`), the one consumer update (`bind/decl.rs`).
- [x] 38.2 tests: both positions and their spans, both-at-once refused, only
a net reads one — `parser/tests/decl.rs`; five formatter cases
including the real `SimDTM.sv:38-41` — `tests/cases/net_delay_position.cases`.
- [x] docs: this README; §11's two lines and §38's checkboxes ticked in
`TODO.md`; the `directive-split` cross-reference.
- [x] Gates (guarded): `cargo fmt -p` on the three touched crates, clippy
`--all-targets` clean, `cargo test --workspace` 3 744 passed / 0
failed, `tools/corpus_check.sh` 814/820 with the same six failures,
both opentitan files through `format --check`.
- [ ] **Not done, deliberately:** a rival header whose two arms spell the
keyword differently (`module` in one arm, `macromodule` in the other);
a rival written across three or more arms where the *name* differs in
one of them; any layout for the inside of a captured unit. Each is
refused, not mis-parsed.
- [x] QA. Verdict: PASS. See QA log (2026-09-04).
## Work log
### 2026-09-04 — dev
**38.1, the rival header.** Read `parse_module`, `split.rs` and
`directive-split`'s README first. The failure the plan describes is real and
reproduced on trunk grammar: with both arms bracket-balanced, nothing errors
until the outer unit reaches EOF, so `at_split_conditional` — which is only
ever consulted from `parse_item_inner`'s `Err` arm — never sees a cursor on
the `` `else ``.
Detection went into `parse_module`'s body loop, before `item_or_recover`, as
the plan asked. `parse_module` now records `open_conds` at its own first
token and tracks the lowest nesting the body has reached (`UnitHead::floor`);
the check itself, `Parser::at_rival_header`, lives in `split.rs` beside the
rest of the trigger, so `module.rs` grew by twelve lines and stayed at 635.
Routing: **a dedicated check beside the bracket one**, not a flag on the
error. `ParseError` is public with three public fields; a fourth would be an
API change touching every construction site, and a flag is a thing an
unrelated error path can set. `rival_end_kw` re-derives the shape from
`ItemMark::pos` and the cursor — which is how the trigger's other three
conditions are already checked — and returns the unit's closing keyword,
which the extent scan then needs anyway. So the one helper both widens the
trigger and steers the scan.
`scan_split_extent` took an `Option<&str>` closer. With `None` it is the old
function byte for byte. With `Some`, it ends at the matching closing keyword
(past an `endinterface : name` label) instead of at a `;`, counting units of
the same kind so a module nested in the captured body cannot end it early —
pinned by `a_unit_nested_in_a_captured_body_does_not_end_the_scan_early`.
The three negatives the plan named are each a test, and each is refused by a
*different* condition: a region opened inside the body fails condition 3 (or
2, when nothing was open around the unit at all); a different name after the
`` `else `` fails condition 5; a region closed before the header fails
condition 2. A fourth shape — a body that closes the header's region and
opens another, which leaves the *count* equal — is what `floor` is for, and
is the second half of `a_region_closed_before_the_header_leaves_the_else_stray`.
The real file: `hw/dv/sv/jtag_agent/jtag_if.sv` parses, formats, is
idempotent, keeps all 34 of its comments and comes back at the same 162
lines. Its one change is the verbatim block's dedent (the unit was written
two spaces in). It is in `rival_headers.cases` in full, input and output, so
the harness proves the idempotency and the byte-identity of the body on the
actual bytes rather than on a paraphrase.
One deviation worth naming: the comment written between the `` `ifdef `` and
the header (`// jtag interface with default 24MHz tck for GLS`) is **not**
inside the verbatim block — the capture starts at the item's first token, so
it is the item's own leading comment, exactly as in every other split. It is
printed, not dropped; the test asserts where it lands.
**38.2, the net delay.** `NetDelay { expr, after_type }` rather than two
`DataDecl` fields: with only two readers in the workspace, both one-line
either way, the struct wins because it cannot represent "after_type set with
no delay". The parser reads the delay through one helper called twice, once
on each side of `parse_opt_data_type`, and `(Some, Some)` is an error naming
the rule. The formatter's `Fmt::net_delay` prints the delay only on the side
it was written on; nothing is normalised, so both spellings round-trip byte
for byte and `verify.rs` sees the token order it was given.
`SimDTM.sv` now parses; its diff is ordinary layout (the DPI header, the
port list, an `else begin`), and the four `#0.1` wire lines come back
untouched. `ast::size_pins` is unchanged and green: it pins `Expr`, `Stmt`
and `StmtKind`, none of which holds a `DataDecl`.
**Found, not fixed:** a comment written directly in front of a delay's `#`
has no slot, so the file is refused by the safety net. It behaves identically
in the *pre-existing* before-the-type position, so this is not a regression
of this round; recorded as a `#SKIP` case and as a handshake request to
`comment-slots`.
**Files touched outside the plan's expected set:**
`docs/features/directive-split/README.md` (one Status bullet, the
cross-reference §38 asked for) and this README. Nothing else.
## QA log
### 2026-09-04 — QA
Read `TODO.md` §38 and this README (Goal/Assumptions/Handshakes/Work log) in
full, then the diffs of every touched file and both new `.cases` files. Built
`target/release/lucisv` (release) from the dev's tree; the 0.41.0 baseline
binary was already cached at `~/.cache/lucisv-baselines/`, so no scratch
worktree was needed.
**38.1, rival headers.** Traced `at_rival_header` / `rival_end_kw` /
`scan_split_extent` by hand against the token stream: the extent scan's
else-if chain disables the `;` terminator whenever `unit_end` is `Some`
(confirmed by reading the branch order), `opens_unit` is keyed to the failed
unit's own closing keyword so a nested unit of a *different* kind never
touches the counter, and a same-kind-but-different-closer nested unit
(`interface class … endclass`) leaves the counter stuck above zero and makes
the scan give up — the parse error stands, as documented.
Attacked with `target/release/lucisv format --stdout` (a Rust-level
strict/tolerant-parity and comment-preservation pass was already covered by
the dev's own `parser/tests/split.rs` additions, which I re-ran rather than
duplicating):
- Header spellings: `interface`, `module`, `program`; with and without
`#(...)`; `()`, a real port list, and no port list; three arms
(`ifdef`/`elsif`/`else`, all three rival); a comment directly before the
rival header in the `else` arm; the region's own `` `endif `` written after
the body's first item; rival arms with *different* `#(...)` lengths; a
`module` nested inside a captured `interface` body (does not end the scan
early); an `end : label` inside the body; `endinterface : jtag_if`. All
parse, format unchanged (0 diff from input), and are idempotent.
- The three plan negatives, plus the "region closed and a new one opened at
the same count" fourth shape the dev's `floor` field targets — all four
stay `expected end<kw> (found "<eof>")` parse errors, never a Verbatim.
- Termination: an unterminated rival (no `endinterface` at all) and a rival
whose `` `endif `` is the last token in the file both surface the original
`rival header for … in a conditional region` parse error (the extent scan
finds no closer, so it returns `None` and the original error stands) — no
corruption, no panic, no silent accept.
- A rival shape nested inside `generate … if (1) begin … end … endgenerate`:
parses, is idempotent, and reindents only the verbatim block's own base to
the surrounding column (relative layout preserved) — an odd but
non-corrupting result; not a shape the plan named, recorded here as a
curiosity rather than a finding since nothing breaks.
- Three additional attempts at over-widening `at_split_conditional`'s fourth
condition, per the QA brief: (1) a real syntax error inside the body,
unrelated to any header, immediately followed by an `else`/rival-shaped
arm; (2) the header parses fully and the *next* declaration errors right
before a rival-shaped `else`; (3) a rival-shaped arm one nesting level
*outside* the item that actually failed (nested units). All three stay
ordinary parse errors — `rival_end_kw` reads `mark.pos`, the position of
the item that actually failed, and returns `None` whenever that token is
not the unit's own keyword+name, so none of the three ever reaches the
split. The trigger does not over-fire.
- "Not done, deliberately" claims verified directly: a keyword mismatch
across arms (`macromodule` vs `module`) and a three-arm rival with one
wrong name both stay the pre-existing `expected endmodule (found <eof>)`
error, not a mis-parse.
- The real file (`hw/dv/sv/jtag_agent/jtag_if.sv`, read via `--stdout` only):
idempotent; 162 lines in and out; all 34 `//` comments present, 0 `/*`
comments in either (matches); the only diff from the source is the
verbatim block's dedent, confirmed with `diff` — every other line
byte-identical. Matches the dev's account exactly.
- `rival_headers.cases`: read start to finish, including the copied
`jtag_if.sv` case — its input half diffs clean against the read-only
opentitan file.
**38.2, net delay.** Attacked before/after positions for `wire`, `tri`,
`wand`, `supply0`, and a `logic`-typed net (`wire logic #2 x;`); packed
dims; `signed`; delay forms `#5`, `#(1:2:3)`, `#0.1`, `#1ns`; both positions
at once (`a net delay is written before or after the type, not both` —
matches the plan's message); a delay on `reg`/`logic` variable declarations
(ordinary `expected identifier (found "#")` syntax errors, exactly the
pre-§38.2 behavior — not net declarations, so `parse_net_delay`'s `is_net`
gate correctly refuses). `wire vectored [3:0] x;` (no delay) also errors on
both the new binary and the 0.41.0 baseline identically — a pre-existing,
unrelated gap (`vectored` net-decl qualifier is not parsed at all), not a
regression of this round.
Every working shape is idempotent (checked `format(format(x)) == format(x)`
on seven distinct shapes). Confirmed the `#SKIP` case
(`wire /* c */ #5 x;`) is genuinely pre-existing by running
`~/.cache/lucisv-baselines/lucisv-0.41.0 format --stdout` on the isolated
before-type shape: identical `verification failed: token stream diverges …`
error, same column, on the baseline that predates this round entirely. Ran
the same probe on the new after-type shape and on the exact two lines in the
`.cases` `#SKIP` block — same failure mode both times, confirming the
struct's `after_type` field inherits the gap rather than introducing it.
The other two round-tripping cases in `net_delay_position.cases` (an
attribute before the declaration, a comment after the delay) were run
directly and match their expected output byte for byte, including the
forced line break the comment causes.
Semantic consumer: added a temporary `#[test]` in
`crates/vlog_semantic/tests/semantics.rs` (`qa_scratch_a_delayed_net_still_resolves`,
removed after use — final `git diff` on that file is empty) declaring
`wire [31:0] #0.1 delayed_net = other;` and asserting `definition_of` on a
later use resolves back to the `Net` symbol. Passed. `bind_data_decl`'s
one-line change (`d.delay.as_ref().map(|n| &n.expr)`) is correct.
**Byte-identity.** Corpus (820 files, `find corpus -name '*.sv' -o -name
'*.v'`): compared `format --stdout` output and exit code between
`target/release/lucisv` and the 0.41.0 baseline over every file — **0
differences** (neither skip file is in the corpus, as the dev's README
says). Opentitan sweep over `hw/ip`, `hw/top_earlgrey/ip`,
`hw/top_darjeeling/ip`, `hw/dv`, `hw/vendor` (2 554 `.sv`/`.v`/`.svh`/`.vh`
files) comparing `format --check` exit codes between the two binaries:
**exactly** `hw/dv/sv/jtag_agent/jtag_if.sv` and
`hw/vendor/pulp_riscv_dbg/tb/unused/SimDTM.sv` changed, both from exit 2
(parse error) to exit 1 (would-reformat) — no other file in the sweep
differs. `git -C /Users/guoliangchen/repo/opentitan status --porcelain`
after every read-only invocation shows only the three files the task's
baseline convention already allows (`hw/ip/aes/dv/tb/tb.sv`,
`hw/top_darjeeling/ip/ast/rtl/ast.sv`, `hw/top_earlgrey/ip/ast/rtl/ast.sv`),
none of which this session touched.
**Gates (guarded).**
- `cargo clippy --all-targets`: clean.
- `tools/guard.sh -- cargo test --workspace`: **3 744 passed / 0 failed**
(36 ignored, all pre-existing `#[ignore]` measurement tests) — matches the
dev's claimed count exactly.
- `tools/guard.sh -- tools/corpus_check.sh`: **814/820** parsed &
formattable, same six pre-existing failures (`parse-error` count 6,
`verification-error` 0, `crash` 0).
No HIGH or MEDIUM findings. One LOW/informational note (the `generate`
nesting shape above) recorded for the trail, not requiring rework — the
result is correct and non-corrupting, just an untested corner the plan
didn't name.
**Verdict: PASS.**
## Review
**2026-09-04 — lead.** Accepted; ships in 0.42.0 with §39. 38.1 does what
the §11 skip asked and no more: the rival is detected where it can be
detected (a continuing directive at the unit's own entry level, followed by
the same keyword and the same name), the error is routed into the split
that already exists, and the capture runs to the unit's real closer counting
nested units of the same kind. The dev's deviation — a dedicated check
beside the bracket one rather than a flag on the public `ParseError` — is
the right call for the reason given, and QA's three attempts to make the
widened trigger over-fire all stayed ordinary errors. The body of a split
unit is verbatim, which is the standing directive-split trade. 38.2 is a
positional field with no normalisation, so `verify.rs` is untouched and
the token order is preserved on both spellings; the comment-before-`#` gap
is pre-existing (QA confirmed against 0.41.0) and stays a `#SKIP` with a
handshake to comment-slots. Byte-identity: 0 of 820 corpus files differ
from 0.41.0, and over 2 554 opentitan files exactly the two named files
change outcome, both from parse error to formattable. QA's LOW (a rival
nested in a generate `if` arm also recovers) is fine as it is.
+16 -3
View File
@@ -188,7 +188,13 @@ code_action_provider: Some(CodeActionProviderCapability::Options(CodeActionOptio
`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.
`resolve_provider` was `None` because every action was returned complete;
since TODO §37.1 it is `Some(true)` and a third kind
(`refactor.rewrite.lucisv.ports`) is listed. The quick fixes above are
unaffected — the actions that are now offered without their edits are the port
refactorings, and only to a client that declared
`textDocument.codeAction.resolveSupport.properties: ["edit"]`. See
`docs/features/lazy-code-action/README.md`.
**Still deliberately not advertised**, unchanged by this round and absent from
the initialize result rather than present-and-false: `rangeFormatting` (waits on
@@ -227,8 +233,15 @@ TODO §2 `--lines`), `completion`, `rename`, `signatureHelp`, and cross-file
- [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:** `codeAction/resolve`. Every action is cheap to build in
full; lazy resolution is a payload optimization for actions that are
not.~~ Delivered by **lazy-code-action** (TODO §37.1), and the note was
right about *these* actions: the quick fixes and `source.fixAll.lucisv`
are still returned complete. What is now lazy is the **port
refactorings**, whose offer used to compute the whole cross-file edit —
185–201 ms at a 128-file fan-out, on every cursor move. `resolve` hands
an action that already carries its edit straight back, so a client that
resolves everything it was offered still gets these unchanged.
- [x] ~~**Not done:** sharing one parse with the linter (Handshake 1).~~
Delivered by **one-parse** (round 19).
+561
View File
@@ -0,0 +1,561 @@
# waiver-files
## Goal
Findings can be suppressed from *outside* the RTL, in Verible's waiver file
format, so a project that already has a `.waiver` file carries it over
unchanged and a team can silence a rule for a legacy directory without
editing five hundred files. One directive per line —
`waive --rule=<rule> [--line=N|--line=N-M] [--location=<pattern>]`, with `#`
comments and blank lines ignored — read from `--waiver-file` on the command
line, from `waivers` under `[lint]` in a `lucisv.toml`, and from
`lucisv.lint.waivers` in an editor. External waivers and the inline
`// lucisv: waive` comments are a **union**: a finding either covers is
suppressed, and one both cover marks both used. This closes §4's last two
waiver items (TODO §39).
## Assumptions
- **`--location` is not a regex.** Verible's is; lucisv has no regex engine
in the linter's path and deliberately keeps `--exclude`'s glob semantics
everywhere a pattern names files. A pattern that *looks* like a regex is
refused with a message saying what the difference is, rather than silently
matching nothing. The detector is `waiver_file::regex_hint`: `.*`, `.+`,
or any of `\ ^ $ [ ] ( ) | ? + { }`. A bare `.` is not a metacharacter —
`foo.sv` is a file name. A pattern that is a valid glob *and* looks like a
regex (a file with a `+` in its name) is refused; nothing in the corpus or
in opentitan has one, and the message tells the user what to write.
- **A directive names one rule.** A severity word (`error`, `warning`,
`style`) is refused, though `--select`/`--ignore` accept one: a waiver file
is checked in, and one word in it quietly silencing a whole class is not
something anyone should be able to write by accident.
- **`--regex=` is refused by name**, because Verible has it and a user
carrying a file over deserves to be told which directive lucisv cannot
honour rather than "unknown option".
- **Line ranges are `N-M`, inclusive, 1-based**, matching Verible. `N:M` is
not accepted.
- **A stdin buffer has no path**, so a directive with a `--location` cannot
cover it; one without covers it like any other file.
- The CLI de-duplicates waiver files by their **canonicalized** path, so the
same file named by `--waiver-file` and by a `lucisv.toml` is read once. If
canonicalization fails (a path that does not exist) the path as written is
the key — and a non-existent path fails the run a line later anyway.
- The server reads its waiver files **on every lint pass**, exactly as it
already re-reads the buffer's `lucisv.toml` per pass, so a waiver file
edited while the editor is open takes effect at the next publish with no
cache to invalidate. The cost is a few `read_to_string`s of small files
beside a parse and an analysis, and it is zero when nothing is configured.
- `lint::fixable` (the code-action path) still runs `default_rules()` with no
waivers at all, inline or external — unchanged from before this round. A
waived finding was never published, so no lightbulb is offered for it in
practice; the mismatch is pre-existing and out of scope here.
## Handshakes
**Consumed**
- `lucisv_core::walk::is_excluded` — the `--exclude` matcher, now also the
`--location` matcher. **This adds `lucisv_core` as a dependency of
`vlog_linter`** (`crates/vlog_linter/Cargo.toml`, with the reason in a
comment). `lucisv_core` has no dependencies of its own, so this adds no
external code and closes no loop; copying the matcher instead would have
meant the two *look* the same and can drift. **This is a new edge for
`docs/topo.md`: `vlog_linter ──▶ lucisv_core`.** That file is owned by
another process this round, so the edge is recorded here for the lead to
apply.
- `lucisv_core::config::FileConfig::lint_waivers` — new `Option<Vec<PathBuf>>`
field, `[lint] waivers`, resolved against the config file's own directory
by `Discovery` exactly as `filelist` is.
- `vlog_linter::rule_by_name` / `Severity::from_name` — a directive's `--rule`
is validated against the registry at parse time.
**Promised**
- `vlog_linter::lint(ctx, rules)` is **unchanged** in signature and behaviour;
it now delegates to `lint_with(ctx, rules, &ExternalWaivers::default())`.
- `vlog_linter::lint_with(ctx, rules, &ExternalWaivers) -> (Vec<Violation>,
WaiverUse)` is the new entry point. The `WaiverUse` half is the caller's to
merge across a run and hand back to `ExternalWaivers::unused`.
- `vlog_linter::{ExternalWaivers, UnusedReport, WaiverUse}` are public.
`ExternalWaivers::read` returns `(waivers, problems)` — a file that cannot
be opened is the `Err`, a file with bad *lines* is an `Ok` carrying both —
so the CLI can fail the run and the server can drop the line and log it,
from one reader.
- `vlog_linter::waiver::Waivers::filter` is gone, replaced by
`Waivers::covers(rule, line)`; the union has to ask both waiver kinds about
every violation, and a `filter` that dropped violations before the external
one saw them would have marked only one of a covering pair used. Internal
to the crate (`pub(crate)`), so nothing outside moves.
- `lucisv_server::state::Workspace::roots()` is new (`&[PathBuf]`), for
resolving a relative `lucisv.lint.waivers` entry against the first root the
way `filelist_path` does inline.
- `lucisv_server::lint::{waiver_paths, external_waivers}` are public so
`server/notification.rs` can validate the setting once when it arrives.
- `settings::LintSelection` gained a sixth element (the waiver list), so a
changed list republishes every open buffer, as a changed option already did.
- `lucisv::lint::{plan, check_stdin}`: `check_stdin` takes one more argument
(`&ExternalWaivers`); `external_waivers(opts, configs)` is public for the
stdin path in `main.rs`.
**Requested of the lead** (files owned by the concurrent docs process): the
`README.md` / docs-site text under "Docs to apply at merge (lead)" below, and
the `docs/topo.md` edge above.
## Status / TODO
- [x] 39.1 `waiver_file.rs` (parse + match) and the union in `lib.rs`
- [x] 39.2 discovery: `[lint] waivers`, `--waiver-file`, `lucisv.lint.waivers`
- [x] 39.3 unused reporting on the CLI; errors on both front ends
- [x] the VS Code setting — **by hand** in `editors/vscode/package.json`:
`vlog_linter::vscode` generates only `lucisv.lint.severity.*` and
`lucisv.lint.rules.*`, and the drift test
(`settings.rs::the_vscode_lint_toggles_match_the_registry`) filters on
exactly those two prefixes, so `lucisv.lint.select`, `ignore`, `options`
and now `waivers` are hand-written beside them
- [x] tests: every directive shape and every error; matching by name, path
suffix, line and range; union with an inline waiver; unused reporting;
CLI (`--waiver-file` twice, toml + CLI, exit codes); server unit tests;
one e2e case over the wire
- [x] docs: this README; TODO §4's two waiver lines and §39's own boxes
- [ ] QA
## Work log
**2026-09-04 (dev).**
- `crates/vlog_linter/src/waiver_file.rs` (new, ~330 lines with tests): the
directive parser, the matcher, `WaiverUse` and the unused report.
`waiver.rs` is untouched except that `filter` became `covers` — it is still
only the inline story.
- The union lives in `lib.rs::waive`, which asks **both** waiver kinds about
every violation and never short-circuits: `inline.covers(..) || external
.covers(..)` with `||` would have left the second waiver of a covering pair
looking dead. There is a test for exactly that in `cli.rs`.
- Grammar accepted, exactly:
`waive` then any order of `--rule=<rule>` (required, once),
`--line=<N>` or `--line=<N>-<M>` (once), `--location=<pattern>` (once).
Leading and trailing whitespace ignored, `#` comments and blank lines
ignored, CRLF handled (the span arithmetic uses `split_inclusive('\n')` so a
`\r` does not shift a directive's reported line). There is no quoting, so a
pattern cannot contain a space — the same limitation `.f` filelists have.
- Every error message (each prefixed `<file>:<line>: `):
- ``expected a `waive` directive, found `<word>` ``
- ``` `waive` needs a `--rule=<rule-name>` ```
- ``unknown rule `<name>` ``
- ``` `--rule=<word>` names a severity class; a waiver names one rule at a time ```
- ``` `--line=<v>` is not a line or a line range (`--line=5`, `--line=5-9`) ```
- ``` `--line=<v>` starts at 0; lines are numbered from 1 ```
- ``` `--line=<v>` counts backwards ```
- ``` `--location=<v>` looks like a regular expression (`<token>`); lucisv
matches a location the way `--exclude` does — … ```
- ``` `--<flag>` is given twice ```
- ``` `--regex` is not supported; waive by `--line` or `--location` ```
- ``unknown option `<flag>` (the options are `--rule`, `--line` and
`--location`)``
- ``` `--<flag>` takes a value: write `--<flag>=<value>` ```
- ``` `--<flag>` has an empty value ```
- and, for a file that cannot be opened at all, `<path>: <io error>`.
- CLI: `--waiver-file` is repeatable and lint-only; the run's set is the flag's
files in order, then every `[lint] waivers` entry of a config file governing
an input, de-duplicated canonically. The first problem fails the run at exit
2 before anything is linted, matching a bad `[lint.<rule>]` entry.
- Unused external waivers are computed **after** the whole run
(`lint::dead_waivers`), from the `WaiverUse` each file's report carries,
merged. They are reported as ordinary `unused-waiver` violations against the
waiver file, which means they flow through `--output-format json` and the
exit code unchanged. A stdin run is a run of one buffer and reports them
too.
- `check_one`/`run_rules`/`fix_source` grew a `Pass<'a>` struct rather than a
seventh and eighth parameter (clippy's `too_many_arguments` was one argument
away). Pure plumbing; no behaviour moved.
- Under `--fix`, usage accumulates across the fix rounds: a waiver that
covered a finding the fix then removed still did its job.
- Server: `LintRun` carries an `ExternalWaivers`; `violations_in` calls
`lint_with` and discards the usage half, because the server never sees a
whole run and must not claim a waiver is dead. The setting's files are read
a second time in `apply_settings` purely to log what is wrong with them —
once per settings push instead of once per keystroke.
- Deviations from the plan, all noted above: the `lucisv_core` dependency in
`vlog_linter` (Handshakes), the VS Code setting added by hand rather than
through the generator (which does not cover this family of settings), and
`editors/vscode/README.md` gaining the setting's row — a file outside the
plan's expected touch set, listed below.
**Gates (all guarded, 2026-09-04)**
- `cargo fmt -p` clean for `lucisv`, `lucisv_core`, `lucisv_server`,
`vlog_linter`; `cargo clippy --all-targets` clean (zero warnings).
- `tools/guard.sh -- cargo test --workspace`: **3 764 passed, 0 failed, 44
ignored** (3 744 at 0.41.0, plus this round's 20 new tests).
- `tools/guard.sh -- tools/corpus_check.sh`: **814/820**, the same six
failures as 0.41.0.
- `cargo build --release -p lucisv -p lucisv_server`, then
`tools/guard.sh -- node editors/vscode/smoke.js target/release/lucisv-server`
— OK, 20 messages.
- opentitan demonstration, read-only:
`target/release/lucisv check --no-cache --select error,warning,style
hw/ip/aes/rtl` reports **307** violations; with
`--waiver-file <scratch>/opentitan.waiver` holding
```text
waive --rule=dff-name-style --line=226 --location=aes_key_expand.sv
```
it reports **306**, and the one line that disappears is exactly
`aes_key_expand.sv:226:12 … [dff-name-style]`. (The *default* rule set finds
nothing at all in `hw/ip/aes/rtl`, which is why the demonstration selects
every class.) `git -C ~/repo/opentitan status --porcelain` afterwards shows
only the three pre-existing modified files.
**Files touched outside the plan's expected set**
- `crates/vlog_linter/Cargo.toml` — the `lucisv_core` path dependency.
- `crates/lucisv_server/src/state.rs` — `Workspace::roots()`, an accessor.
- `crates/lucisv_server/tests/e2e.rs`, `crates/lucisv/tests/cli.rs` — tests
the plan asked for.
- `editors/vscode/README.md` — the settings table's row for
`lucisv.lint.waivers` (`README.md` at the repo root and everything under
`docs/site/` were owned by another process this round and are left alone;
their text is below).
## Docs to apply at merge (lead)
Ready to paste. The first block is for `README.md` (the linter section, after
the inline-waiver paragraph) and for
`docs/site/src/content/docs/guides/linter.md`.
```markdown
### Waivers
A finding is suppressed by a comment in the RTL:
```systemverilog
wire a; // lucisv: waive no-tabs
// lucisv: waive-start line-length
…
// lucisv: waive-stop line-length
```
`verilog_lint:` is accepted in place of `lucisv:`, so a Verible-annotated
codebase needs no editing.
It can also be suppressed from **outside** the RTL, in Verible's waiver file
format — one directive per line, `#` comments and blank lines ignored:
```text
# every line of every file
waive --rule=no-tabs
# one line, or a range with both ends included
waive --rule=line-length --line=12
waive --rule=line-length --line=12-20
# only the files a pattern names
waive --rule=no-tabs --location=legacy/top.sv
```
`--rule` is required and names exactly one rule — a severity word is not
accepted here. `--line` is 1-based. `--location` is matched the way an
`--exclude` pattern is: `*` stands for any run of characters *within* one path
component, a pattern containing `/` matches a path suffix, and one without
matches the file name at any depth. Unlike Verible's, it is **not** a regular
expression, and a pattern that looks like one (`.*`, `\.`, `[…]`) is an error
naming the difference rather than a pattern that silently matches nothing.
lucisv reads waiver files from three places, and they **add up**:
| Where | Paths relative to | Applies to |
| --- | --- | --- |
| `lucisv check --waiver-file <path>` (repeatable) | the working directory | that run |
| `waivers` under `[lint]` in `lucisv.toml` | that `lucisv.toml` | the CLI and the editor |
| `lucisv.lint.waivers` in an editor | the first workspace folder | the editor |
```toml
[lint]
waivers = [ "waivers/legacy.waiver" ]
```
External waivers and inline ones are a **union**: a finding either covers is
suppressed, and a finding both cover leaves neither reported as dead.
A waiver file that does not exist, or a directive that does not parse, fails
`lucisv check` with `<file>:<line>: <message>` and exit 2 — the same treatment
a bad `[lint.<rule>]` entry gets. In an editor the bad line is dropped, the
rest of the file still applies, and the problem is written once to the lucisv
log.
A waiver that suppressed nothing is itself reported, under the
`unused-waiver` rule: an inline one at the comment, an external one at its
line of the waiver file. **Only `lucisv check` reports unused external
waivers**, and only after the whole run has been linted — a `--location` may
name a file the run has not reached yet, and an editor never sees a whole run
at all.
```
For `docs/site/src/content/docs/reference/cli.md`, in the `lucisv check`
options table:
```markdown
| `--waiver-file <PATH>` | Read waiver directives from this file; repeatable. Adds to whatever `waivers` under `[lint]` in a `lucisv.toml` already names. Relative to the working directory. A missing file or an unparsable directive is an error (exit 2) |
```
For `docs/site/src/content/docs/start/configuration.md`, in the `lucisv.toml`
key table and the editor-settings table respectively:
```markdown
| `[lint] waivers` | `[]` | External waiver files, resolved against the `lucisv.toml`'s own directory. Verible's format; see the linter guide's Waivers section |
```
```markdown
| `lucisv.lint.waivers` | `[]` | External waiver files, absolute or relative to the first workspace folder; added to whatever `[lint] waivers` names. A missing file or an unparsable directive is logged and dropped. Unused external waivers are reported by `lucisv check` only |
```
And the edge for `docs/topo.md`: **`vlog_linter ──▶ lucisv_core`** —
`waiver_file.rs` matches a `--location` with `walk::is_excluded`, the same
matcher `--exclude` uses.
### 2026-09-05 — lead, at review
QA's HIGH closed in the tree: `lucisv_server::lint::fixable` now takes the
buffer's `LintRun` and lints with `lint_with(ctx, run.rules, run.external)`,
so a quick fix is never offered — and `source.fixAll.lucisv` never applied —
for a finding a checked-in waiver file waived; the code-action entry point
takes the run and the dispatch builds it with `LintRun::for_document`. This
also stops the code-action path from fixing under `default_rules()` while
the diagnostics pass runs the enabled set, a second pre-existing drift.
Pinned by `an_externally_waived_finding_gets_no_quick_fix_and_fix_all_leaves_it`.
The BOM LOW: a leading U+FEFF is stripped before the first directive is
read. The other LOW (a bad line in a file named by `[lint] waivers` is
dropped silently in the editor, the editor-setting path is logged) is
documented in the applied docs and folded into §42.2, which surfaces every
rejected project entry with file and line. The docs in "Docs to apply at
merge" are applied to README.md, the linter guide, cli.md, configuration.md
and topo.md.
## QA log
**2026-09-05 (QA).**
Read the plan (TODO §39), the feature README in full, and the diffs of
`crates/vlog_linter/src/{waiver_file.rs,waiver.rs,lib.rs}`,
`crates/lucisv_core/src/config.rs`,
`crates/lucisv/src/{args.rs,lint.rs,main.rs}`,
`crates/lucisv_server/src/{lint.rs,settings.rs,state.rs,server/notification.rs}`,
`editors/vscode/package.json` and `editors/vscode/README.md`, and the two test
files. Built `cargo build --release -p lucisv -p lucisv_server`, then attacked
the grammar, precedence and both front ends by hand, using scratch files under
the session scratchpad and read-only runs over opentitan. Every experiment
that needed a real request over the wire (server disk re-read, code-action
gap) was a temporary `#[test]` appended to `crates/lucisv_server/tests/e2e.rs`,
run under `tools/guard.sh`, then removed — `git diff --stat` on that file
after removal matches the dev's own 81-line addition exactly, confirming no
residue.
**CLI grammar — all shapes and errors, verified by direct reproduction.**
`--rule` alone, `--line=N`, `--line=N-M`, `--location=name.sv`,
`--location=dir/name.sv` (suffix), all three together in every order (3
permutations tried) — every shape suppresses exactly the finding(s) it should
and nothing else. Every error message in the Work Log fires with the
`<file>:<line>: message` shape and exit 2: bad keyword, missing `--rule`,
unknown rule, severity-as-rule, `--line=0`, `--line=9-5`, non-numeric
`--line`, doubled flag, unknown flag, `--regex=`, flag with no value, empty
value, a regex-looking `--location` (with the reason named). With three bad
lines in one file (line 1 fine, line 2 and 3 both bad), only line 2 is
reported — the **first** bad line, confirmed. With two waiver files
(`goodA.waiver` clean, `badB.waiver` bad), the error correctly names
`badB.waiver`, not a false-positive stop at the first file.
Edge cases: `--line=5-5` behaves as a one-line range; `--line=1-4` spanning
the whole 4-line file waives every occurrence; `--line=100` past EOF is
reported `unused-waiver`, never an error; `--location` naming a file absent
from the run is reported unused; `--location=f*.sv` and `--location=**/foo.sv`
both match via the `--exclude` glob semantics as documented; CRLF endings
parse every directive without shifting reported line numbers (multi-line CRLF
file tested, both directives fired); a UTF-8 BOM before `waive` is rejected
with a (slightly odd but non-corrupting) "found `\u{feff}waive`" message, exit
2 — acceptable, not a hazard; tabs between `--rule=`/`--line=`/`--location=`
words parse fine (`split_whitespace` handles them); `Waive` (capitalized) is
correctly rejected — the grammar is case-sensitive as specified; an empty
waiver file contributes nothing and errors nothing; a directory given as
`--waiver-file` surfaces the OS "Is a directory" error at exit 2; a
non-UTF-8 waiver file is rejected with "stream did not contain valid UTF-8",
exit 2. The same waiver file given twice via `--waiver-file` is read once —
confirmed by only one `unused-waiver` finding, not two, for a dead directive
in it.
Discovery combinations: `[lint] waivers` in a `lucisv.toml` (resolved
against the toml's directory) plus `--waiver-file` (resolved against the
cwd) from a **different cwd** than the toml's directory both applied
together correctly, suppressing both their respective lines. A `lucisv.toml`
pointing at a missing waiver file fails the run with the resolved absolute
path and exit 2.
**Precedence — union, exactly as specified.** A finding covered by both an
inline `// lucisv: waive` and a matching external directive is suppressed
once, and **neither** is reported unused. An inline waiver covering nothing
plus an external one covering the actual finding: the inline is reported
`unused-waiver`, the external (which fired) is not. `--select` excluding the
waived rule entirely makes the waiver silent (no `unused-waiver`) — consistent
with existing inline-waiver behavior and documented in the Assumptions.
`--fix` with a waived fixable violation: reproduced on a scratch copy (never
opentitan) — the waived line's tab was left untouched while an unwaived tab
on another line was fixed in the same run. Exit code and `--output-format
json`: an unused external waiver flows through as an ordinary violation
(`"filename":"<waiver-file>"`, correct line/column) and contributes to the
non-zero exit code.
**Server, over the wire (temporary e2e tests, removed after).** `[lint]
waivers` in a checked-in `lucisv.toml` suppresses a published diagnostic
(confirmed both standalone and combined with `lucisv.lint.waivers`).
`workspace/didChangeConfiguration` adding, then removing, then re-adding
`lucisv.lint.waivers` mid-session updates published diagnostics each time
(`[1,2] → [2] → [1,2] → [2]`, 0-based `no-tabs` lines, across four pushes) —
no reload needed. A waiver file **edited on disk while the server runs** is
re-read: verified by hand-driving the JSON-RPC stream (rather than the
`talk()` helper, which writes the whole session before reading anything, so
race-free ordering needed manual interleaving) — read the first publish,
*then* rewrote the waiver file on disk, *then* sent a no-op `didChange`, and
the second publish reflected the new file content with no restart. This
matches the Assumptions section's claim exactly. A bad directive in
`lucisv.lint.waivers` is logged once via `window/logMessage` (not
`showMessage`) when the setting arrives, not once per keystroke — confirmed
both by the dev's own e2e test (exactly 2 log lines for one bad rule + one
missing file) and by code inspection: `lint::violations_in`/`LintRun::for_
document` discard the read's problem list on every pass, so only
`notification.rs`'s one-time read at settings-arrival time can log anything.
The server never publishes `unused-waiver` for an external waiver, in any of
the above scenarios — confirmed.
One clarification volunteered here since it affects how a reader should
weight the "documented" note in the config.rs precedent: a bad `[lint]
waivers` entry from a *toml* (as opposed to the `lucisv.lint.waivers`
*setting*) is silently dropped by the server with **no log line at all** —
`notification.rs::waiver_problems` only inspects the setting's own paths
(`FileConfig::default()` is passed, discarding the buffer's real config).
This is consistent with the server's pre-existing treatment of a bad
`[lint.<rule>]` entry (`lint.rs::configured`'s comment: "dropped here rather
than reported... which is where a config error belongs" — i.e. `lucisv
check`'s job), so it is not a new inconsistency, but it means a typo in a
checked-in `lucisv.toml`'s `[lint] waivers` is invisible in the editor with no
log trace at all (only `lucisv check` will ever catch it). Not filing this as
a defect since it matches standing precedent, but noting it because the plan
text's single sentence ("the server logs it through notification.rs and
drops that line, never the file") reads as if it covers all three discovery
paths, and it does not — it covers only the editor setting.
**Opentitan (read-only).** Reproduced exactly: `--select error,warning,style
hw/ip/aes/rtl` → **307**; with the `dff-name-style --line=226
--location=aes_key_expand.sv` waiver → **306**, and the missing line is
confirmed to be `aes_key_expand.sv:226:12 … [dff-name-style]`. Added: the
`--location` **suffix** form `aes/rtl/aes_key_expand.sv` → also **306**
(same result as the file-name form). A whole-file waiver
(`--rule=port-name-suffix --location=aes_wrap.sv`, no `--line`) → **304**
(three `port-name-suffix` findings in that file, all gone, zero remaining).
A waiver naming a file outside the run (`--location=nonexistent_file_xyz.sv`)
produces exactly one `unused-waiver` line. `git -C
~/repo/opentitan status --porcelain` after every run showed only the three
pre-existing modified files (`hw/ip/aes/dv/tb/tb.sv`,
`hw/top_darjeeling/ip/ast/rtl/ast.sv`, `hw/top_earlgrey/ip/ast/rtl/ast.sv`).
**Gates (all guarded).** `cargo fmt --check`: clean. `cargo clippy
--all-targets`: clean, zero warnings. `tools/guard.sh -- cargo test
--workspace`: **3 764 passed, 0 failed, 44 ignored** — matches the dev's
figure exactly. `tools/guard.sh -- tools/corpus_check.sh`: **814/820
(99.3%)**, the same six pre-existing failures (one `end`, one identifier, one
expression, one declaration/instantiation, one `;`, one lex "number base").
`tools/guard.sh -- node editors/vscode/smoke.js target/release/lucisv-server`:
OK, 20 messages.
### Findings
**HIGH — the code-action path does not honor external waivers, and the
Assumptions section understates it.** `lucisv_server::lint::fixable`
(`crates/lucisv_server/src/lint.rs:334`, called from
`code_action::code_actions`, `crates/lucisv_server/src/code_action.rs:37`)
calls the old `lint(&ctx, &default_rules())` rather than `lint_with`, so it
never consults `LintRun::external`. **Inline waivers are still respected
here** — `lint()` internally still runs `Waivers::collect(ctx)` regardless of
the `external` argument, so an inline-waived finding correctly gets no quick
fix. **External waivers are not respected at all**, and this is
reproducible, not merely theoretical:
- Reproduction (temporary e2e test, removed after): a buffer with three
tabbed lines — one inline-waived (`// lucisv: waive no-tabs`), one
externally waived via a `lucisv.toml`'s `[lint] waivers` pointing at a
waiver file with `--rule=no-tabs --line=3`, one waived by neither.
Published diagnostics correctly show only the un-waived line. A
`textDocument/codeAction` request over the whole buffer returns **two**
quickfix actions: the un-waived line (expected) **and the externally
waived line** (not expected — no action should exist for it at all). Worse,
a `source.fixAll.lucisv` request (what an editor's "format/fix on save"
sends) **actually rewrites the externally-waived line**, turning its tab
into spaces — silently overriding the waiver a team member wrote into a
checked-in `lucisv.toml`.
- The Assumptions section's claim — "A waived finding was never published,
so no lightbulb is offered for it in practice; the mismatch is pre-existing
and out of scope here" — is only half right. It is accurate for a finding
an *inline* waiver covers (no lightbulb, confirmed). It is **not** accurate
for a finding only an *external* waiver covers: `code_actions` never
consults the published diagnostics list or the request's `range` against
what the client already sees — it recomputes `fixable()` independently and
offers/applies whatever it finds, waiver or not. The QA brief's own
framing ("it is pre-existing for inline waivers too") does not hold up
against this reproduction — the inline case is fine; only the external one
is broken, and it is broken in a way that actively edits code
(`fixAll`), not merely in a way that could theoretically surface a
quickfix nobody clicks.
- This does not violate the CLAUDE.md corruption invariant (the output is a
valid, idempotent formatting change, just one the team asked to suppress
for that line) but it does defeat the stated purpose of an external
waiver for anyone with fix-on-save enabled, which is a common editor
default. Recommend `fixable` take the buffer's `ExternalWaivers` (already
computed once per `LintRun`) the same way `violations_in` does, or, if a
fix for 0.42.0 is out of scope, correcting the Assumptions section to state
the real risk plainly (external waivers are not honored by the editor's
quick-fix or fix-on-save code path) rather than describing it as
no-observable-difference.
**LOW — BOM message is unusual but not a hazard.** A waiver file with a
leading UTF-8 BOM produces `` expected a `waive` directive, found
`\u{feff}waive` `` (the BOM character embedded verbatim in the error text)
rather than a message about the BOM specifically. Exit 2, no corruption, and
BOM'd waiver files are not mentioned as a requirement anywhere in the plan —
recording this only because the QA brief asked for a BOM to be tried. Not
blocking.
**LOW — documentation precision.** The plan's discovery-rule bullet describes
the server logging behavior for a bad waiver line as if it applied uniformly
across all three discovery paths; in the implementation it applies only to
the `lucisv.lint.waivers` editor setting, and a bad `[lint] waivers` entry
from a `lucisv.toml` is silently dropped with no log at all on the server
side. This matches the server's existing, unrelated precedent for
`[lint.<rule>]` entries, so it is not a code defect, just worth a line in the
feature README's Assumptions (or the merge docs) so a future reader is not
surprised that only the editor-setting path logs.
Everything else asked for in the QA brief — every directive shape and error,
every precedence combination, `--select`/`--ignore` interaction, `--fix`
interaction, server settings roundtrip, disk re-read, toml-via-server,
opentitan counts — checked out exactly as designed and documented.
**Verdict: REWORK** — one HIGH finding (the code-action/fixAll gap for
external waivers, and the inaccurate risk description of it in the
Assumptions section). Everything else in the feature — the CLI grammar, the
CLI's own `--fix`, precedence, discovery, the diagnostics-publishing half of
the server, and the opentitan demonstration — is solid and matches the plan
precisely. The lead's call on whether the HIGH finding blocks 0.42.0 or ships
with corrected documentation and a follow-up item; either way the
Assumptions section as written should not stand unchanged, since it asserts
something this QA pass showed to be false in the `fixAll` case specifically.
## Review
**2026-09-05 — lead.** Accepted with the rework above; ships in 0.42.0 with
§38. The format, discovery and precedence are the ruled ones, and the dev's
deviations hold: the `vlog_linter ──▶ lucisv_core` edge is the right price
for one pattern language across `--exclude` and `--location` (copying the
matcher would have made two), the `Pass` struct is plain plumbing, and the
setting joins the hand-written `select`/`ignore`/`options` rather than the
generator's per-rule toggles. QA's HIGH was real and is the kind of gap a
union has to be checked for at every consumer — the fix routes the last
consumer through the run. Unused-waiver reporting on the CLI only, after the
whole run, stays as ruled. The opentitan demonstration (307 → 306 by one
directive, 304 with a whole-file rule waiver) is the behaviour asked for.
+175
View File
@@ -0,0 +1,175 @@
# Repository analysis
Audited 2026-09-04 against HEAD `d5abf81`. The manifest still declares
**v0.41.0**; HEAD includes the accepted parser-skips work intended for
v0.42.0. This is a source and documentation audit, not a new performance or
full language-conformance measurement.
## Assessment
lucisv is a complete developer-tool stack, with eight Rust crates (six
libraries and two binaries), a VS Code extension, Neovim/Vim configuration,
release/corpus scripts, and an Astro/Starlight documentation site. Its strongest
architectural choices are shared language engines, runtime formatter checks,
conservative semantic resolution, and a single owner for mutable LSP state.
The most consequential remaining issues found in this audit are coordination
between atomic writers and disagreement between project-file and editor lint
selection. The test suite passes, but neither result establishes those contracts:
the atomic tests exercise sequential replacement, and editor rule-selection
tests exercise client settings. Documentation had also fallen behind the
recent implementation rounds.
## Repository map
| Location | Responsibility and starting point |
|---|---|
| `crates/vlog_parser` | Lexer and trivia, strict/tolerant recursive descent, AST and source coordinates; start at `src/lib.rs`, then `parser/` and `ast/` |
| `crates/vlog_formatter` | AST → document IR → printer, alignment, fences, ranges, token equivalence and convergence; start at `src/format/mod.rs` and `src/verify.rs` |
| `crates/vlog_semantic` | File binding/resolution and workspace facts; start at `src/lib.rs`, `bind/`, `workspace/`, and `facts.rs` |
| `crates/vlog_linter` | 73-rule registry, lazy analysis, options, severity, inline waivers and fixes; start at `src/lib.rs`, `context.rs`, and `registry.rs` |
| `crates/vlog_refactor` | Rename/references, port edits and instance plans; shared `src/scope.rs`, whole-edit checks in `check.rs` |
| `crates/lucisv_core` | Config, filelists, walking, format cache and atomic replacement; no language-engine dependency |
| `crates/lucisv` | CLI argument handling, discovery, worker pool, reports and writes; `src/main.rs`, `args.rs`, `lint.rs` |
| `crates/lucisv_server` | Synchronous LSP transport, workspace state, overlays, scans and capability handlers; `src/main.rs`, `server/`, `state.rs` |
| `editors/` | VS Code client/grammar/settings/hierarchy UI, plus configuration examples for other editors |
| `tools/`, `scripts/`, `.gitea/workflows/` | Resource guard, corpus evaluation, artifact audits and release automation |
| `docs/features/` | Feature-specific contracts, implementation history, QA and review; 135 READMEs at audit time |
| `docs/site/` | User-facing static documentation and tracked generated output |
[topo.md](topo.md) gives dependency directions, recent cross-crate contracts,
shared interfaces, and numbered open handshakes. The manifests are authoritative
for crate edges; an absent documented edge alone does not prove two edits safe
to perform concurrently.
## Runtime behavior and limits
**Formatting.** `format_source` strictly parses input, renders a document tree,
re-lexes both versions and compares normalized tokens (including comments),
then parses/formats the output again and checks convergence. A failed check
returns an error instead of a candidate string. The CLI leaves the affected
source file alone. This protects lexical fidelity and stable layout; it does
not elaborate SystemVerilog or prove hardware equivalence. Fenced text still
has to parse. Ranges select items; fences can additionally protect statements
and class members.
**Linting.** `ParsedSource` shares a tokenization and tolerant parse, and
`LintContext` computes semantics lazily. Rules consume text, tokens, AST, and
optional project facts; malformed AST elements remain opaque. Inline waivers
filter findings, and severity is stamped centrally. The CLI/server filter
fixes through the formatter's fence API: `apply_fixes` alone does not provide
that protection. `always-comb` offers an unsafe fix; editor actions offer only
safe fixes.
**Refactoring and editor state.** Refactors use resolved source spans and check
the whole edit; source selectors must remain supersets of every file an engine
could edit or refuse over. The LSP loop owns workspace mutation, open documents
overlay disk facts, and stepped scans publish related index/include/completion
state together. Facts persist under `FACTS_FORMAT = 17`. Lazy port code actions
compute their edits on selection for capable clients. Recorded UTF-16 positions
avoid reads for closed-file file-scope definitions; members and open buffers
still use text-based locations.
**Intentional scope.** Neither parser mode performs cross-file macro expansion
or compiler elaboration. Missing definitions outside an index scope can mean
missing hints or conservative lint silence. Rootless indexing never climbs;
with depth 0 it reads siblings flat, while positive depth walks descendants.
The published 814/820 frozen-corpus result is historical feature QA evidence,
not a new corpus sweep performed by this audit. Performance reports under
`docs/performance*.md` and `docs/perf/` likewise remain dated measurements.
## Findings and follow-up priorities
### 1. Coordinate writes to a shared target
Evidence: [atomic.rs](../crates/lucisv_core/src/atomic.rs) canonicalizes the
target, then derives a temp name from the target filename and process ID.
`fs::write` opens that predictable path without exclusive creation.
[CLI dedup](../crates/lucisv/src/main.rs) folds lexical path components but
intentionally leaves symlinks unresolved. Two rayon jobs reaching one target
through different spellings can therefore share a temporary file.
A disposable probe compiled the actual `atomic.rs` and used two barrier-started
threads per round to write different 1 MiB buffers to one target. Across
**100 rounds / 200 calls, 100 writes failed**. The final file in every round
was a complete one-writer buffer; **no mixed final bytes were observed**. This
reproduces the helper's collision, not an end-to-end formatter corruption.
The probe used only `/tmp` files and ran under the resource guard.
Recommended follow-up: exclusive, unique per-operation temp files; coordinate
or deduplicate writes by target identity; add a concurrent alias regression.
The existing temp-and-rename helper is useful for sequential replacement, but
its tests do not justify a same-target concurrency guarantee. Tracked as
[topology handshake 26](topo.md).
### 2. Define a consistent project lint configuration contract
Evidence: [server linting](../crates/lucisv_server/src/lint.rs) selects rules in
`enabled_rules` from `ClientSettings` only. Its `configured` function discovers
`lucisv.toml` but reads `lint_options` and line length, not `lint_select` or
`lint_ignore`. In contrast, [CLI linting](../crates/lucisv/src/lint.rs) consumes
project selection. The server also discards invalid project option entries
with `let _ = options.set_raw(...)`; only invalid *editor* option settings
receive the corresponding per-entry log.
The docs now describe the implemented behavior: project selection controls CLI
runs; editor selection requires `lucisv.lint.*` settings; valid project rule
options are shared. Recommended follow-up: specify and test project/editor
selection precedence and surface rejected project rule options. Tracked as
topology handshake 28. This finding is from source inspection; no dedicated
wire-level configuration reproduction was run in this audit.
### 3. Keep traversal and semantic gaps explicit
The shared [directory walker](../crates/lucisv_core/src/walk.rs) recursively
follows `Path::is_dir()` with no visited-directory set. Symlink cycles remain
an existing open issue (topology handshake 8); eventual filesystem refusal is
not an explicit traversal budget or cycle policy. Prioritize a deliberate
cycle policy before broadening traversal.
Other concrete open contracts include missing type spans (handshake 2),
package re-export resolution (16), inline aggregate type arguments (17), and
cross-file rename of an internal module net (23). The parser-skips regression
suite also retains a refusal for comments immediately before a net-delay `#`
(27). These limitations should remain visible when widening grammar or index
coverage; formatter verification must continue to reject unsupported output.
## Documentation changes from this audit
- Expanded the README's architecture to cover all eight crates and documented
the runtime checks, actual indexing behavior, documentation entry points,
and guarded verification commands.
- Updated topology facts to codec 17, corrected moved module paths, recorded
recent recovery/lint/fence/atomic/LSP contracts, and closed the stale `program`
linked-editing request using the existing module-shaped AST path.
- Updated site configuration, formatter/linter guides, CLI, language tools,
architecture and API navigation for current behavior. The API index now
explicitly defers to rustdoc for exhaustive signatures and fields.
- Removed the stale `0.9.0` product version from site structured metadata;
release versions remain owned by the workspace/release files.
The parser-skips changes were already present when the audit started and were
committed by another workflow during the audit. Their QA log now records PASS;
the topology reflects that final state. This audit made no Rust implementation
changes and did not modify their feature log or backlog checkboxes.
## Validation
- `cargo fmt --all -- --check`: passed.
- `cargo clippy --workspace --all-targets -- -D warnings`: passed.
- `tools/guard.sh -- cargo test --workspace`: **3,745 passed, 0 failed,
44 ignored**, summed across 48 test/doc-test harnesses. Counts include the
post-v0.41.0 parser-skip cases and one passing doctest; ignored measurement
tests were not enabled.
- Documentation build: `ASTRO_TELEMETRY_DISABLED=1 npm run build` in
`docs/site` passed; 13 pages, Pagefind index and sitemaps generated.
- Generated-site verification: 817 local links, assets and anchors checked,
zero failures; relative links in the repository documentation checked.
`git diff --check` passed.
- Atomic-write probe: collision reproduced as described above, no repository
source files written.
The first test attempt was stopped because sandboxed `ps` prevented the guard
from measuring memory; the successful rerun used an approved environment where
monitoring worked. No corpus sweep, OpenTitan sweep, ignored benchmark run,
release packaging, or external publishing was performed by this audit.
+47 -5
View File
@@ -1,13 +1,55 @@
# lucisv documentation site
The source and generated static documentation site are self-contained in this directory.
Astro 7 and Starlight build the static user guide and reference pages from
`src/content/docs/`. Dependencies are pinned in `package.json` and
`package-lock.json`; use the lockfile when installing:
```bash
npm install
cd docs/site
npm ci
npm run dev
npm run build
```
The deployable output is `dist/`. It contains pre-rendered HTML, CSS, JavaScript, a Pagefind search index, and XML sitemaps; no application server is required.
Build and inspect the deployable output:
The site uses Astro 7 and Starlight. Documentation pages live in `src/content/docs/`, and visual customization lives in `src/styles/custom.css`.
```bash
npm run build
npm run preview
```
`dist/` contains pre-rendered HTML, CSS, JavaScript, Pagefind search, and XML
sitemaps; no application server is required. It is tracked in this repository,
so rebuild it after changing documentation and review the generated diff.
Building does not publish the site. In a restricted environment, use
`ASTRO_TELEMETRY_DISABLED=1 npm run build` to avoid Astro writing its global
telemetry preferences.
## Editing and verification
- Usage guides: `src/content/docs/start/` and `guides/`.
- CLI, lint rules, LSP, architecture and API navigation:
`src/content/docs/reference/`.
- Overview: `src/content/docs/index.mdx`.
- Routes/sidebar, site URL and metadata: `astro.config.mjs`.
- Visual styles: `src/styles/custom.css`; static media: `public/`.
The site is derived documentation. Check behavior against the Rust source,
CLI help, and feature contracts before updating prose. The repository-wide
[analysis](../repository-analysis.md) and [topology](../topo.md) cover internal
ownership and limitations. Historical coverage/performance numbers must retain
their measurement scope and date.
From the repository root, generate the canonical lint rule reference and the
complete Rust API docs with:
```bash
cargo run -p lucisv -- check --rules-doc
cargo doc --workspace --no-deps
```
The site rule page adds editorial explanations; it must agree with the
registry's rule names, severities, defaults, options and fix applicability.
The API page is navigational, not an exhaustive signature inventory.
`npm run build` validates content rendering and builds search/sitemaps.
`npm run check` invokes Astro's optional checker; it requires checker
packages beyond this site's current declared dependencies.
-1
View File
@@ -28,7 +28,6 @@ export default defineConfig({
name: 'lucisv',
applicationCategory: 'DeveloperApplication',
operatingSystem: 'macOS, Linux, Windows',
softwareVersion: '0.9.0',
license: 'https://opensource.org/licenses/MIT',
description: 'A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.',
codeRepository: 'https://git.luci.ooo/lucio/verilogrustformatter'
+1 -1
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-hero class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>404 | lucisv</title><link rel="canonical" href="https://lucisv.dev/404/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","softwareVersion":"0.9.0","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="404"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/404/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Fast, deterministic formatting, linting, and language intelligence for Verilog and SystemVerilog."/><meta name="description" content="Fast, deterministic formatting, linting, and language intelligence for Verilog and SystemVerilog."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-hero class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>404 | lucisv</title><link rel="canonical" href="https://lucisv.dev/404/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="404"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/404/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Fast, deterministic formatting, linting, and language intelligence for Verilog and SystemVerilog."/><meta name="description" content="Fast, deterministic formatting, linting, and language intelligence for Verilog and SystemVerilog."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
window.StarlightThemeProvider = (() => {
const storedTheme =
typeof localStorage !== 'undefined' && localStorage.getItem('starlight-theme');
+1 -1
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Editors & LSP | lucisv</title><link rel="canonical" href="https://lucisv.dev/guides/editors/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","softwareVersion":"0.9.0","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Editors &amp; LSP"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/guides/editors/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Set up lucisv-server in VS Code, Neovim, Vim, and other Language Server Protocol clients."/><meta name="description" content="Set up lucisv-server in VS Code, Neovim, Vim, and other Language Server Protocol clients."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Editors & LSP | lucisv</title><link rel="canonical" href="https://lucisv.dev/guides/editors/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Editors &amp; LSP"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/guides/editors/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Set up lucisv-server in VS Code, Neovim, Vim, and other Language Server Protocol clients."/><meta name="description" content="Set up lucisv-server in VS Code, Neovim, Vim, and other Language Server Protocol clients."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
window.StarlightThemeProvider = (() => {
const storedTheme =
typeof localStorage !== 'undefined' && localStorage.getItem('starlight-theme');
+8 -4
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Formatter | lucisv</title><link rel="canonical" href="https://lucisv.dev/guides/formatter/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","softwareVersion":"0.9.0","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Formatter"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/guides/formatter/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Understand lucisv’s deterministic formatting model, alignment inference, fences, ranges, and safety invariants."/><meta name="description" content="Understand lucisv’s deterministic formatting model, alignment inference, fences, ranges, and safety invariants."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Formatter | lucisv</title><link rel="canonical" href="https://lucisv.dev/guides/formatter/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Formatter"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/guides/formatter/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Understand lucisv’s deterministic formatting model, alignment inference, fences, ranges, and safety invariants."/><meta name="description" content="Understand lucisv’s deterministic formatting model, alignment inference, fences, ranges, and safety invariants."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
window.StarlightThemeProvider = (() => {
const storedTheme =
typeof localStorage !== 'undefined' && localStorage.getItem('starlight-theme');
@@ -86,7 +86,11 @@
<div class="sl-heading-wrapper level-h2"><h2 id="format-fences">Format fences</h2><a class="sl-anchor-link" href="#format-fences"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Format fences”</span></a></div>
<p>Use a standalone fence to protect hand-laid-out regions:</p>
<div class="expressive-code"><link rel="stylesheet" href="/_astro/ec.w36nc.css"><script type="module" src="/_astro/ec.0vx5m.js"></script><figure class="frame not-content"><figcaption class="header"></figcaption><pre data-language="system-verilog"><code><div class="ec-line"><div class="code"><span style="--0:#919F9F;--1:#5D6376">// verilog_format: off</span></div></div><div class="ec-line"><div class="code"><span style="--0:#C792EA;--1:#8844AE">localparam int</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#82AAFF;--1:#3B61B0">A</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#C792EA;--1:#8844AE">=</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#F78C6C;--1:#AA0982">1</span><span style="--0:#D6DEEB;--1:#403F53">;</span></div></div><div class="ec-line"><div class="code"><span style="--0:#C792EA;--1:#8844AE">localparam int</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#82AAFF;--1:#3B61B0">LONGER</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#C792EA;--1:#8844AE">=</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#F78C6C;--1:#AA0982">22</span><span style="--0:#D6DEEB;--1:#403F53">;</span></div></div><div class="ec-line"><div class="code"><span style="--0:#919F9F;--1:#5D6376">// verilog_format: on</span></div></div></code></pre><div class="copy"><div aria-live="polite"></div><button title="Copy to clipboard" data-copied="Copied!" data-code="// verilog_format: offlocalparam int A = 1;localparam int LONGER = 22;// verilog_format: on"><div></div></button></div></figure></div>
<p><code dir="auto">// lucisv: off</code> and <code dir="auto">// lucisv: on</code> are aliases. Fences preserve exact bytes inside whole-item regions and also prevent lint fixes there.</p>
<p><code dir="auto">// lucisv: off</code> and <code dir="auto">// lucisv: on</code> are aliases. Fences preserve exact bytes between items (including class members) and
between statements in blocks, forks, functions, tasks, and procedural bodies.
They also prevent lint fixes there. A fence must begin on its own line;
port/parameter lists, case-label lists, and property/sequence local declarations
do not have independent fence scopes. Fenced text must still parse.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="range-formatting">Range formatting</h2><a class="sl-anchor-link" href="#range-formatting"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Range formatting”</span></a></div>
<p><code dir="auto">--lines</code> selects 1-based inclusive ranges:</p>
<div class="expressive-code"><figure class="frame is-terminal not-content"><figcaption class="header"><span class="title"></span><span class="sr-only">Terminal window</span></figcaption><pre data-language="bash"><code><div class="ec-line"><div class="code"><span style="--0:#82AAFF;--1:#3B61B0">lucisv</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#82AAFF;--1:#3B61B0">--lines</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">120-134</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">rtl/alu.sv</span></div></div><div class="ec-line"><div class="code"><span style="--0:#82AAFF;--1:#3B61B0">lucisv</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#82AAFF;--1:#3B61B0">--lines</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">3-9,40</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#82AAFF;--1:#3B61B0">--check</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">rtl/alu.sv</span></div></div></code></pre><div class="copy"><div aria-live="polite"></div><button title="Copy to clipboard" data-copied="Copied!" data-code="lucisv --lines 120-134 rtl/alu.svlucisv --lines 3-9,40 --check rtl/alu.sv"><div></div></button></div></figure></div>
@@ -94,9 +98,9 @@
<div class="sl-heading-wrapper level-h2"><h2 id="safety-invariants">Safety invariants</h2><a class="sl-anchor-link" href="#safety-invariants"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Safety invariants”</span></a></div>
<ol>
<li><strong>Parse first.</strong> Whole-file formatting produces no output for a file that cannot be fully parsed.</li>
<li><strong>Preserve meaning.</strong> Verification compares normalized syntax before accepting output.</li>
<li><strong>Preserve meaning.</strong> Verification re-lexes input and output and compares normalized tokens, including comments; it does not elaborate the design.</li>
<li><strong>Converge.</strong> Formatting twice reaches the same fixed point.</li>
<li><strong>Write atomically.</strong> An error leaves the affected file untouched.</li>
<li><strong>Stay deterministic.</strong> Parallel worker count changes performance, never output order or exit status.</li>
</ol>
</div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/guides/formatter.md" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-08-27T03:31:44.000Z">Aug 27, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/start/configuration/" rel="prev" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span class="astro-jgq3vlii">Previous<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Configuration</span></span></a><a href="/guides/linter/" rel="next" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span class="astro-jgq3vlii">Next<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Linter</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>
</div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/guides/formatter.md" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-09-05T04:37:55.000Z">Sep 5, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/start/configuration/" rel="prev" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span class="astro-jgq3vlii">Previous<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Configuration</span></span></a><a href="/guides/linter/" rel="next" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span class="astro-jgq3vlii">Next<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Linter</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>
+40 -6
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Linter | lucisv</title><link rel="canonical" href="https://lucisv.dev/guides/linter/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","softwareVersion":"0.9.0","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Linter"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/guides/linter/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Run lucisv lint checks, select rules, apply safe fixes, configure output, and use source waivers."/><meta name="description" content="Run lucisv lint checks, select rules, apply safe fixes, configure output, and use source waivers."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Linter | lucisv</title><link rel="canonical" href="https://lucisv.dev/guides/linter/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Linter"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/guides/linter/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Run lucisv lint checks, select rules, apply safe fixes, configure output, and use source waivers."/><meta name="description" content="Run lucisv lint checks, select rules, apply safe fixes, configure output, and use source waivers."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
window.StarlightThemeProvider = (() => {
const storedTheme =
typeof localStorage !== 'undefined' && localStorage.getItem('starlight-theme');
@@ -70,16 +70,50 @@
})();
</script></sl-sidebar-state-persist><div class="md:sl-hidden"><div class="mobile-preferences sl-flex astro-b5gddk54"><div class="social-icons astro-b5gddk54"><a href="https://git.luci.ooo/lucio/verilogrustformatter" rel="me" class="sl-flex astro-cg55etiy"><span class="sr-only astro-cg55etiy">Source repository</span><svg aria-hidden="true" class="astro-cg55etiy astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M12 .3a12 12 0 0 0-3.8 23.38c.6.12.83-.26.83-.57L9 21.07c-3.34.72-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.08-.74.09-.73.09-.73 1.2.09 1.83 1.24 1.83 1.24 1.08 1.83 2.81 1.3 3.5 1 .1-.78.42-1.31.76-1.61-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.14-.3-.54-1.52.1-3.18 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.28-1.55 3.29-1.23 3.29-1.23.64 1.66.24 2.88.12 3.18a4.65 4.65 0 0 1 1.23 3.22c0 4.61-2.8 5.63-5.48 5.92.42.36.81 1.1.81 2.22l-.01 3.29c0 .31.2.69.82.57A12 12 0 0 0 12 .3Z"/></svg></a></div><starlight-theme-select><label style="--sl-select-width: 6.25em" class="astro-r2p65idu"><span class="sr-only astro-r2p65idu">Select theme</span><svg aria-hidden="true" class="icon label-icon astro-r2p65idu astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M21 14h-1V7a3 3 0 0 0-3-3H7a3 3 0 0 0-3 3v7H3a1 1 0 0 0-1 1v2a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-2a1 1 0 0 0-1-1ZM6 7a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v7H6V7Zm14 10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-1h16v1Z"/></svg><select autocomplete="off" class="astro-r2p65idu"><option value="dark" class="astro-r2p65idu">Dark</option><option value="light" class="astro-r2p65idu">Light</option><option value="auto" selected class="astro-r2p65idu">Auto</option></select><svg aria-hidden="true" class="icon caret astro-r2p65idu astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M17 9.17a1 1 0 0 0-1.41 0L12 12.71 8.46 9.17a1 1 0 1 0-1.41 1.42l4.24 4.24a1.002 1.002 0 0 0 1.42 0L17 10.59a1.002 1.002 0 0 0 0-1.42Z"/></svg></label></starlight-theme-select><script>
StarlightThemeProvider.updatePickers();
</script></div></div></div></div></nav><div class="main-frame astro-gqpr5s5a"><script type="module">var e=document.getElementById(`starlight__sidebar`),t=e?.querySelector(`sl-sidebar-state-persist`),n=`sl-sidebar-state`,r=()=>{let r=[],i=t?.dataset.hash||``;try{let e=sessionStorage.getItem(n),t=JSON.parse(e||`{}`);Array.isArray(t.open)&&t.hash===i&&(r=t.open)}catch{}return{hash:i,open:r,scroll:e?.scrollTop||0}},i=e=>{try{sessionStorage.setItem(n,JSON.stringify(e))}catch{}},a=()=>i(r()),o=(e,t)=>{let n=r();n.open[t]=e,i(n)};t?.addEventListener(`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`summary`)?.closest(`details`);if(!t)return;let n=t.querySelector(`sl-sidebar-restore`),r=parseInt(n?.dataset.index||``);isNaN(r)||o(!t.open,r)}),addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&a()});</script><div class="lg:sl-flex astro-abfeecmu"><aside class="right-sidebar-container print:hidden astro-abfeecmu"><div class="right-sidebar astro-abfeecmu"><div class="lg:sl-hidden astro-q5mffni3"><mobile-starlight-toc data-min-h="2" data-max-h="3" class="astro-5ulgm6bh"><nav aria-labelledby="starlight__on-this-page--mobile" class="astro-5ulgm6bh"><details id="starlight__mobile-toc" class="astro-5ulgm6bh"><summary id="starlight__on-this-page--mobile" class="sl-flex astro-5ulgm6bh"><span class="toggle sl-flex astro-5ulgm6bh">On this page<svg aria-hidden="true" class="caret astro-5ulgm6bh astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg></span><span class="display-current astro-5ulgm6bh"></span></summary><div class="dropdown astro-5ulgm6bh"><ul class="isMobile astro-cxyftcne" style="--depth: 0;"><li style="--depth: 0;" class="astro-cxyftcne"><a href="#_top" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Overview</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#selecting-rules" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Selecting rules</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#fixes" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Fixes</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#waivers" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Waivers</span></a></li></ul></div></details></nav></mobile-starlight-toc><script type="module" src="/_astro/MobileTableOfContents.astro_astro_type_script_index_0_lang.BcSo_yiZ.js"></script></div><div class="right-sidebar-panel sl-hidden lg:sl-block astro-q5mffni3"><div class="sl-container astro-q5mffni3"><starlight-toc data-min-h="2" data-max-h="3"><nav aria-labelledby="starlight__on-this-page"><h2 id="starlight__on-this-page">On this page</h2><ul class="astro-cxyftcne" style="--depth: 0;"><li style="--depth: 0;" class="astro-cxyftcne"><a href="#_top" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Overview</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#selecting-rules" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Selecting rules</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#fixes" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Fixes</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#waivers" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Waivers</span></a></li></ul></nav></starlight-toc><script type="module" src="/_astro/TableOfContents.astro_astro_type_script_index_0_lang.Csloo1VZ.js"></script></div></div></div></aside><div class="main-pane astro-abfeecmu"><main data-pagefind-body class="astro-vdxcvpsm" lang="en" dir="ltr"><div class="content-panel astro-oil7k7jf"><div class="sl-container astro-oil7k7jf"><h1 id="_top" class="astro-2sm4b3ln">Linter</h1></div></div><div class="content-panel astro-oil7k7jf"><div class="sl-container astro-oil7k7jf"><div class="sl-markdown-content"><p>The linter shares discovery, parsing, configuration, and ignore behavior with the formatter, but uses error-tolerant parsing so it can report useful findings from partially understood files.</p>
</script></div></div></div></div></nav><div class="main-frame astro-gqpr5s5a"><script type="module">var e=document.getElementById(`starlight__sidebar`),t=e?.querySelector(`sl-sidebar-state-persist`),n=`sl-sidebar-state`,r=()=>{let r=[],i=t?.dataset.hash||``;try{let e=sessionStorage.getItem(n),t=JSON.parse(e||`{}`);Array.isArray(t.open)&&t.hash===i&&(r=t.open)}catch{}return{hash:i,open:r,scroll:e?.scrollTop||0}},i=e=>{try{sessionStorage.setItem(n,JSON.stringify(e))}catch{}},a=()=>i(r()),o=(e,t)=>{let n=r();n.open[t]=e,i(n)};t?.addEventListener(`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`summary`)?.closest(`details`);if(!t)return;let n=t.querySelector(`sl-sidebar-restore`),r=parseInt(n?.dataset.index||``);isNaN(r)||o(!t.open,r)}),addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&a()});</script><div class="lg:sl-flex astro-abfeecmu"><aside class="right-sidebar-container print:hidden astro-abfeecmu"><div class="right-sidebar astro-abfeecmu"><div class="lg:sl-hidden astro-q5mffni3"><mobile-starlight-toc data-min-h="2" data-max-h="3" class="astro-5ulgm6bh"><nav aria-labelledby="starlight__on-this-page--mobile" class="astro-5ulgm6bh"><details id="starlight__mobile-toc" class="astro-5ulgm6bh"><summary id="starlight__on-this-page--mobile" class="sl-flex astro-5ulgm6bh"><span class="toggle sl-flex astro-5ulgm6bh">On this page<svg aria-hidden="true" class="caret astro-5ulgm6bh astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg></span><span class="display-current astro-5ulgm6bh"></span></summary><div class="dropdown astro-5ulgm6bh"><ul class="isMobile astro-cxyftcne" style="--depth: 0;"><li style="--depth: 0;" class="astro-cxyftcne"><a href="#_top" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Overview</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#selecting-rules" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Selecting rules</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#fixes" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Fixes</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#options-and-diagnostics" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Options and diagnostics</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#waivers" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Waivers</span></a></li></ul></div></details></nav></mobile-starlight-toc><script type="module" src="/_astro/MobileTableOfContents.astro_astro_type_script_index_0_lang.BcSo_yiZ.js"></script></div><div class="right-sidebar-panel sl-hidden lg:sl-block astro-q5mffni3"><div class="sl-container astro-q5mffni3"><starlight-toc data-min-h="2" data-max-h="3"><nav aria-labelledby="starlight__on-this-page"><h2 id="starlight__on-this-page">On this page</h2><ul class="astro-cxyftcne" style="--depth: 0;"><li style="--depth: 0;" class="astro-cxyftcne"><a href="#_top" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Overview</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#selecting-rules" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Selecting rules</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#fixes" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Fixes</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#options-and-diagnostics" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Options and diagnostics</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#waivers" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Waivers</span></a></li></ul></nav></starlight-toc><script type="module" src="/_astro/TableOfContents.astro_astro_type_script_index_0_lang.Csloo1VZ.js"></script></div></div></div></aside><div class="main-pane astro-abfeecmu"><main data-pagefind-body class="astro-vdxcvpsm" lang="en" dir="ltr"><div class="content-panel astro-oil7k7jf"><div class="sl-container astro-oil7k7jf"><h1 id="_top" class="astro-2sm4b3ln">Linter</h1></div></div><div class="content-panel astro-oil7k7jf"><div class="sl-container astro-oil7k7jf"><div class="sl-markdown-content"><p>The linter shares discovery, parsing, configuration, and ignore behavior with the formatter, but uses error-tolerant parsing so it can report useful findings from partially understood files.</p>
<div class="expressive-code"><link rel="stylesheet" href="/_astro/ec.w36nc.css"><script type="module" src="/_astro/ec.0vx5m.js"></script><figure class="frame is-terminal not-content"><figcaption class="header"><span class="title"></span><span class="sr-only">Terminal window</span></figcaption><pre data-language="bash"><code><div class="ec-line"><div class="code"><span style="--0:#82AAFF;--1:#3B61B0">lucisv</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">check</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">rtl/</span></div></div><div class="ec-line"><div class="code"><span style="--0:#82AAFF;--1:#3B61B0">lucisv</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">check</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#82AAFF;--1:#3B61B0">--select</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">no-tabs,unused-signal</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">rtl/</span></div></div><div class="ec-line"><div class="code"><span style="--0:#82AAFF;--1:#3B61B0">lucisv</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">check</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#82AAFF;--1:#3B61B0">--ignore</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">module-filename</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">rtl/</span></div></div><div class="ec-line"><div class="code"><span style="--0:#82AAFF;--1:#3B61B0">lucisv</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">check</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#82AAFF;--1:#3B61B0">--fix</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">rtl/</span></div></div><div class="ec-line"><div class="code"><span style="--0:#82AAFF;--1:#3B61B0">lucisv</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">check</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#82AAFF;--1:#3B61B0">--output-format</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">json</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#ECC48D;--1:#3B61B0">rtl/</span></div></div></code></pre><div class="copy"><div aria-live="polite"></div><button title="Copy to clipboard" data-copied="Copied!" data-code="lucisv check rtl/lucisv check --select no-tabs,unused-signal rtl/lucisv check --ignore module-filename rtl/lucisv check --fix rtl/lucisv check --output-format json rtl/"><div></div></button></div></figure></div>
<div class="sl-heading-wrapper level-h2"><h2 id="selecting-rules">Selecting rules</h2><a class="sl-anchor-link" href="#selecting-rules"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Selecting rules”</span></a></div>
<p><code dir="auto">--select</code> replaces the default set with a comma-separated list. It can be repeated. <code dir="auto">--ignore</code> then removes rules from the selected or default set. Both can also be written in <code dir="auto">lucisv.toml</code> under a <code dir="auto">[lint]</code> table (<code dir="auto">select = [...]</code>, <code dir="auto">ignore = [...]</code>), which a command-line flag overrides key by key, and in an editor as <code dir="auto">lucisv.lint.select</code> / <code dir="auto">lucisv.lint.ignore</code>.</p>
<p><code dir="auto">--select</code> replaces the default set with a comma-separated list. It can be repeated. <code dir="auto">--ignore</code> then removes rules from the selected or default set. Both accept rule names and the severity classes <code dir="auto">error</code>, <code dir="auto">warning</code>, and <code dir="auto">style</code> (for example, <code dir="auto">--ignore style</code>). Both can also be written in <code dir="auto">lucisv.toml</code> under a <code dir="auto">[lint]</code> table (<code dir="auto">select = [...]</code>, <code dir="auto">ignore = [...]</code>), which a command-line flag overrides key by key, and in an editor as <code dir="auto">lucisv.lint.select</code> / <code dir="auto">lucisv.lint.ignore</code>.</p>
<p>The semantic rules — <code dir="auto">unused-signal</code>, <code dir="auto">undriven-net</code>, <code dir="auto">multiply-driven</code> — run by default wherever lucisv can see the other files of your project (<code dir="auto">lucisv check rtl/</code>, or the language server), because it can then tell that another file reads a signal through a hierarchical path. Over a <strong>single file</strong> or a stdin buffer there is nothing to ask, so they are off and must be <code dir="auto">--select</code>ed.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="fixes">Fixes</h2><a class="sl-anchor-link" href="#fixes"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Fixes”</span></a></div>
<p><code dir="auto">--fix</code> applies safe changes and rewrites the file. Today, <code dir="auto">no-tabs</code> and <code dir="auto">no-trailing-whitespace</code> provide safe fixes. <code dir="auto">--unsafe-fixes</code> widens applicability, but no built-in rule currently offers an unsafe fix.</p>
<p>Fixes are sorted, overlap-checked, and never applied inside format-fenced regions.</p>
<p><code dir="auto">--fix</code> applies safe changes and rewrites the file. Safe fixes include whitespace cleanup, <code dir="auto">posix-eof</code>, <code dir="auto">empty-item</code>,
<code dir="auto">undersized-binary-literal</code>, <code dir="auto">explicit-begin</code>, <code dir="auto">suggest-parentheses</code>, and
<code dir="auto">endif-comment</code>; the rule reference lists applicability per rule.
<code dir="auto">--unsafe-fixes</code> also permits the <code dir="auto">always-comb</code> rewrite, whose scheduling
semantics can differ from <code dir="auto">always @*</code>. Editor quick fixes offer safe fixes only.</p>
<p>Fixes are sorted, overlap-checked, and filtered against format-fenced regions
by the CLI and server. The reusable linter and <code dir="auto">apply_fixes</code> API are
fence-blind; callers performing automatic edits must apply that protection.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="options-and-diagnostics">Options and diagnostics</h2><a class="sl-anchor-link" href="#options-and-diagnostics"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Options and diagnostics”</span></a></div>
<p>Use <code dir="auto">[lint.&lt;rule&gt;]</code> in <code dir="auto">lucisv.toml</code> or <code dir="auto">lucisv.lint.options</code> in the editor for
per-rule options. See <a href="/start/configuration/">configuration</a> for precedence.
<code dir="auto">lucisv check --rules-doc</code> prints all 73 registered rules, their severity,
default selection, fix applicability, and option defaults.</p>
<p>Text output uses <code dir="auto">FILE:LINE:COL: severity: message [rule]</code>. JSON output is one
array, with a <code dir="auto">severity</code> field on each diagnostic.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="waivers">Waivers</h2><a class="sl-anchor-link" href="#waivers"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Waivers”</span></a></div>
<div class="expressive-code"><figure class="frame not-content"><figcaption class="header"></figcaption><pre data-language="system-verilog"><code><div class="ec-line"><div class="code"><span style="--0:#C792EA;--1:#8844AE">wire</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#C5E478;--1:#3B61B0">a</span><span style="--0:#D6DEEB;--1:#403F53">; </span><span style="--0:#919F9F;--1:#5D6376">// lucisv: waive no-tabs</span></div></div><div class="ec-line"><div class="code"><span style="--0:#919F9F;--1:#5D6376">// lucisv: waive no-tabs</span></div></div><div class="ec-line"><div class="code"><span style="--0:#C792EA;--1:#8844AE">wire</span><span style="--0:#D6DEEB;--1:#403F53"> </span><span style="--0:#C5E478;--1:#3B61B0">b</span><span style="--0:#D6DEEB;--1:#403F53">;</span></div></div><div class="ec-line"><div class="code"><span style="--0:#919F9F;--1:#5D6376">// lucisv: waive-start module-name-style</span></div></div><div class="ec-line"><div class="code"><span style="--0:#C792EA;--1:#8844AE">module</span><span style="--0:#D6DEEB;--1:#403F53"> LegacyName;</span></div></div><div class="ec-line"><div class="code"><span style="--0:#C792EA;--1:#8844AE">endmodule</span></div></div><div class="ec-line"><div class="code"><span style="--0:#919F9F;--1:#5D6376">// lucisv: waive-stop module-name-style</span></div></div></code></pre><div class="copy"><div aria-live="polite"></div><button title="Copy to clipboard" data-copied="Copied!" data-code="wire a; // lucisv: waive no-tabs// lucisv: waive no-tabswire b;// lucisv: waive-start module-name-stylemodule LegacyName;endmodule// lucisv: waive-stop module-name-style"><div></div></button></div></figure></div>
<p><code dir="auto">verilog_lint:</code> is accepted in place of <code dir="auto">lucisv:</code> for Verible compatibility. The <code dir="auto">unused-waiver</code> rule reports malformed, unknown, or no-longer-needed suppressions when their target rule is enabled.</p>
<p>Findings can also be suppressed from <strong>outside</strong> the RTL, in Verible’s
waiver-file format — one directive per line, <code dir="auto">#</code> comments and blank lines
ignored:</p>
<div class="expressive-code"><figure class="frame not-content"><figcaption class="header"></figcaption><pre data-language="text"><code><div class="ec-line"><div class="code"><span style="--0:#d6deeb;--1:#403f53"># every line of every file</span></div></div><div class="ec-line"><div class="code"><span style="--0:#d6deeb;--1:#403f53">waive --rule=no-tabs</span></div></div><div class="ec-line"><div class="code"><span style="--0:#d6deeb;--1:#403f53"># one line, or a range with both ends included</span></div></div><div class="ec-line"><div class="code"><span style="--0:#d6deeb;--1:#403f53">waive --rule=line-length --line=12</span></div></div><div class="ec-line"><div class="code"><span style="--0:#d6deeb;--1:#403f53">waive --rule=line-length --line=12-20</span></div></div><div class="ec-line"><div class="code"><span style="--0:#d6deeb;--1:#403f53"># only the files a pattern names</span></div></div><div class="ec-line"><div class="code"><span style="--0:#d6deeb;--1:#403f53">waive --rule=no-tabs --location=legacy/top.sv</span></div></div></code></pre><div class="copy"><div aria-live="polite"></div><button title="Copy to clipboard" data-copied="Copied!" data-code="# every line of every filewaive --rule=no-tabs# one line, or a range with both ends includedwaive --rule=line-length --line=12waive --rule=line-length --line=12-20# only the files a pattern nameswaive --rule=no-tabs --location=legacy/top.sv"><div></div></button></div></figure></div>
<p><code dir="auto">--rule</code> is required and names exactly one rule (a severity word is not
accepted). <code dir="auto">--line</code> is 1-based. <code dir="auto">--location</code> is matched the way an
<code dir="auto">--exclude</code> pattern is — <code dir="auto">*</code> within one path component, a pattern with <code dir="auto">/</code>
matching a path suffix, one without matching the file name at any depth — and
<strong>not</strong> as a regular expression; a pattern that looks like one (<code dir="auto">.*</code>, <code dir="auto">\.</code>,
<code dir="auto">[…]</code>) is an error naming the difference.</p>
<p>Waiver files come from three places, and they add up: <code dir="auto">lucisv check --waiver-file &lt;path&gt;</code> (repeatable, relative to the working directory),
<code dir="auto">waivers</code> under <code dir="auto">[lint]</code> in <code dir="auto">lucisv.toml</code> (relative to that file; read by the
CLI and the editor), and the editor setting <code dir="auto">lucisv.lint.waivers</code> (relative to
the first workspace folder). External and inline waivers are a union: a
finding either covers is suppressed, and one both cover leaves neither
reported as dead. A missing file or an unparsable directive fails <code dir="auto">lucisv check</code> with <code dir="auto">&lt;file&gt;:&lt;line&gt;: &lt;message&gt;</code> and exit 2; in an editor the bad line
is dropped and the rest of the file applies — a bad line in a file named by
the editor setting is written once to the lucisv log, one named by
<code dir="auto">lucisv.toml</code> is not (run <code dir="auto">lucisv check</code> to see it). Unused external waivers
are reported under <code dir="auto">unused-waiver</code> at their line of the waiver file, by
<code dir="auto">lucisv check</code> only and only after the whole run.</p>
<p>See the <a href="/reference/rules/">complete rule reference</a>.</p>
</div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/guides/linter.md" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-09-02T16:06:08.000Z">Sep 2, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/guides/formatter/" rel="prev" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span class="astro-jgq3vlii">Previous<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Formatter</span></span></a><a href="/guides/editors/" rel="next" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span class="astro-jgq3vlii">Next<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Editors &amp; LSP</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>
</div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/guides/linter.md" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-09-05T04:37:55.000Z">Sep 5, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/guides/formatter/" rel="prev" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span class="astro-jgq3vlii">Previous<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Formatter</span></span></a><a href="/guides/editors/" rel="next" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span class="astro-jgq3vlii">Next<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Editors &amp; LSP</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>
+2 -2
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Supported syntax | lucisv</title><link rel="canonical" href="https://lucisv.dev/guides/syntax/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","softwareVersion":"0.9.0","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Supported syntax"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/guides/syntax/"/><meta property="og:locale" content="en"/><meta property="og:description" content="The Verilog and SystemVerilog language surface understood by lucisv."/><meta name="description" content="The Verilog and SystemVerilog language surface understood by lucisv."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Supported syntax | lucisv</title><link rel="canonical" href="https://lucisv.dev/guides/syntax/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Supported syntax"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/guides/syntax/"/><meta property="og:locale" content="en"/><meta property="og:description" content="The Verilog and SystemVerilog language surface understood by lucisv."/><meta name="description" content="The Verilog and SystemVerilog language surface understood by lucisv."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
window.StarlightThemeProvider = (() => {
const storedTheme =
typeof localStorage !== 'undefined' && localStorage.getItem('starlight-theme');
@@ -109,4 +109,4 @@
<div class="sl-heading-wrapper level-h2"><h2 id="not-supported">Not supported</h2><a class="sl-anchor-link" href="#not-supported"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Not supported”</span></a></div>
<p><code dir="auto">randsequence</code> and a small set of rare expression/port forms remain outside the formatter grammar. lucisv also does not run a preprocessor, so a file that becomes valid only after cross-file macro expansion may not format as a standalone input.</p>
<aside aria-label="Safe failure" class="starlight-aside starlight-aside--caution"><p class="starlight-aside__title" aria-hidden="true"><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" class="starlight-aside__icon"><path d="M12 16a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm10.67 1.47-8.05-14a3 3 0 0 0-5.24 0l-8 14A3 3 0 0 0 3.94 22h16.12a3 3 0 0 0 2.61-4.53Zm-1.73 2a1 1 0 0 1-.88.51H3.94a1 1 0 0 1-.88-.51 1 1 0 0 1 0-1l8-14a1 1 0 0 1 1.78 0l8.05 14a1 1 0 0 1 .05 1.02v-.02ZM12 8a1 1 0 0 0-1 1v4a1 1 0 0 0 2 0V9a1 1 0 0 0-1-1Z"/></svg>Safe failure</p><div class="starlight-aside__content"><p>Whole-file formatting returns an error and writes nothing when parsing is incomplete. lucisv never emits a partially understood file.</p></div></aside>
</div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/guides/syntax.md" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-08-27T03:31:44.000Z">Aug 27, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/guides/editors/" rel="prev" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span class="astro-jgq3vlii">Previous<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Editors &amp; LSP</span></span></a><a href="/reference/cli/" rel="next" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span class="astro-jgq3vlii">Next<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">CLI</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>
</div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/guides/syntax.md" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-09-03T09:28:11.000Z">Sep 3, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/guides/editors/" rel="prev" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span class="astro-jgq3vlii">Previous<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Editors &amp; LSP</span></span></a><a href="/reference/cli/" rel="next" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span class="astro-jgq3vlii">Next<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">CLI</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>
+2 -2
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-hero class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>lucisv — Verilog tooling that stays out of your way | lucisv</title><link rel="canonical" href="https://lucisv.dev/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","softwareVersion":"0.9.0","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="lucisv — Verilog tooling that stays out of your way"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Format, lint, navigate, and refactor Verilog and SystemVerilog with one fast Rust toolchain."/><meta name="description" content="Format, lint, navigate, and refactor Verilog and SystemVerilog with one fast Rust toolchain."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-hero class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>lucisv — Verilog tooling that stays out of your way | lucisv</title><link rel="canonical" href="https://lucisv.dev/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="lucisv — Verilog tooling that stays out of your way"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Format, lint, navigate, and refactor Verilog and SystemVerilog with one fast Rust toolchain."/><meta name="description" content="Format, lint, navigate, and refactor Verilog and SystemVerilog with one fast Rust toolchain."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
window.StarlightThemeProvider = (() => {
const storedTheme =
typeof localStorage !== 'undefined' && localStorage.getItem('starlight-theme');
@@ -41,4 +41,4 @@
</script><script type="module">var e=`starlight-theme`,t=e=>e===`auto`||e===`dark`||e===`light`?e:`auto`,n=()=>t(typeof localStorage<`u`&&localStorage.getItem(e));function r(t){typeof localStorage<`u`&&localStorage.setItem(e,t===`light`||t===`dark`?t:``)}var i=()=>matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`;function a(e){StarlightThemeProvider.updatePickers(e),document.documentElement.dataset.theme=e===`auto`?i():e,r(e)}matchMedia(`(prefers-color-scheme: light)`).addEventListener(`change`,()=>{n()===`auto`&&a(`auto`)});var o=class extends HTMLElement{constructor(){super(),a(n()),this.querySelector(`select`)?.addEventListener(`change`,e=>{e.currentTarget instanceof HTMLSelectElement&&a(t(e.currentTarget.value))})}};customElements.define(`starlight-theme-select`,o);</script><script type="module">var e=class extends HTMLElement{constructor(){super();let e=this.querySelector(`select`);e&&(e.addEventListener(`change`,e=>{e.currentTarget instanceof HTMLSelectElement&&(window.location.pathname=e.currentTarget.value)}),window.addEventListener(`pageshow`,t=>{if(!t.persisted)return;let n=e.querySelector(`option[selected]`)?.index;n!==e.selectedIndex&&(e.selectedIndex=n??0)}))}};customElements.define(`starlight-lang-select`,e);</script></div></div></header><div class="main-frame astro-gqpr5s5a"><script type="module">var e=document.getElementById(`starlight__sidebar`),t=e?.querySelector(`sl-sidebar-state-persist`),n=`sl-sidebar-state`,r=()=>{let r=[],i=t?.dataset.hash||``;try{let e=sessionStorage.getItem(n),t=JSON.parse(e||`{}`);Array.isArray(t.open)&&t.hash===i&&(r=t.open)}catch{}return{hash:i,open:r,scroll:e?.scrollTop||0}},i=e=>{try{sessionStorage.setItem(n,JSON.stringify(e))}catch{}},a=()=>i(r()),o=(e,t)=>{let n=r();n.open[t]=e,i(n)};t?.addEventListener(`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`summary`)?.closest(`details`);if(!t)return;let n=t.querySelector(`sl-sidebar-restore`),r=parseInt(n?.dataset.index||``);isNaN(r)||o(!t.open,r)}),addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&a()});</script><div class="lg:sl-flex astro-abfeecmu"><div class="main-pane astro-abfeecmu"><main data-pagefind-body class="astro-vdxcvpsm" lang="en" dir="ltr"><div class="content-panel astro-oil7k7jf"><div class="sl-container astro-oil7k7jf"><div class="hero astro-q2ezz3gc"><div class="sl-flex stack astro-q2ezz3gc"><div class="sl-flex copy astro-q2ezz3gc"><h1 id="_top" data-page-title class="astro-q2ezz3gc">SystemVerilog, understood.</h1><div class="tagline astro-q2ezz3gc">Format, lint, navigate, and refactor RTL with one fast engine—at your cursor and in CI.</div></div><div class="sl-flex actions astro-q2ezz3gc"><a class="sl-link-button not-content primary astro-q2ezz3gc astro-hlbqph7b" href="/start/quick-start/">Install lucisv<svg aria-hidden="true" class="astro-hlbqph7b astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg></a><a class="sl-link-button not-content minimal astro-q2ezz3gc astro-hlbqph7b" href="/reference/language-tools/">Explore every feature<svg aria-hidden="true" class="astro-hlbqph7b astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M21.17 2.06A13.1 13.1 0 0 0 19 1.87a12.94 12.94 0 0 0-7 2.05 12.94 12.94 0 0 0-7-2 13.1 13.1 0 0 0-2.17.19 1 1 0 0 0-.83 1v12a1 1 0 0 0 1.17 1 10.9 10.9 0 0 1 8.25 1.91l.12.07h.11a.91.91 0 0 0 .7 0h.11l.12-.07A10.899 10.899 0 0 1 20.83 16 1 1 0 0 0 22 15V3a1 1 0 0 0-.83-.94ZM11 15.35a12.87 12.87 0 0 0-6-1.48H4v-10c.333-.02.667-.02 1 0a10.86 10.86 0 0 1 6 1.8v9.68Zm9-1.44h-1a12.87 12.87 0 0 0-6 1.48V5.67a10.86 10.86 0 0 1 6-1.8c.333-.02.667-.02 1 0v10.04Zm1.17 4.15a13.098 13.098 0 0 0-2.17-.19 12.94 12.94 0 0 0-7 2.05 12.94 12.94 0 0 0-7-2.05c-.727.003-1.453.066-2.17.19A1 1 0 0 0 2 19.21a1 1 0 0 0 1.17.79 10.9 10.9 0 0 1 8.25 1.91 1 1 0 0 0 1.16 0A10.9 10.9 0 0 1 20.83 20a1 1 0 0 0 1.17-.79 1 1 0 0 0-.83-1.15Z"/></svg></a></div></div></div><div class="sl-markdown-content"><section class="feature-lead"><div><span class="section-kicker"><i></i> lucisv language server</span><h2>Real RTL. Real project context.</h2><p>Move from an instance to its module, inspect a port, rename a symbol, or fix a diagnostic without leaving the editor. The same project model powers every answer.</p></div><div class="feature-chips" aria-label="Language server capabilities"><span>Hover</span><span>Completion</span><span>Go to definition</span><span>Rename</span><span>Hierarchy</span><span>Diagnostics</span></div></section><figure class="real-editor-showcase"><div class="screenshot-frame"><img src="/images/opentitan-lucisv-vscode.png" alt="OpenTitan SystemVerilog source open in Visual SLine truncated
<div class="sl-heading-wrapper level-h2"><h2 id="everything-in-the-edit-loop">Everything in the edit loop</h2><a class="sl-anchor-link" href="#everything-in-the-edit-loop"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Everything in the edit loop”</span></a></div>
<p>Formatting, diagnostics, and code intelligence share one parser and one semantic model. The answer in CI is the answer at your cursor.</p>
<div class="capability-grid"><a class="capability-card featured" href="/reference/language-tools/#navigation-and-understanding"><span class="capability-icon">⌁</span><span class="eyebrow">Navigate</span><h3>Follow the design, not the files</h3><p>Jump through definitions, references, implementations, document symbols, workspace symbols, type definitions, and call and type hierarchies.</p><span class="card-link">Explore navigation →</span></a><a class="capability-card" href="/reference/language-tools/#editing-and-formatting"><span class="capability-icon">⌘</span><span class="eyebrow">Complete</span><h3>Context-aware suggestions</h3><p>Complete symbols, members, ports, parameters, named associations, macros, keywords, and include paths.</p></a><a class="capability-card" href="/reference/language-tools/#refactoring"><span class="capability-icon">↗</span><span class="eyebrow">Refactor</span><h3>Make project-wide changes safely</h3><p>Rename symbols, organize imports, remove unused imports, and apply quick fixes with previewable workspace edits.</p></a><a class="capability-card" href="/guides/formatter/"><span class="capability-icon">≡</span><span class="eyebrow">Format</span><h3>Deterministic by construction</h3><p>Width-aware layout, preserved comments, inferred alignment, format fences, range formatting, and idempotency checks.</p></a><a class="capability-card" href="/reference/rules/"><span class="capability-icon">△</span><span class="eyebrow">Diagnose</span><h3>RTL-aware, project-aware lint</h3><p>Seventeen focused rules, safe fixes, source waivers, and semantic checks that understand the whole workspace.</p></a><a class="capability-card wide" href="/reference/language-tools/#workspace-lifecycle"><span class="capability-icon">▱</span><span class="eyebrow">Workspace</span><h3>Built for real RTL trees</h3><p>EDA filelists, nested includes, defines, Git-style ignores, multi-root indexes, live overlays, and hierarchy-aware search all work together.</p><span class="mini-flow"><b>sources.f</b><i>→</i><b>preprocess</b><i>→</i><b>semantic index</b><i>→</i><b>editor + CI</b></span></a></div><section class="terminal-band"><div><span class="section-kicker"><i></i> Same engine, anywhere</span><h2>Editor-fast. CI-certain.</h2><p>Use <code>lucisv-server</code> from any LSP client, then enforce the exact same formatting and diagnostics with the standalone CLI.</p><a href="/start/quick-start/">Set up your editor →</a></div><pre aria-label="lucisv command line examples"><code><span class="prompt">$</span> lucisv –check rtl/<br><span class="ok">✓</span> 184 files already formatted<br><br><span class="prompt">$</span> lucisv check rtl/<br><span class="ok">✓</span> no diagnostics · 0.42s</code></pre></section><aside aria-label="Open by design" class="starlight-aside starlight-aside--note"><p class="starlight-aside__title" aria-hidden="true"><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" class="starlight-aside__icon"><path d="M12 11a1 1 0 0 0-1 1v4a1 1 0 0 0 2 0v-4a1 1 0 0 0-1-1Zm.38-3.92a1 1 0 0 0-.76 0 1 1 0 0 0-.33.21 1.15 1.15 0 0 0-.21.33 1 1 0 0 0 .21 1.09c.097.088.209.16.33.21A1 1 0 0 0 13 8a1.05 1.05 0 0 0-.29-.71 1 1 0 0 0-.33-.21ZM12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm0 18a8 8 0 1 1 0-16.001A8 8 0 0 1 12 20Z"/></svg>Open by design</p><div class="starlight-aside__content"><p>lucisv is MIT licensed. The CLI, parser, formatter, linter, semantic engine, refactoring engine, language server, and editor integrations all live in the same Rust workspace.</p></div></aside></div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/index.mdx" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-08-27T03:31:44.000Z">Aug 27, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/start/quick-start/" rel="next" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span class="astro-jgq3vlii">Next<br class="astro-jgq3vlii"><span class="link-title astrLine truncated
<div class="capability-grid"><a class="capability-card featured" href="/reference/language-tools/#navigation-and-understanding"><span class="capability-icon">⌁</span><span class="eyebrow">Navigate</span><h3>Follow the design, not the files</h3><p>Jump through definitions, references, implementations, document symbols, workspace symbols, type definitions, and call and type hierarchies.</p><span class="card-link">Explore navigation →</span></a><a class="capability-card" href="/reference/language-tools/#editing-and-formatting"><span class="capability-icon">⌘</span><span class="eyebrow">Complete</span><h3>Context-aware suggestions</h3><p>Complete symbols, members, ports, parameters, named associations, macros, keywords, and include paths.</p></a><a class="capability-card" href="/reference/language-tools/#refactoring"><span class="capability-icon">↗</span><span class="eyebrow">Refactor</span><h3>Make project-wide changes safely</h3><p>Rename symbols, organize imports, remove unused imports, and apply quick fixes with previewable workspace edits.</p></a><a class="capability-card" href="/guides/formatter/"><span class="capability-icon">≡</span><span class="eyebrow">Format</span><h3>Deterministic by construction</h3><p>Width-aware layout, preserved comments, inferred alignment, format fences, range formatting, and idempotency checks.</p></a><a class="capability-card" href="/reference/rules/"><span class="capability-icon">△</span><span class="eyebrow">Diagnose</span><h3>RTL-aware, project-aware lint</h3><p>Seventeen focused rules, safe fixes, source waivers, and semantic checks that understand the whole workspace.</p></a><a class="capability-card wide" href="/reference/language-tools/#workspace-lifecycle"><span class="capability-icon">▱</span><span class="eyebrow">Workspace</span><h3>Built for real RTL trees</h3><p>EDA filelists, nested includes, defines, Git-style ignores, multi-root indexes, live overlays, and hierarchy-aware search all work together.</p><span class="mini-flow"><b>sources.f</b><i>→</i><b>preprocess</b><i>→</i><b>semantic index</b><i>→</i><b>editor + CI</b></span></a></div><section class="terminal-band"><div><span class="section-kicker"><i></i> Same engine, anywhere</span><h2>Editor-fast. CI-certain.</h2><p>Use <code>lucisv-server</code> from any LSP client, then enforce the exact same formatting and diagnostics with the standalone CLI.</p><a href="/start/quick-start/">Set up your editor →</a></div><pre aria-label="lucisv command line examples"><code><span class="prompt">$</span> lucisv –check rtl/<br><span class="ok">✓</span> 184 files already formatted<br><br><span class="prompt">$</span> lucisv check rtl/<br><span class="ok">✓</span> no diagnostics · 0.42s</code></pre></section><aside aria-label="Open by design" class="starlight-aside starlight-aside--note"><p class="starlight-aside__title" aria-hidden="true"><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" class="starlight-aside__icon"><path d="M12 11a1 1 0 0 0-1 1v4a1 1 0 0 0 2 0v-4a1 1 0 0 0-1-1Zm.38-3.92a1 1 0 0 0-.76 0 1 1 0 0 0-.33.21 1.15 1.15 0 0 0-.21.33 1 1 0 0 0 .21 1.09c.097.088.209.16.33.21A1 1 0 0 0 13 8a1.05 1.05 0 0 0-.29-.71 1 1 0 0 0-.33-.21ZM12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm0 18a8 8 0 1 1 0-16.001A8 8 0 0 1 12 20Z"/></svg>Open by design</p><div class="starlight-aside__content"><p>lucisv is MIT licensed. The CLI, parser, formatter, linter, semantic engine, refactoring engine, language server, and editor integrations all live in the same Rust workspace.</p></div></aside></div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/index.mdx" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-09-03T09:28:11.000Z">Sep 3, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/start/quick-start/" rel="next" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span class="astro-jgq3vlii">Next<br class="astro-jgq3vlii"><span class="link-title astroLine truncated
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -1 +1 @@
{"version":"1.5.2","languages":{"en":{"hash":"en_be5ced3c43","wasm":"en","page_count":12}},"include_characters":["_","‿","⁀","⁔","︳","︴","﹍","﹎","﹏","_"]}
{"version":"1.5.2","languages":{"en":{"hash":"en_a31252bf8c","wasm":"en","page_count":12}},"include_characters":["_","‿","⁀","⁔","︳","︴","﹍","﹎","﹏","_"]}
Binary file not shown.
Binary file not shown.
+37 -7
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Architecture | lucisv</title><link rel="canonical" href="https://lucisv.dev/reference/architecture/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","softwareVersion":"0.9.0","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Architecture"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/reference/architecture/"/><meta property="og:locale" content="en"/><meta property="og:description" content="How lucisv’s parser, formatter, linter, semantics, refactors, CLI, and language server fit together."/><meta name="description" content="How lucisv’s parser, formatter, linter, semantics, refactors, CLI, and language server fit together."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Architecture | lucisv</title><link rel="canonical" href="https://lucisv.dev/reference/architecture/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Architecture"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/reference/architecture/"/><meta property="og:locale" content="en"/><meta property="og:description" content="How lucisv’s parser, formatter, linter, semantics, refactors, CLI, and language server fit together."/><meta name="description" content="How lucisv’s parser, formatter, linter, semantics, refactors, CLI, and language server fit together."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
window.StarlightThemeProvider = (() => {
const storedTheme =
typeof localStorage !== 'undefined' && localStorage.getItem('starlight-theme');
@@ -70,7 +70,7 @@
})();
</script></sl-sidebar-state-persist><div class="md:sl-hidden"><div class="mobile-preferences sl-flex astro-b5gddk54"><div class="social-icons astro-b5gddk54"><a href="https://git.luci.ooo/lucio/verilogrustformatter" rel="me" class="sl-flex astro-cg55etiy"><span class="sr-only astro-cg55etiy">Source repository</span><svg aria-hidden="true" class="astro-cg55etiy astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M12 .3a12 12 0 0 0-3.8 23.38c.6.12.83-.26.83-.57L9 21.07c-3.34.72-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.08-.74.09-.73.09-.73 1.2.09 1.83 1.24 1.83 1.24 1.08 1.83 2.81 1.3 3.5 1 .1-.78.42-1.31.76-1.61-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.14-.3-.54-1.52.1-3.18 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.28-1.55 3.29-1.23 3.29-1.23.64 1.66.24 2.88.12 3.18a4.65 4.65 0 0 1 1.23 3.22c0 4.61-2.8 5.63-5.48 5.92.42.36.81 1.1.81 2.22l-.01 3.29c0 .31.2.69.82.57A12 12 0 0 0 12 .3Z"/></svg></a></div><starlight-theme-select><label style="--sl-select-width: 6.25em" class="astro-r2p65idu"><span class="sr-only astro-r2p65idu">Select theme</span><svg aria-hidden="true" class="icon label-icon astro-r2p65idu astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M21 14h-1V7a3 3 0 0 0-3-3H7a3 3 0 0 0-3 3v7H3a1 1 0 0 0-1 1v2a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-2a1 1 0 0 0-1-1ZM6 7a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v7H6V7Zm14 10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-1h16v1Z"/></svg><select autocomplete="off" class="astro-r2p65idu"><option value="dark" class="astro-r2p65idu">Dark</option><option value="light" class="astro-r2p65idu">Light</option><option value="auto" selected class="astro-r2p65idu">Auto</option></select><svg aria-hidden="true" class="icon caret astro-r2p65idu astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M17 9.17a1 1 0 0 0-1.41 0L12 12.71 8.46 9.17a1 1 0 1 0-1.41 1.42l4.24 4.24a1.002 1.002 0 0 0 1.42 0L17 10.59a1.002 1.002 0 0 0 0-1.42Z"/></svg></label></starlight-theme-select><script>
StarlightThemeProvider.updatePickers();
</script></div></div></div></div></nav><div class="main-frame astro-gqpr5s5a"><script type="module">var e=document.getElementById(`starlight__sidebar`),t=e?.querySelector(`sl-sidebar-state-persist`),n=`sl-sidebar-state`,r=()=>{let r=[],i=t?.dataset.hash||``;try{let e=sessionStorage.getItem(n),t=JSON.parse(e||`{}`);Array.isArray(t.open)&&t.hash===i&&(r=t.open)}catch{}return{hash:i,open:r,scroll:e?.scrollTop||0}},i=e=>{try{sessionStorage.setItem(n,JSON.stringify(e))}catch{}},a=()=>i(r()),o=(e,t)=>{let n=r();n.open[t]=e,i(n)};t?.addEventListener(`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`summary`)?.closest(`details`);if(!t)return;let n=t.querySelector(`sl-sidebar-restore`),r=parseInt(n?.dataset.index||``);isNaN(r)||o(!t.open,r)}),addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&a()});</script><div class="lg:sl-flex astro-abfeecmu"><aside class="right-sidebar-container print:hidden astro-abfeecmu"><div class="right-sidebar astro-abfeecmu"><div class="lg:sl-hidden astro-q5mffni3"><mobile-starlight-toc data-min-h="2" data-max-h="3" class="astro-5ulgm6bh"><nav aria-labelledby="starlight__on-this-page--mobile" class="astro-5ulgm6bh"><details id="starlight__mobile-toc" class="astro-5ulgm6bh"><summary id="starlight__on-this-page--mobile" class="sl-flex astro-5ulgm6bh"><span class="toggle sl-flex astro-5ulgm6bh">On this page<svg aria-hidden="true" class="caret astro-5ulgm6bh astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg></span><span class="display-current astro-5ulgm6bh"></span></summary><div class="dropdown astro-5ulgm6bh"><ul class="isMobile astro-cxyftcne" style="--depth: 0;"><li style="--depth: 0;" class="astro-cxyftcne"><a href="#_top" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Overview</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#data-flow" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Data flow</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#design-invariants" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Design invariants</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#release-surface" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Release surface</span></a></li></ul></div></details></nav></mobile-starlight-toc><script type="module" src="/_astro/MobileTableOfContents.astro_astro_type_script_index_0_lang.BcSo_yiZ.js"></script></div><div class="right-sidebar-panel sl-hidden lg:sl-block astro-q5mffni3"><div class="sl-container astro-q5mffni3"><starlight-toc data-min-h="2" data-max-h="3"><nav aria-labelledby="starlight__on-this-page"><h2 id="starlight__on-this-page">On this page</h2><ul class="astro-cxyftcne" style="--depth: 0;"><li style="--depth: 0;" class="astro-cxyftcne"><a href="#_top" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Overview</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#data-flow" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Data flow</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#design-invariants" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Design invariants</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#release-surface" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Release surface</span></a></li></ul></nav></starlight-toc><script type="module" src="/_astro/TableOfContents.astro_astro_type_script_index_0_lang.Csloo1VZ.js"></script></div></div></div></aside><div class="main-pane astro-abfeecmu"><main data-pagefind-body class="astro-vdxcvpsm" lang="en" dir="ltr"><div class="content-panel astro-oil7k7jf"><div class="sl-container astro-oil7k7jf"><h1 id="_top" class="astro-2sm4b3ln">Architecture</h1></div></div><div class="content-panel astro-oil7k7jf"><div class="sl-container astro-oil7k7jf"><div class="sl-markdown-content"><p>lucisv follows the same separation of concerns that makes ruff fast and maintainable: syntax and source fidelity at the bottom, reusable analysis and transformations in the middle, and thin product surfaces at the top.</p>
</script></div></div></div></div></nav><div class="main-frame astro-gqpr5s5a"><script type="module">var e=document.getElementById(`starlight__sidebar`),t=e?.querySelector(`sl-sidebar-state-persist`),n=`sl-sidebar-state`,r=()=>{let r=[],i=t?.dataset.hash||``;try{let e=sessionStorage.getItem(n),t=JSON.parse(e||`{}`);Array.isArray(t.open)&&t.hash===i&&(r=t.open)}catch{}return{hash:i,open:r,scroll:e?.scrollTop||0}},i=e=>{try{sessionStorage.setItem(n,JSON.stringify(e))}catch{}},a=()=>i(r()),o=(e,t)=>{let n=r();n.open[t]=e,i(n)};t?.addEventListener(`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`summary`)?.closest(`details`);if(!t)return;let n=t.querySelector(`sl-sidebar-restore`),r=parseInt(n?.dataset.index||``);isNaN(r)||o(!t.open,r)}),addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&a()});</script><div class="lg:sl-flex astro-abfeecmu"><aside class="right-sidebar-container print:hidden astro-abfeecmu"><div class="right-sidebar astro-abfeecmu"><div class="lg:sl-hidden astro-q5mffni3"><mobile-starlight-toc data-min-h="2" data-max-h="3" class="astro-5ulgm6bh"><nav aria-labelledby="starlight__on-this-page--mobile" class="astro-5ulgm6bh"><details id="starlight__mobile-toc" class="astro-5ulgm6bh"><summary id="starlight__on-this-page--mobile" class="sl-flex astro-5ulgm6bh"><span class="toggle sl-flex astro-5ulgm6bh">On this page<svg aria-hidden="true" class="caret astro-5ulgm6bh astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg></span><span class="display-current astro-5ulgm6bh"></span></summary><div class="dropdown astro-5ulgm6bh"><ul class="isMobile astro-cxyftcne" style="--depth: 0;"><li style="--depth: 0;" class="astro-cxyftcne"><a href="#_top" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Overview</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#data-flow" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Data flow</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#execution-paths-and-ownership" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Execution paths and ownership</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#design-invariants" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Design invariants</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#release-surface" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Release surface</span></a></li></ul></div></details></nav></mobile-starlight-toc><script type="module" src="/_astro/MobileTableOfContents.astro_astro_type_script_index_0_lang.BcSo_yiZ.js"></script></div><div class="right-sidebar-panel sl-hidden lg:sl-block astro-q5mffni3"><div class="sl-container astro-q5mffni3"><starlight-toc data-min-h="2" data-max-h="3"><nav aria-labelledby="starlight__on-this-page"><h2 id="starlight__on-this-page">On this page</h2><ul class="astro-cxyftcne" style="--depth: 0;"><li style="--depth: 0;" class="astro-cxyftcne"><a href="#_top" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Overview</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#data-flow" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Data flow</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#execution-paths-and-ownership" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Execution paths and ownership</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#design-invariants" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Design invariants</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#release-surface" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Release surface</span></a></li></ul></nav></starlight-toc><script type="module" src="/_astro/TableOfContents.astro_astro_type_script_index_0_lang.Csloo1VZ.js"></script></div></div></div></aside><div class="main-pane astro-abfeecmu"><main data-pagefind-body class="astro-vdxcvpsm" lang="en" dir="ltr"><div class="content-panel astro-oil7k7jf"><div class="sl-container astro-oil7k7jf"><h1 id="_top" class="astro-2sm4b3ln">Architecture</h1></div></div><div class="content-panel astro-oil7k7jf"><div class="sl-container astro-oil7k7jf"><div class="sl-markdown-content"><p>lucisv follows the same separation of concerns that makes ruff fast and maintainable: syntax and source fidelity at the bottom,Line truncated
<table>
<thead>
<tr>
@@ -107,12 +107,12 @@
</tr>
<tr>
<td><code dir="auto">lucisv_core</code></td>
<td>configuration, filelists, walking, exclusions, cache</td>
<td>configuration, filelists, walking, exclusions, cache, atomic replacement</td>
<td>CLI and language server</td>
</tr>
<tr>
<td><code dir="auto">lucisv</code></td>
<td>argument parsing, parallel processing, output, atomic writes</td>
<td>argument parsing, parallel per-file processing, reports, write orchestration</td>
<td>command-line users and CI</td>
</tr>
<tr>
@@ -134,15 +134,45 @@
<div><b>refactor</b>Plans and non-overlapping workspace edits.</div>
<div><b>LSP</b>Queries, diagnostics, navigation, UI actions.</div>
</div>
<div class="sl-heading-wrapper level-h2"><h2 id="execution-paths-and-ownership">Execution paths and ownership</h2><a class="sl-anchor-link" href="#execution-paths-and-ownership"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Execution paths and ownership”</span></a></div>
<ul>
<li><strong>Format:</strong> strict parse → AST-to-document layout → width-aware printer →
normalized token comparison → second parse/format and convergence check.
Only a verified string is returned. Ranges splice whole items; format fences
also protect statement scopes, and verification covers the complete output.</li>
<li><strong>Lint:</strong> <code dir="auto">ParsedSource</code> bundles one tokenization and tolerant parse;
<code dir="auto">LintContext</code> supplies source facts and lazy semantics. The registry selects
73 rules with severities and validated options. Inline waivers filter findings,
and the front ends protect fenced bytes before applying fixes.</li>
<li><strong>Refactor:</strong> parsed spans and resolved references produce an edit plan;
the engine checks the whole candidate edit before returning it. Server source
selectors bound the input set but must include every file the engine might
edit or refuse over. No formatter dependency is involved.</li>
<li><strong>Editor:</strong> one ordered synchronous loop owns <code dir="auto">Workspace</code>; open documents
overlay disk facts. Scans publish index/include/completion batches together.
Closed-file facts persist under codec 17; a bounded file-view cache serves
queries that still need source text. Lazy port actions defer the edit until
selection; recorded file-scope definition positions avoid a closed-file read.</li>
</ul>
<p><code dir="auto">vlog_parser</code> and <code dir="auto">lucisv_core</code> depend on no other crates. Formatting and
semantics each depend on the parser; linting and refactoring depend on parser
and semantics. The CLI composes core, parser, formatter, and linter; the server
composes all six libraries. The linter’s formatter dependency is test-only.
External dependencies are confined to the CLI worker pool (<code dir="auto">rayon</code>) and the
server’s synchronous LSP/JSON stack.</p>
<p>The main change-impact boundaries are the AST and all its walkers, formatter
verification, persisted semantic facts, server state/ordering, and matching
server/editor setting names. Source modules are split by grammar domain under
<code dir="auto">parser/</code>, <code dir="auto">ast/</code>, <code dir="auto">format/</code>, <code dir="auto">bind/</code>, <code dir="auto">workspace/</code>, <code dir="auto">ports/</code>, and <code dir="auto">server/</code>.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="design-invariants">Design invariants</h2><a class="sl-anchor-link" href="#design-invariants"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Design invariants”</span></a></div>
<ul>
<li><strong>Source fidelity:</strong> comments and blank-line intent survive the parser.</li>
<li><strong>Determinism:</strong> worker scheduling never affects ordering, formatting, or exit codes.</li>
<li><strong>Fixed points:</strong> formatter tests require the second pass to match the first.</li>
<li><strong>Fixed points:</strong> every successful formatting call requires the second pass to match the first.</li>
<li><strong>Conservative analysis:</strong> incomplete cross-file knowledge produces false negatives rather than noisy false positives.</li>
<li><strong>Shared answers:</strong> CLI and editor features call the same library APIs.</li>
<li><strong>Recoverable state:</strong> caches are disposable; open buffers remain authoritative while an editor session is active.</li>
</ul>
<div class="sl-heading-wrapper level-h2"><h2 id="release-surface">Release surface</h2><a class="sl-anchor-link" href="#release-surface"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Release surface”</span></a></div>
<p>One release builds the <code dir="auto">lucisv</code> and <code dir="auto">lucisv-server</code> binaries for Apple Silicon and Intel macOS, static-musl and RHEL-compatible glibc Linux, and Windows, plus the VS Code <code dir="auto">.vsix</code> and checksums. The release tooling audits file type, dynamic linkage, and the glibc ceiling for cross-built artifacts.</p>
</div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/reference/architecture.md" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-08-27T03:31:44.000Z">Aug 27, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/reference/rust-api/" rel="prev" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span class="astro-jgq3vlii">Previous<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Rust API index</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>
<p>The supported publication surface is seven VS Code <code dir="auto">.vsix</code> packages plus checksums: five platform packages (Apple Silicon/Intel macOS, x86-64/ARM64 static-musl Linux, Windows), one all-platform package, and one universal package requiring binaries on <code dir="auto">PATH</code>. Both <code dir="auto">lucisv</code> and <code dir="auto">lucisv-server</code> are bundled in platform packages. Standalone binaries are built by the tooling but are not published as release assets. The release tooling audits file type, dynamic linkage, and the glibc ceiling for cross-built artifacts.</p>
</div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/reference/architecture.md" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-09-05T04:37:55.000Z">Sep 5, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/reference/rust-api/" rel="prev" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span class="astro-jgq3vlii">Previous<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Rust API index</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>
+18 -8
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>CLI reference | lucisv</title><link rel="canonical" href="https://lucisv.dev/reference/cli/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","softwareVersion":"0.9.0","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="CLI reference"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/reference/cli/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Complete command, option, input, output, and exit-code reference for lucisv."/><meta name="description" content="Complete command, option, input, output, and exit-code reference for lucisv."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>CLI reference | lucisv</title><link rel="canonical" href="https://lucisv.dev/reference/cli/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="CLI reference"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/reference/cli/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Complete command, option, input, output, and exit-code reference for lucisv."/><meta name="description" content="Complete command, option, input, output, and exit-code reference for lucisv."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
window.StarlightThemeProvider = (() => {
const storedTheme =
typeof localStorage !== 'undefined' && localStorage.getItem('starlight-theme');
@@ -206,13 +206,13 @@
<tbody>
<tr>
<td><code dir="auto">--select</code></td>
<td>rule list</td>
<td>Replace defaults with named rules; comma-separated and repeatable</td>
<td>rule/class list</td>
<td>Replace defaults with named rules or <code dir="auto">error</code>, <code dir="auto">warning</code>, <code dir="auto">style</code>; comma-separated and repeatable</td>
</tr>
<tr>
<td><code dir="auto">--ignore</code></td>
<td>rule list</td>
<td>Remove named rules from the enabled set</td>
<td>rule/class list</td>
<td>Remove named rules or severity classes from the enabled set</td>
</tr>
<tr>
<td><code dir="auto">--output-format</code></td>
@@ -229,11 +229,21 @@
<td>—</td>
<td>Allow unsafe fixes when a rule provides them</td>
</tr>
<tr>
<td><code dir="auto">--waiver-file &lt;PATH&gt;</code></td>
<td>path</td>
<td>Read Verible-format waiver directives from this file; repeatable. Adds to <code dir="auto">[lint] waivers</code> from <code dir="auto">lucisv.toml</code>. Relative to the working directory. A missing file or an unparsable directive is an error (exit 2)</td>
</tr>
<tr>
<td><code dir="auto">--rules-doc</code></td>
<td>—</td>
<td>Print registry-generated rule and option documentation and exit; takes no files</td>
</tr>
</tbody>
</table>
<p>Text diagnostics use <code dir="auto">FILE:LINE:COL: message [rule]</code>. JSON output is one array of diagnostic objects.</p>
<p>Text diagnostics use <code dir="auto">FILE:LINE:COL: severity: message [rule]</code>. JSON output is one array of diagnostic objects, each carrying <code dir="auto">severity</code>. JSON output is lint-only; formatter errors remain text on stderr.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="filelists">Filelists</h2><a class="sl-anchor-link" href="#filelists"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Filelists”</span></a></div>
<p>An EDA <code dir="auto">.f</code> filelist accepts one source path per line, nested <code dir="auto">-f</code> entries, <code dir="auto">+incdir+</code>, <code dir="auto">+define+</code>, <code dir="auto">#</code> or <code dir="auto">//</code> comments, and <code dir="auto">$VAR</code>/<code dir="auto">${VAR}</code> expansion. Paths resolve relative to the filelist that names them. Include and define options are accepted but ignored because lucisv does not preprocess.</p>
<p>An EDA <code dir="auto">.f</code> filelist accepts one source path per line, nested <code dir="auto">-f</code> entries, <code dir="auto">+incdir+</code>, <code dir="auto">+define+</code>, <code dir="auto">#</code> or <code dir="auto">//</code> comments, and <code dir="auto">$VAR</code>/<code dir="auto">${VAR}</code> expansion. Paths resolve relative to the filelist that names them. The CLI accepts include and define options without preprocessing. The server uses include directories for include navigation; neither front end expands cross-file macros while parsing.</p>
<p>Filelist paths bypass <code dir="auto">--exclude</code> and <code dir="auto">.gitignore</code>, just like direct command-line files. Duplicates are processed once. Unknown options, unset variables, and missing listed files warn without changing the exit code; an unreadable filelist is an error.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="ignore-patterns">Ignore patterns</h2><a class="sl-anchor-link" href="#ignore-patterns"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Ignore patterns”</span></a></div>
<p>Directory walks read <code dir="auto">.gitignore</code> in each directory. Deeper rules override shallower rules; the last matching line wins. Supported syntax includes comments, blank lines, <code dir="auto">*</code> within a component, anchored <code dir="auto">/</code>, directory-only trailing <code dir="auto">/</code>, and <code dir="auto">!</code> negation. <code dir="auto">**</code>, <code dir="auto">?</code>, character classes, escapes, global excludes, and tracked-file exceptions are not implemented.</p>
@@ -261,4 +271,4 @@
</tbody>
</table>
<p>An error outranks “would change.” Every file involved in an error is left untouched.</p>
</div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/reference/cli.md" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-08-27T03:31:44.000Z">Aug 27, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/guides/syntax/" rel="prev" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span class="astro-jgq3vlii">Previous<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Supported syntax</span></span></a><a href="/reference/rules/" rel="next" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span class="astro-jgq3vlii">Next<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Lint rules</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>
</div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/reference/cli.md" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-09-05T04:37:55.000Z">Sep 5, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/guides/syntax/" rel="prev" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span class="astro-jgq3vlii">Previous<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Supported syntax</span></span></a><a href="/reference/rules/" rel="next" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span class="astro-jgq3vlii">Next<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Lint rules</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>
+16 -3
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Language tools | lucisv</title><link rel="canonical" href="https://lucisv.dev/reference/language-tools/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","softwareVersion":"0.9.0","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Language tools"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/reference/language-tools/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Complete index of the editor and Language Server Protocol capabilities provided by lucisv-server."/><meta name="description" content="Complete index of the editor and Language Server Protocol capabilities provided by lucisv-server."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Language tools | lucisv</title><link rel="canonical" href="https://lucisv.dev/reference/language-tools/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Language tools"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/reference/language-tools/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Complete index of the editor and Language Server Protocol capabilities provided by lucisv-server."/><meta name="description" content="Complete index of the editor and Language Server Protocol capabilities provided by lucisv-server."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
window.StarlightThemeProvider = (() => {
const storedTheme =
typeof localStorage !== 'undefined' && localStorage.getItem('starlight-theme');
@@ -244,7 +244,12 @@
<tr>
<td>Quick fixes</td>
<td><code dir="auto">textDocument/codeAction</code></td>
<td>Exposes safe lint fixes and bulk safe fixes</td>
<td>Exposes safe lint fixes, bulk safe fixes, and port refactor offers</td>
</tr>
<tr>
<td>Resolve port action</td>
<td><code dir="auto">codeAction/resolve</code></td>
<td>Computes a selected port edit against current workspace state</td>
</tr>
<tr>
<td>Execute command</td>
@@ -253,6 +258,14 @@
</tr>
</tbody>
</table>
<p>Port edits are deferred when the client advertises code-action resolve support
for <code dir="auto">edit</code>; other clients receive eager edits. Lint fixes remain eager. An
inapplicable or stale port action is rejected when resolved. Closed-file
file-scope definition and workspace-symbol locations use recorded index
positions; member locations and open buffers still use current text.</p>
<p>Inlay hints require the instantiated module to be in the active index scope.
A missing hint can therefore be a scope limitation; use a filelist or workspace
index scope when the defining module lives outside the default folder scope.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="refactoring">Refactoring</h2><a class="sl-anchor-link" href="#refactoring"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Refactoring”</span></a></div>
<table>
<thead>
@@ -329,4 +342,4 @@
</table>
<div class="sl-heading-wrapper level-h2"><h2 id="workspace-lifecycle">Workspace lifecycle</h2><a class="sl-anchor-link" href="#workspace-lifecycle"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Workspace lifecycle”</span></a></div>
<p>The server handles <code dir="auto">didOpen</code>, incremental <code dir="auto">didChange</code>, <code dir="auto">didSave</code>, <code dir="auto">didClose</code>, watched-file changes, configuration changes, cancellation, shutdown, and exit. It dynamically registers file watchers, emits work-done progress while building large indexes, coalesces code-lens refreshes, and promotes open-buffer overlays into the workspace without waiting for disk writes.</p>
</div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/reference/language-tools.md" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-08-27T03:31:44.000Z">Aug 27, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/reference/rules/" rel="prev" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span class="astro-jgq3vlii">Previous<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Lint rules</span></span></a><a href="/reference/rust-api/" rel="next" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span class="astro-jgq3vlii">Next<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Rust API index</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>
</div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/reference/language-tools.md" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-09-05T04:37:55.000Z">Sep 5, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/reference/rules/" rel="prev" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span class="astro-jgq3vlii">Previous<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Lint rules</span></span></a><a href="/reference/rust-api/" rel="next" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span class="astro-jgq3vlii">Next<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Rust API index</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>
+531 -3
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Lint rules | lucisv</title><link rel="canonical" href="https://lucisv.dev/reference/rules/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","softwareVersion":"0.9.0","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Lint rules"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/reference/rules/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Complete reference for all seventeen lucisv lint rules, their defaults, fixes, and rationale."/><meta name="description" content="Complete reference for all seventeen lucisv lint rules, their defaults, fixes, and rationale."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Lint rules | lucisv</title><link rel="canonical" href="https://lucisv.dev/reference/rules/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Lint rules"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/reference/rules/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Complete reference for every lucisv lint rule, its severity, default, fix, and rationale."/><meta name="description" content="Complete reference for every lucisv lint rule, its severity, default, fix, and rationale."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
window.StarlightThemeProvider = (() => {
const storedTheme =
typeof localStorage !== 'undefined' && localStorage.getItem('starlight-theme');
@@ -70,12 +70,19 @@
})();
</script></sl-sidebar-state-persist><div class="md:sl-hidden"><div class="mobile-preferences sl-flex astro-b5gddk54"><div class="social-icons astro-b5gddk54"><a href="https://git.luci.ooo/lucio/verilogrustformatter" rel="me" class="sl-flex astro-cg55etiy"><span class="sr-only astro-cg55etiy">Source repository</span><svg aria-hidden="true" class="astro-cg55etiy astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M12 .3a12 12 0 0 0-3.8 23.38c.6.12.83-.26.83-.57L9 21.07c-3.34.72-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.08-.74.09-.73.09-.73 1.2.09 1.83 1.24 1.83 1.24 1.08 1.83 2.81 1.3 3.5 1 .1-.78.42-1.31.76-1.61-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.14-.3-.54-1.52.1-3.18 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.28-1.55 3.29-1.23 3.29-1.23.64 1.66.24 2.88.12 3.18a4.65 4.65 0 0 1 1.23 3.22c0 4.61-2.8 5.63-5.48 5.92.42.36.81 1.1.81 2.22l-.01 3.29c0 .31.2.69.82.57A12 12 0 0 0 12 .3Z"/></svg></a></div><starlight-theme-select><label style="--sl-select-width: 6.25em" class="astro-r2p65idu"><span class="sr-only astro-r2p65idu">Select theme</span><svg aria-hidden="true" class="icon label-icon astro-r2p65idu astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M21 14h-1V7a3 3 0 0 0-3-3H7a3 3 0 0 0-3 3v7H3a1 1 0 0 0-1 1v2a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-2a1 1 0 0 0-1-1ZM6 7a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v7H6V7Zm14 10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-1h16v1Z"/></svg><select autocomplete="off" class="astro-r2p65idu"><option value="dark" class="astro-r2p65idu">Dark</option><option value="light" class="astro-r2p65idu">Light</option><option value="auto" selected class="astro-r2p65idu">Auto</option></select><svg aria-hidden="true" class="icon caret astro-r2p65idu astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M17 9.17a1 1 0 0 0-1.41 0L12 12.71 8.46 9.17a1 1 0 1 0-1.41 1.42l4.24 4.24a1.002 1.002 0 0 0 1.42 0L17 10.59a1.002 1.002 0 0 0 0-1.42Z"/></svg></label></starlight-theme-select><script>
StarlightThemeProvider.updatePickers();
</script></div></div></div></div></nav><div class="main-frame astro-gqpr5s5a"><script type="module">var e=document.getElementById(`starlight__sidebar`),t=e?.querySelector(`sl-sidebar-state-persist`),n=`sl-sidebar-state`,r=()=>{let r=[],i=t?.dataset.hash||``;try{let e=sessionStorage.getItem(n),t=JSON.parse(e||`{}`);Array.isArray(t.open)&&t.hash===i&&(r=t.open)}catch{}return{hash:i,open:r,scroll:e?.scrollTop||0}},i=e=>{try{sessionStorage.setItem(n,JSON.stringify(e))}catch{}},a=()=>i(r()),o=(e,t)=>{let n=r();n.open[t]=e,i(n)};t?.addEventListener(`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`summary`)?.closest(`details`);if(!t)return;let n=t.querySelector(`sl-sidebar-restore`),r=parseInt(n?.dataset.index||``);isNaN(r)||o(!t.open,r)}),addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&a()});</script><div class="lg:sl-flex astro-abfeecmu"><aside class="right-sidebar-container print:hidden astro-abfeecmu"><div class="right-sidebar astro-abfeecmu"><div class="lg:sl-hidden astro-q5mffni3"><mobile-starlight-toc data-min-h="2" data-max-h="3" class="astro-5ulgm6bh"><nav aria-labelledby="starlight__on-this-page--mobile" class="astro-5ulgm6bh"><details id="starlight__mobile-toc" class="astro-5ulgm6bh"><summary id="starlight__on-this-page--mobile" class="sl-flex astro-5ulgm6bh"><span class="toggle sl-flex astro-5ulgm6bh">On this page<svg aria-hidden="true" class="caret astro-5ulgm6bh astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg></span><span class="display-current astro-5ulgm6bh"></span></summary><div class="dropdown astro-5ulgm6bh"><ul class="isMobile astro-cxyftcne" style="--depth: 0;"><li style="--depth: 0;" class="astro-cxyftcne"><a href="#_top" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Overview</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#always-comb-blocking" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">always-comb-blocking</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#always-ff-non-blocking" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">always-ff-non-blocking</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#case-missing-default" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">case-missing-default</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#empty-item" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">empty-item</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#enum-name-style" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">enum-name-style</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#explicit-parameter-storage-type" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">explicit-parameter-storage-type</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#module-filename" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">module-filename</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#module-name-style" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">module-name-style</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#multiply-driven" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">multiply-driven</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#no-tabs" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">no-tabs</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#no-trailing-whitespace" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">no-trailing-whitespace</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#parameter-name-style" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">parameter-name-style</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#struct-union-name-style" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">struct-union-name-style</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#undriven-net" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">undriven-net</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#unused-signal" style="--depth: 0;" claLine truncated
</script></div></div></div></div></nav><div class="main-frame astro-gqpr5s5a"><script type="module">var e=document.getElementById(`starlight__sidebar`),t=e?.querySelector(`sl-sidebar-state-persist`),n=`sl-sidebar-state`,r=()=>{let r=[],i=t?.dataset.hash||``;try{let e=sessionStorage.getItem(n),t=JSON.parse(e||`{}`);Array.isArray(t.open)&&t.hash===i&&(r=t.open)}catch{}return{hash:i,open:r,scroll:e?.scrollTop||0}},i=e=>{try{sessionStorage.setItem(n,JSON.stringify(e))}catch{}},a=()=>i(r()),o=(e,t)=>{let n=r();n.open[t]=e,i(n)};t?.addEventListener(`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`summary`)?.closest(`details`);if(!t)return;let n=t.querySelector(`sl-sidebar-restore`),r=parseInt(n?.dataset.index||``);isNaN(r)||o(!t.open,r)}),addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&a()});</script><div class="lg:sl-flex astro-abfeecmu"><aside class="right-sidebar-container print:hidden astro-abfeecmu"><div class="right-sidebar astro-abfeecmu"><div class="lg:sl-hidden astro-q5mffni3"><mobile-starlight-toc data-min-h="2" data-max-h="3" class="astro-5ulgm6bh"><nav aria-labelledby="starlight__on-this-page--mobile" class="astro-5ulgm6bh"><details id="starlight__mobile-toc" class="astro-5ulgm6bh"><summary id="starlight__on-this-page--mobile" class="sl-flex astro-5ulgm6bh"><span class="toggle sl-flex astro-5ulgm6bh">On this page<svg aria-hidden="true" class="caret astro-5ulgm6bh astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg></span><span class="display-current astro-5ulgm6bh"></span></summary><div class="dropdown astro-5ulgm6bh"><ul class="isMobile astro-cxyftcne" style="--depth: 0;"><li style="--depth: 0;" class="astro-cxyftcne"><a href="#_top" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Overview</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#always-comb-blocking" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">always-comb-blocking</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#always-ff-non-blocking" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">always-ff-non-blocking</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#case-missing-default" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">case-missing-default</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#empty-item" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">empty-item</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#enum-name-style" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">enum-name-style</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#explicit-parameter-storage-type" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">explicit-parameter-storage-type</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#module-filename" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">module-filename</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#module-name-style" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">module-name-style</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#multiply-driven" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">multiply-driven</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#no-tabs" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">no-tabs</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#no-trailing-whitespace" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">no-trailing-whitespace</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#parameter-name-style" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">parameter-name-style</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#struct-union-name-style" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">struct-union-name-style</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#undriven-net" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">undriven-net</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#unused-signal" style="--depth: 0;" claLine truncated
<p>Every rule is in one of three <strong>severity</strong> classes. <code dir="auto">error</code> is code that would very likely fail to compile, elaborate or synthesize; <code dir="auto">warning</code> is code that compiles and very likely does not mean what it says; <code dir="auto">style</code> is code that is correct and reads badly. The class is the word in the CLI diagnostic line (<code dir="auto">FILE:LINE:COL: warning: …</code>), the <code dir="auto">severity</code> field of <code dir="auto">--output-format json</code>, and the colour of the editor’s squiggle — and it is accepted wherever a rule name is, so <code dir="auto">--ignore style</code> and <code dir="auto">--select error</code> both work.</p>
<p>Every <code dir="auto">error</code>-class rule is held to one discipline: it goes <strong>silent whenever the run cannot answer</strong> — a file that did not fully parse, a module the project does not hold or holds twice, a name a macro produces, a fragment written to be <code dir="auto"> `include</code>d. A wrong accusation in that class is worse than a hundred missed ones.</p>
<p>This page is hand-written prose. The generated truth is <code dir="auto">lucisv check --rules-doc</code>, which prints every rule with its class, default, fix and rationale straight from the registry — <strong>and every option a rule takes, with its kind and default</strong>.</p>
<p>A configurable rule is configured in a <code dir="auto">[lint.&lt;rule-name&gt;]</code> table of a <code dir="auto">lucisv.toml</code>, or from an editor in the <code dir="auto">lucisv.lint.options</code> object; the option names are Verible’s wherever it has the same option. An unknown rule or option name, a value of the wrong kind, an out-of-range integer or a pattern that does not compile fails a CLI run naming the file and the line. Invalid editor option settings are logged and dropped; invalid project-file option entries are currently dropped silently by server linting.</p>
<div class="expressive-code"><link rel="stylesheet" href="/_astro/ec.w36nc.css"><script type="module" src="/_astro/ec.0vx5m.js"></script><figure class="frame not-content"><figcaption class="header"></figcaption><pre data-language="toml"><code><div class="ec-line"><div class="code"><span style="--0:#D6DEEB;--1:#403F53">[lint.line-length]</span></div></div><div class="ec-line"><div class="code"><span style="--0:#C5E478;--1:#3B61B0">length</span><span style="--0:#D6DEEB;--1:#403F53"> = </span><span style="--0:#F78C6C;--1:#AA0982">120</span></div></div><div class="ec-line"><div class="code">
</div></div><div class="ec-line"><div class="code"><span style="--0:#D6DEEB;--1:#403F53">[lint.typedef-structs-unions]</span></div></div><div class="ec-line"><div class="code"><span style="--0:#C5E478;--1:#3B61B0">allow_anonymous_nested</span><span style="--0:#D6DEEB;--1:#403F53"> = </span><span style="--0:#FF6A83;--1:#A24848">true</span></div></div></code></pre><div class="copy"><div aria-live="polite"></div><button title="Copy to clipboard" data-copied="Copied!" data-code="[lint.line-length]length = 120[lint.typedef-structs-unions]allow_anonymous_nested = true"><div></div></button></div></figure></div>
<p>A rule marked <strong>on (project)</strong> runs by default only where lucisv can see the other files of your project — <code dir="auto">lucisv check &lt;dir&gt;</code>, or the language server. Over a single file or a stdin buffer it is off and must be <code dir="auto">--select</code>ed, because its one false-positive mode is a use in another file. Turn any rule off with <code dir="auto">--ignore</code>, with <code dir="auto">ignore</code> under <code dir="auto">[lint]</code> in <code dir="auto">lucisv.toml</code>, or with <code dir="auto">lucisv.lint.ignore</code> in your editor.</p>
<table>
<thead>
<tr>
<th>Rule</th>
<th style="text-align: center">Severity</th>
<th style="text-align: center">Default</th>
<th style="text-align: center">Fix</th>
<th>Purpose</th>
@@ -83,107 +90,516 @@
</thead>
<tbody>
<tr>
<td><a href="#always-comb"><code dir="auto">always-comb</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">unsafe</td>
<td>Write <code dir="auto">always_comb</code>, not <code dir="auto">always @*</code></td>
</tr>
<tr>
<td><a href="#banned-declared-name-patterns"><code dir="auto">banned-declared-name-patterns</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">off</td>
<td style="text-align: center">—</td>
<td>Ban the names your project has decided against</td>
</tr>
<tr>
<td><a href="#constraint-name-style"><code dir="auto">constraint-name-style</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Name constraints <code dir="auto">lower_snake_case</code> ending <code dir="auto">_c</code></td>
</tr>
<tr>
<td><a href="#explicit-begin"><code dir="auto">explicit-begin</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">off</td>
<td style="text-align: center">safe</td>
<td>Wrap every body in <code dir="auto">begin ... end</code></td>
</tr>
<tr>
<td><a href="#forbid-consecutive-null-statements"><code dir="auto">forbid-consecutive-null-statements</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">safe</td>
<td>Drop a <code dir="auto">;</code> that follows a <code dir="auto">;</code></td>
</tr>
<tr>
<td><a href="#generate-label"><code dir="auto">generate-label</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Label every generate block</td>
</tr>
<tr>
<td><a href="#generate-label-prefix"><code dir="auto">generate-label-prefix</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Prefix that label <code dir="auto">g_</code> or <code dir="auto">gen_</code></td>
</tr>
<tr>
<td><a href="#interface-name-style"><code dir="auto">interface-name-style</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Name interfaces <code dir="auto">lower_snake_case</code> ending <code dir="auto">_if</code></td>
</tr>
<tr>
<td><a href="#line-length"><code dir="auto">line-length</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Keep lines within the configured width</td>
</tr>
<tr>
<td><a href="#macro-name-style"><code dir="auto">macro-name-style</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Name macros <code dir="auto">ALL_CAPS</code></td>
</tr>
<tr>
<td><a href="#one-module-per-file"><code dir="auto">one-module-per-file</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">off</td>
<td style="text-align: center">—</td>
<td>Declare one module per file</td>
</tr>
<tr>
<td><a href="#package-filename"><code dir="auto">package-filename</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Match one-package files to package names</td>
</tr>
<tr>
<td><a href="#parameter-type-name-style"><code dir="auto">parameter-type-name-style</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">off</td>
<td style="text-align: center">—</td>
<td>Name <code dir="auto">type</code> parameters <code dir="auto">lower_snake_case</code> ending <code dir="auto">_t</code></td>
</tr>
<tr>
<td><a href="#port-name-suffix"><code dir="auto">port-name-suffix</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">off</td>
<td style="text-align: center">—</td>
<td>Say a port’s direction in its name</td>
</tr>
<tr>
<td><a href="#posix-eof"><code dir="auto">posix-eof</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">safe</td>
<td>End the file with a newline</td>
</tr>
<tr>
<td><a href="#signal-name-style"><code dir="auto">signal-name-style</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">off</td>
<td style="text-align: center">—</td>
<td>Name signals <code dir="auto">lower_snake_case</code></td>
</tr>
<tr>
<td><a href="#typedef-enums"><code dir="auto">typedef-enums</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Name an <code dir="auto">enum</code> type with a <code dir="auto">typedef</code></td>
</tr>
<tr>
<td><a href="#typedef-structs-unions"><code dir="auto">typedef-structs-unions</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Name a <code dir="auto">struct</code>/<code dir="auto">union</code> type with a <code dir="auto">typedef</code></td>
</tr>
<tr>
<td><a href="#always-comb-blocking"><code dir="auto">always-comb-blocking</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Use <code dir="auto">=</code> inside <code dir="auto">always_comb</code></td>
</tr>
<tr>
<td><a href="#always-ff-non-blocking"><code dir="auto">always-ff-non-blocking</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Use <code dir="auto">&lt;=</code> inside <code dir="auto">always_ff</code></td>
</tr>
<tr>
<td><a href="#case-missing-default"><code dir="auto">case-missing-default</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Give every case a default branch</td>
</tr>
<tr>
<td><a href="#duplicate-declaration"><code dir="auto">duplicate-declaration</code></a></td>
<td style="text-align: center">error</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Declare each name once per scope</td>
</tr>
<tr>
<td><a href="#empty-item"><code dir="auto">empty-item</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">safe</td>
<td>Drop a <code dir="auto">;</code> that stands where an item belongs</td>
</tr>
<tr>
<td><a href="#enum-name-style"><code dir="auto">enum-name-style</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Name enum typedefs with <code dir="auto">_e</code> or <code dir="auto">_t</code></td>
</tr>
<tr>
<td><a href="#explicit-function-task-parameter-type"><code dir="auto">explicit-function-task-parameter-type</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Type every function and task argument</td>
</tr>
<tr>
<td><a href="#explicit-parameter-storage-type"><code dir="auto">explicit-parameter-storage-type</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Declare parameter storage types</td>
</tr>
<tr>
<td><a href="#forbid-defparam"><code dir="auto">forbid-defparam</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Override at the instantiation, not with <code dir="auto">defparam</code></td>
</tr>
<tr>
<td><a href="#forbid-negative-array-dim"><code dir="auto">forbid-negative-array-dim</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Keep negative literals out of dimensions</td>
</tr>
<tr>
<td><a href="#incomplete-assignment"><code dir="auto">incomplete-assignment</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Assign on every path of an <code dir="auto">always_comb</code></td>
</tr>
<tr>
<td><a href="#instance-shadowing"><code dir="auto">instance-shadowing</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Do not hide an enclosing declaration</td>
</tr>
<tr>
<td><a href="#invalid-system-task-function"><code dir="auto">invalid-system-task-function</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Avoid deprecated and non-reproducible system tasks</td>
</tr>
<tr>
<td><a href="#mismatched-labels"><code dir="auto">mismatched-labels</code></a></td>
<td style="text-align: center">error</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Make an end label name its own block</td>
</tr>
<tr>
<td><a href="#module-filename"><code dir="auto">module-filename</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Match one-module files to module names</td>
</tr>
<tr>
<td><a href="#module-name-style"><code dir="auto">module-name-style</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">off</td>
<td style="text-align: center">—</td>
<td>Use lower_snake_case module names</td>
</tr>
<tr>
<td><a href="#module-parameter"><code dir="auto">module-parameter</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Override more than one parameter by name</td>
</tr>
<tr>
<td><a href="#module-port"><code dir="auto">module-port</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Connect more than one port by name</td>
</tr>
<tr>
<td><a href="#multiply-driven"><code dir="auto">multiply-driven</code></a></td>
<td style="text-align: center">error</td>
<td style="text-align: center">on (project)</td>
<td style="text-align: center">—</td>
<td>Give variables one driver</td>
</tr>
<tr>
<td><a href="#no-tabs"><code dir="auto">no-tabs</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">safe</td>
<td>Use spaces outside string literals</td>
</tr>
<tr>
<td><a href="#no-trailing-whitespace"><code dir="auto">no-trailing-whitespace</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">safe</td>
<td>Remove end-of-line whitespace</td>
</tr>
<tr>
<td><a href="#packed-dimensions-range-ordering"><code dir="auto">packed-dimensions-range-ordering</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Write a packed dimension <code dir="auto">[N-1:0]</code></td>
</tr>
<tr>
<td><a href="#parameter-name-style"><code dir="auto">parameter-name-style</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Use CamelCase or ALL_CAPS parameters</td>
</tr>
<tr>
<td><a href="#plusarg-assignment"><code dir="auto">plusarg-assignment</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Read a plusarg with <code dir="auto">$value$plusargs</code></td>
</tr>
<tr>
<td><a href="#struct-union-name-style"><code dir="auto">struct-union-name-style</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Name aggregate typedefs with <code dir="auto">_t</code></td>
</tr>
<tr>
<td><a href="#suspicious-semicolon"><code dir="auto">suspicious-semicolon</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>No <code dir="auto">if (x);</code> or <code dir="auto">while (x);</code></td>
</tr>
<tr>
<td><a href="#truncated-numeric-literal"><code dir="auto">truncated-numeric-literal</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Keep a sized literal inside its width</td>
</tr>
<tr>
<td><a href="#undeclared-identifier"><code dir="auto">undeclared-identifier</code></a></td>
<td style="text-align: center">error</td>
<td style="text-align: center">on (project)</td>
<td style="text-align: center">—</td>
<td>Use a name something declares</td>
</tr>
<tr>
<td><a href="#undersized-binary-literal"><code dir="auto">undersized-binary-literal</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on</td>
<td style="text-align: center">safe</td>
<td>Write every bit of a sized binary literal</td>
</tr>
<tr>
<td><a href="#undriven-net"><code dir="auto">undriven-net</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on (project)</td>
<td style="text-align: center">—</td>
<td>Drive signals that are read</td>
</tr>
<tr>
<td><a href="#unknown-parameter"><code dir="auto">unknown-parameter</code></a></td>
<td style="text-align: center">error</td>
<td style="text-align: center">on (project)</td>
<td style="text-align: center">—</td>
<td>Override only parameters the module declares</td>
</tr>
<tr>
<td><a href="#unknown-port"><code dir="auto">unknown-port</code></a></td>
<td style="text-align: center">error</td>
<td style="text-align: center">on (project)</td>
<td style="text-align: center">—</td>
<td>Connect only ports the module declares</td>
</tr>
<tr>
<td><a href="#unused-signal"><code dir="auto">unused-signal</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on (project)</td>
<td style="text-align: center">—</td>
<td>Detect unreferenced internal signals</td>
</tr>
<tr>
<td><a href="#unused-waiver"><code dir="auto">unused-waiver</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Remove ineffective suppressions</td>
</tr>
<tr>
<td><a href="#void-cast"><code dir="auto">void-cast</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Cast to <code dir="auto">void</code> only what a call returns</td>
</tr>
<tr>
<td><a href="#wire-reg-mixup"><code dir="auto">wire-reg-mixup</code></a></td>
<td style="text-align: center">error</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Prefer <code dir="auto">logic</code> to <code dir="auto">reg</code> in SystemVerilog</td>
</tr>
<tr>
<td><a href="#create-object-name-match"><code dir="auto">create-object-name-match</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Name a <code dir="auto">type_id::create</code> after its handle</td>
</tr>
<tr>
<td><a href="#dff-name-style"><code dir="auto">dff-name-style</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">off</td>
<td style="text-align: center">—</td>
<td>Name a flip-flop <code dir="auto">_q</code> and its input <code dir="auto">_d</code></td>
</tr>
<tr>
<td><a href="#disable-statement"><code dir="auto">disable-statement</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">off</td>
<td style="text-align: center">—</td>
<td>Write <code dir="auto">disable fork</code>, not a fork label</td>
</tr>
<tr>
<td><a href="#endif-comment"><code dir="auto">endif-comment</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">off</td>
<td style="text-align: center">safe</td>
<td>Say what an <code dir="auto">`endif</code> closes</td>
</tr>
<tr>
<td><a href="#explicit-function-lifetime"><code dir="auto">explicit-function-lifetime</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>State a function’s lifetime outside a class</td>
</tr>
<tr>
<td><a href="#explicit-task-lifetime"><code dir="auto">explicit-task-lifetime</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>State a task’s lifetime outside a class</td>
</tr>
<tr>
<td><a href="#forbid-line-continuations"><code dir="auto">forbid-line-continuations</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Do not break a string with a backslash</td>
</tr>
<tr>
<td><a href="#forbidden-macro"><code dir="auto">forbidden-macro</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Ban the macros your project has decided against</td>
</tr>
<tr>
<td><a href="#legacy-generate-region"><code dir="auto">legacy-generate-region</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">off</td>
<td style="text-align: center">—</td>
<td>Drop the <code dir="auto">generate … endgenerate</code> wrapper</td>
</tr>
<tr>
<td><a href="#legacy-genvar-declaration"><code dir="auto">legacy-genvar-declaration</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">off</td>
<td style="text-align: center">—</td>
<td>Declare a genvar in the <code dir="auto">for</code> header</td>
</tr>
<tr>
<td><a href="#macro-string-concatenation"><code dir="auto">macro-string-concatenation</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">off</td>
<td style="text-align: center">—</td>
<td>Do not put <code dir="auto"> </code> `` in a plain string</td>
</tr>
<tr>
<td><a href="#module-begin-block"><code dir="auto">module-begin-block</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>No <code dir="auto">begin</code>/<code dir="auto">end</code> at module scope</td>
</tr>
<tr>
<td><a href="#numeric-format-string-style"><code dir="auto">numeric-format-string-style</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">off</td>
<td style="text-align: center">—</td>
<td>Match a radix prefix to its specifier</td>
</tr>
<tr>
<td><a href="#positive-meaning-parameter-name"><code dir="auto">positive-meaning-parameter-name</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Name a parameter for what it enables</td>
</tr>
<tr>
<td><a href="#proper-parameter-declaration"><code dir="auto">proper-parameter-declaration</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">off</td>
<td style="text-align: center">—</td>
<td><code dir="auto">parameter</code> in a header, <code dir="auto">localparam</code> in a body</td>
</tr>
<tr>
<td><a href="#suggest-parentheses"><code dir="auto">suggest-parentheses</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">safe</td>
<td>Parenthesize a conditional inside a conditional</td>
</tr>
<tr>
<td><a href="#unpacked-dimensions-range-ordering"><code dir="auto">unpacked-dimensions-range-ordering</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>Write an unpacked dimension <code dir="auto">[0:N-1]</code></td>
</tr>
<tr>
<td><a href="#uvm-macro-semicolon"><code dir="auto">uvm-macro-semicolon</code></a></td>
<td style="text-align: center">warning</td>
<td style="text-align: center">off</td>
<td style="text-align: center">—</td>
<td>No <code dir="auto">;</code> after a <code dir="auto">`uvm_*</code> macro</td>
</tr>
<tr>
<td><a href="#v2001-generate-begin"><code dir="auto">v2001-generate-begin</code></a></td>
<td style="text-align: center">style</td>
<td style="text-align: center">on</td>
<td style="text-align: center">—</td>
<td>No bare <code dir="auto">begin</code> in a generate region</td>
</tr>
</tbody>
</table>
<div class="sl-heading-wrapper level-h2"><h2 id="always-comb-blocking">always-comb-blocking</h2><a class="sl-anchor-link" href="#always-comb-blocking"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “always-comb-blocking”</span></a></div>
@@ -220,4 +636,116 @@
<p>Reports malformed, unknown, or ineffective waiver comments when their target rule is enabled. A waiver for a disabled rule is not judged.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="wire-reg-mixup">wire-reg-mixup</h2><a class="sl-anchor-link" href="#wire-reg-mixup"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “wire-reg-mixup”</span></a></div>
<p>Reports <code dir="auto">reg</code> in <code dir="auto">.sv</code> and <code dir="auto">.svh</code> files and recommends <code dir="auto">logic</code>. Verilog <code dir="auto">.v</code>/<code dir="auto">.vh</code> files and unnamed stdin are exempt; <code dir="auto">wire</code> remains valid and is never flagged.</p>
</div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/reference/rules.md" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-09-02T16:06:08.000Z">Sep 2, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/reference/cli/" rel="prev" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span class="astro-jgq3vlii">Previous<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">CLI</span></span></a><a href="/reference/language-tools/" rel="next" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span class="astro-jgq3vlii">Next<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Language tools</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>
<div class="sl-heading-wrapper level-h2"><h2 id="duplicate-declaration">duplicate-declaration</h2><a class="sl-anchor-link" href="#duplicate-declaration"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “duplicate-declaration”</span></a></div>
<p>Reports a name a scope binds twice — two signals, two parameters, two typedefs, two instances. It is silent whenever the second declaration might be legal: a <strong>port</strong> on either side (a non-ANSI port is completed by its body declarations, all legally), a function, task, class, constraint, covergroup, property, sequence, modport or clocking name (each has a prototype-plus-definition or forward-declaration form), an enum <strong>name range</strong> (<code dir="auto">Gpr[0:2]</code> declares a run of members under one written identifier), a <code dir="auto">generate</code> scope, a pair separated by a conditional-compilation directive, the file scope, and any file that did not fully parse. Measured on opentitan: 18 findings before those exclusions, all of them phantoms from one 454-error UVM file, and 0 after.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="explicit-function-task-parameter-type">explicit-function-task-parameter-type</h2><a class="sl-anchor-link" href="#explicit-function-task-parameter-type"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “explicit-function-task-parameter-type”</span></a></div>
<p>Reports a task or function formal with no storage type, which the language makes a one-bit <code dir="auto">logic</code> (IEEE 1800 §13.3). Only the argument that <em>opens</em> a declaration is judged — a continuation (<code dir="auto">f(input int a, b)</code>) inherits — and a DPI import’s unnamed formal is not this rule’s subject. Verible’s <code dir="auto">explicit-function-task-parameter-type</code>, same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="forbid-defparam">forbid-defparam</h2><a class="sl-anchor-link" href="#forbid-defparam"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “forbid-defparam”</span></a></div>
<p>Reports <code dir="auto">defparam</code>, deprecated since IEEE 1800-2009 and rejected outright by several synthesis tools. The <code dir="auto">#(.NAME(value))</code> override at the instantiation says the same thing where the instance is. Verible’s <code dir="auto">forbid-defparam</code>, same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="forbid-negative-array-dim">forbid-negative-array-dim</h2><a class="sl-anchor-link" href="#forbid-negative-array-dim"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “forbid-negative-array-dim”</span></a></div>
<p>Reports a written negative literal inside a dimension, packed or unpacked — the shape <code dir="auto">[WIDTH-1:0]</code> collapses to when <code dir="auto">WIDTH</code> comes out zero. Only a literal is judged; an expression that would evaluate negative needs parameter values lucisv does not have. Verible ships this off; lucisv turns it on, because a negative literal spelled out in a dimension has no legitimate reading.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="incomplete-assignment">incomplete-assignment</h2><a class="sl-anchor-link" href="#incomplete-assignment"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “incomplete-assignment”</span></a></div>
<p>Reports a variable an <code dir="auto">always_comb</code> writes under an <code dir="auto">if</code> with no <code dir="auto">else</code>, or in some arms of a <code dir="auto">default</code>-less <code dir="auto">case</code>, and nowhere unconditionally before — a latch inferred where none was wanted. Conservative by construction: it reads only the top level of the block, treats a partial write and an every-arm <code dir="auto">if</code>/<code dir="auto">else</code> or <code dir="auto">case</code> as coverage, and never reports a name the block declares for itself. No Verible equivalent. Measured on opentitan: 3 findings before those exclusions, all false, 0 after; 3 on lucisv’s corpus, all real latches in <code dir="auto">common_cells/src/deprecated</code>.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="instance-shadowing">instance-shadowing</h2><a class="sl-anchor-link" href="#instance-shadowing"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “instance-shadowing”</span></a></div>
<p>Reports a declaration that hides one from an enclosing scope of the same design unit — the block-local <code dir="auto">count</code> that quietly changes what every <code dir="auto">count</code> in the block means. Only data and instances are judged (a subroutine argument named after a signal is idiomatic), and only within one unit. Verible ships this off; lucisv turns it on.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="invalid-system-task-function">invalid-system-task-function</h2><a class="sl-anchor-link" href="#invalid-system-task-function"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “invalid-system-task-function”</span></a></div>
<p>Reports <code dir="auto">$random</code>, <code dir="auto">$srandom</code>, the <code dir="auto">$dist_*</code> family and <code dir="auto">$psprintf</code>, and names the replacement. The random family all draw from one global generator, so a call added anywhere reshuffles every other stream and a failing seed stops reproducing; <code dir="auto">$psprintf</code> is a vendor spelling of <code dir="auto">$sformatf</code>. Verible’s <code dir="auto">invalid-system-task-function</code>, same list, same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="mismatched-labels">mismatched-labels</h2><a class="sl-anchor-link" href="#mismatched-labels"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “mismatched-labels”</span></a></div>
<p>Reports an end label that does not name the block it closes, and an <code dir="auto">end : name</code> on a block that has none — both compile errors (IEEE 1800 §9.3.4). Every construct that may carry a footer label is checked with one answer: module, interface, program, package, class, function, task, <code dir="auto">begin</code>, <code dir="auto">fork</code>/<code dir="auto">join</code>, generate block, clocking block, covergroup, property and sequence. Verible ships this off; lucisv turns it on and files it as an error.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="module-parameter">module-parameter</h2><a class="sl-anchor-link" href="#module-parameter"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “module-parameter”</span></a></div>
<p>Reports more than one positional parameter override, which binds by order and silently changes what every instance elaborates to when a parameter is added or two are swapped. Verible’s <code dir="auto">module-parameter</code>, same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="module-port">module-port</h2><a class="sl-anchor-link" href="#module-port"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “module-port”</span></a></div>
<p>Reports more than one positional port connection, for the same reason. A single-port instance has no order to get wrong and is left alone. Verible’s <code dir="auto">module-port</code>, same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="packed-dimensions-range-ordering">packed-dimensions-range-ordering</h2><a class="sl-anchor-link" href="#packed-dimensions-range-ordering"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “packed-dimensions-range-ordering”</span></a></div>
<p>Reports a packed dimension that counts upwards (<code dir="auto">[0:7]</code>, <code dir="auto">[0:WIDTH-1]</code>), where bit 0 is the most significant one and every concatenation with an ordinary <code dir="auto">[7:0]</code> vector silently reverses. Unpacked arrays are not judged — an ascending array is normal — and two symbolic bounds lucisv cannot compare are left alone. Verible’s <code dir="auto">packed-dimensions-range-ordering</code>, same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="plusarg-assignment">plusarg-assignment</h2><a class="sl-anchor-link" href="#plusarg-assignment"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “plusarg-assignment”</span></a></div>
<p>Reports <code dir="auto">$test$plusargs</code>, which matches by <em>prefix</em> — <code dir="auto">+foobar</code> makes <code dir="auto">$test$plusargs("foo")</code> true — and asks for <code dir="auto">$value$plusargs</code>, which matches the whole name and hands back the value. Verible’s <code dir="auto">plusarg-assignment</code>, same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="suspicious-semicolon">suspicious-semicolon</h2><a class="sl-anchor-link" href="#suspicious-semicolon"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “suspicious-semicolon”</span></a></div>
<p>Reports <code dir="auto">if (x);</code>, <code dir="auto">for (…);</code>, <code dir="auto">while (…);</code> and their relatives, where the <code dir="auto">;</code> is the whole body and whatever is indented under it runs unconditionally. A deliberately empty body is <code dir="auto">begin end</code> and is not reported. Verible ships this off; lucisv turns it on, because the finding is a typo rather than a matter of taste.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="truncated-numeric-literal">truncated-numeric-literal</h2><a class="sl-anchor-link" href="#truncated-numeric-literal"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “truncated-numeric-literal”</span></a></div>
<p>Reports a sized literal whose digits need more bits than it declares (<code dir="auto">4'hFFF</code>), which most simulators truncate silently. Leading zeros do not count, and a literal whose digits are all <code dir="auto">x</code>/<code dir="auto">z</code> (<code dir="auto">3'hz</code>) is left alone — those spell an unknown of that width. Verible’s <code dir="auto">truncated-numeric-literal</code>, same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="undeclared-identifier">undeclared-identifier</h2><a class="sl-anchor-link" href="#undeclared-identifier"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “undeclared-identifier”</span></a></div>
<p>Reports a name this file does not declare, that no external unit it names could supply, and that <strong>no other file in the project writes down at all</strong>. Every clause is an exclusion, and they are what make an error-class rule about names safe: no project behind the run means no opinion, and so do a name any macro, directive or attribute in the file writes down, a file that did not fully parse, and an <code dir="auto"> `include</code>d fragment with no unit of its own. Measured on opentitan <code dir="auto">hw/</code> and on lucisv’s corpus: the same five findings, all real implicit nets in one ibex formal file. No Verible equivalent.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="undersized-binary-literal">undersized-binary-literal</h2><a class="sl-anchor-link" href="#undersized-binary-literal"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “undersized-binary-literal”</span></a></div>
<p>Reports a sized binary literal that writes fewer digits than its width (<code dir="auto">8'b1</code>), and its safe fix writes the extension the language would have applied — <code dir="auto">0</code> for a literal starting with <code dir="auto">0</code> or <code dir="auto">1</code>, the unknown itself for one starting with <code dir="auto">x</code> or <code dir="auto">z</code>. A literal whose value is zero is exempt, matching Verible’s <code dir="auto">lint_zero</code> default. Verible’s <code dir="auto">undersized-binary-literal</code>, same bases, same defaults.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="unknown-parameter">unknown-parameter</h2><a class="sl-anchor-link" href="#unknown-parameter"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “unknown-parameter”</span></a></div>
<p>Reports a <code dir="auto">#(.NAME(…))</code> override naming a parameter the instantiated module does not declare — including a <code dir="auto">localparam</code>, which is not overridable at all. It is silent whenever the project cannot answer: no project, an unindexed module, one declared twice with different headers, one whose header carries a compiler directive, a scope-qualified instantiation. Measured on opentitan: 4 findings, spot-checked true. No Verible equivalent.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="unknown-port">unknown-port</h2><a class="sl-anchor-link" href="#unknown-port"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “unknown-port”</span></a></div>
<p>Reports a <code dir="auto">.name(…)</code> connection naming a port the instantiated module does not declare — the port rename that reached three of four instantiations. Same silences as <code dir="auto">unknown-parameter</code>; <code dir="auto">.*</code> names nothing and is not judged. Measured on opentitan: 40 findings, spot-checked true, all in pre-silicon testbenches out of step with their RTL. No Verible equivalent.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="void-cast">void-cast</h2><a class="sl-anchor-link" href="#void-cast"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “void-cast”</span></a></div>
<p>Reports <code dir="auto">void'(…)</code> around something that is not a call, where there is no return value to discard — the missing call, or the cast left over from an edit. Verible’s <code dir="auto">void-cast</code> forbids a <em>named list</em> of calls instead, so the two do not overlap; the named-call form is wave 2’s business. Only a cast standing as a statement is judged.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="always-comb">always-comb</h2><a class="sl-anchor-link" href="#always-comb"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “always-comb”</span></a></div>
<p>Reports <code dir="auto">always @*</code> and <code dir="auto">always @(*)</code>, which SystemVerilog spells <code dir="auto">always_comb</code>. The keyword is checked by the tool — a second driver of the block’s outputs becomes an error, and the inferred sensitivity list reaches into the functions the block calls. Verible enables its rule of the same name by default. The fix is offered but <strong>unsafe</strong>: <code dir="auto">always_comb</code> runs once at time zero and <code dir="auto">always @*</code> does not, so a testbench that samples before the first change can see a different value.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="banned-declared-name-patterns">banned-declared-name-patterns</h2><a class="sl-anchor-link" href="#banned-declared-name-patterns"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “banned-declared-name-patterns”</span></a></div>
<p>Reports a declared name matching one of the patterns in the <code dir="auto">patterns</code> option, which is empty by default — the rule is a place for a project to point at its own list (a deprecated prefix, a vendor’s namespace, the <code dir="auto">tmp</code> a review keeps catching). Every declared name is judged: modules, packages, types, parameters, signals, ports, instances, labels. A pattern must match the whole name.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="constraint-name-style">constraint-name-style</h2><a class="sl-anchor-link" href="#constraint-name-style"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “constraint-name-style”</span></a></div>
<p>Reports a <code dir="auto">constraint</code> whose name does not match <code dir="auto">([a-z0-9]+_)+c</code> (the <code dir="auto">pattern</code> option) — the shape Verible enables by default. A constraint’s name is what a test turns off with <code dir="auto">constraint_mode(0)</code>, so it is read far from its declaration.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="explicit-begin">explicit-begin</h2><a class="sl-anchor-link" href="#explicit-begin"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “explicit-begin”</span></a></div>
<p>Reports a body that is a single statement rather than a <code dir="auto">begin ... end</code> block, for eleven constructs each with its own <code dir="auto">*_enable</code> option (<code dir="auto">if_enable</code>, <code dir="auto">else_enable</code>, <code dir="auto">always_ff_enable</code>, …), all on when the rule is. Off by default here as in Verible: the style is far from universal, and a codebase that did not start with it cannot adopt it one line at a time. An <code dir="auto">else if</code> chain is never reported. The safe fix wraps the body; run the formatter afterwards to lay it out.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="forbid-consecutive-null-statements">forbid-consecutive-null-statements</h2><a class="sl-anchor-link" href="#forbid-consecutive-null-statements"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “forbid-consecutive-null-statements”</span></a></div>
<p>Reports a null statement whose preceding token is a <code dir="auto">;</code> — the <code dir="auto">;;</code> an edit leaves behind, and the statement twin of <code dir="auto">empty-item</code>. The empty header of <code dir="auto">for (;;)</code> is not a statement and is never reported. The safe fix deletes the extra <code dir="auto">;</code>.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="generate-label">generate-label</h2><a class="sl-anchor-link" href="#generate-label"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “generate-label”</span></a></div>
<p>Reports a generate <code dir="auto">begin</code> with no <code dir="auto">: label</code>. An unlabelled block still gets a name (<code dir="auto">genblk3</code>), and that invented name is what appears in every hierarchical path — and it renumbers the moment a block is added above it. Silent in a file that does not fully parse: error recovery can rebind a procedural <code dir="auto">begin</code> as a generate one, which on opentitan accounted for 177 of 180 findings before the guard was added.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="generate-label-prefix">generate-label-prefix</h2><a class="sl-anchor-link" href="#generate-label-prefix"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “generate-label-prefix”</span></a></div>
<p>Reports a generate label that starts with none of the <code dir="auto">prefix</code> option’s entries, <code dir="auto">g_</code> and <code dir="auto">gen_</code> by default. The prefix is what makes the generate levels of a hierarchical path visible. An empty list accepts every label while <code dir="auto">generate-label</code> still requires there to be one.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="interface-name-style">interface-name-style</h2><a class="sl-anchor-link" href="#interface-name-style"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “interface-name-style”</span></a></div>
<p>Reports an <code dir="auto">interface</code> whose name does not match <code dir="auto">[a-z_0-9]+(_if)</code> (the <code dir="auto">style_regex</code> option) — Verible’s default pattern. Nothing in the syntax says an identifier is an interface rather than a module or a class; the suffix does.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="line-length">line-length</h2><a class="sl-anchor-link" href="#line-length"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “line-length”</span></a></div>
<p>Reports a line wider than the limit — by default <strong>the width the formatter is configured with for that file</strong>, so the two halves of lucisv cannot disagree; the <code dir="auto">length</code> option overrides it. The check is token-aware, as Verible’s is: a line holding one unbreakable token (a long string, an <code dir="auto"> `include</code> path, a macro invocation) is left alone, because no wrapping could shorten it. There is no fix — where to break a line is what the formatter is for.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="macro-name-style">macro-name-style</h2><a class="sl-anchor-link" href="#macro-name-style"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “macro-name-style”</span></a></div>
<p>Reports a <code dir="auto"> `define</code> whose name does not match <code dir="auto">[A-Z_0-9]+</code> (the <code dir="auto">style_regex</code> option). A macro obeys no scope and can rewrite the code around its use, which is why every language that has them marks them by case. Only the definition is judged, never the uses.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="one-module-per-file">one-module-per-file</h2><a class="sl-anchor-link" href="#one-module-per-file"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “one-module-per-file”</span></a></div>
<p>Reports every <code dir="auto">module</code> after the first in a file. Off by default, as in Verible: plenty of real RTL keeps small helper modules beside the one the file is named for. An <code dir="auto">interface</code>, a <code dir="auto">program</code> and a <code dir="auto">package</code> are not modules. Silent in a file that does not fully parse, where recovery can promote a nested declaration to file scope.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="package-filename">package-filename</h2><a class="sl-anchor-link" href="#package-filename"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “package-filename”</span></a></div>
<p>Reports a one-package file whose name matches neither the package (<code dir="auto">foo.sv</code>) nor the package with a <code dir="auto">_pkg</code> suffix (<code dir="auto">foo_pkg.sv</code>), the two spellings the industry writes. The <code dir="auto">allow-dash-for-underscore</code> option accepts <code dir="auto">foo-pkg.sv</code> as well. Silent for stdin and for a file that does not fully parse; renaming a file is not the linter’s business, so there is no fix.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="parameter-type-name-style">parameter-type-name-style</h2><a class="sl-anchor-link" href="#parameter-type-name-style"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “parameter-type-name-style”</span></a></div>
<p>Reports a <code dir="auto">type</code> parameter whose name does not match <code dir="auto">[a-z][a-z_0-9]*_t</code> (the <code dir="auto">style_regex</code> option). A type parameter is a type, and naming it <code dir="auto">T</code> makes a declaration read like an expression. Off by default here as in Verible: <code dir="auto">#(type T = int)</code> is near-universal in UVM code.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="port-name-suffix">port-name-suffix</h2><a class="sl-anchor-link" href="#port-name-suffix"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “port-name-suffix”</span></a></div>
<p>Reports a port whose name does not end in the suffix for its direction — <code dir="auto">_i</code>/<code dir="auto">_ni</code> for an input, <code dir="auto">_o</code>/<code dir="auto">_no</code> for an output, <code dir="auto">_io</code>/<code dir="auto">_nio</code> for an <code dir="auto">inout</code>, where the <code dir="auto">n</code> marks active-low. The <code dir="auto">suffixes</code> option is the accepted list; one of the six known suffixes is accepted only for its own direction, and anything else a project adds is accepted for any. Off by default: a codebase cannot adopt the convention one port at a time.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="posix-eof">posix-eof</h2><a class="sl-anchor-link" href="#posix-eof"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “posix-eof”</span></a></div>
<p>Reports a file whose last line has no newline — formally, a file with no last line: <code dir="auto">wc -l</code> counts short, and the next edit’s diff shows the final line twice. The safe fix appends the newline. An empty file is left alone.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="signal-name-style">signal-name-style</h2><a class="sl-anchor-link" href="#signal-name-style"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “signal-name-style”</span></a></div>
<p>Reports a net, variable or port inside a module, interface or program whose name does not match <code dir="auto">[a-z_0-9]+</code> (the <code dir="auto">style_regex</code> option). Off by default here as in Verible: switching it on for an existing codebase reports thousands of findings on the first run, which is a project’s decision. Class properties, <code dir="auto">parameter</code>s and subroutine locals are other rules’ business, or nobody’s.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="typedef-enums">typedef-enums</h2><a class="sl-anchor-link" href="#typedef-enums"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “typedef-enums”</span></a></div>
<p>Reports a declaration whose type is an anonymous <code dir="auto">enum</code>. The language gives no way to name such a type afterwards: a function cannot take it, a port cannot carry it, and two variables declared with the same member list are different types to the compiler.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="typedef-structs-unions">typedef-structs-unions</h2><a class="sl-anchor-link" href="#typedef-structs-unions"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “typedef-structs-unions”</span></a></div>
<p>Reports a declaration whose type is an anonymous <code dir="auto">struct</code> or <code dir="auto">union</code>, for the reasons <code dir="auto">typedef-enums</code> gives. The <code dir="auto">allow_anonymous_nested</code> option (true by default here — Verible defaults it to false) exempts an aggregate written inside another aggregate’s body — which is what auto-generated register packages are made of: on opentitan <code dir="auto">hw/</code>, all 3 159 findings are nested structs inside a <code dir="auto">typedef</code> in 57 <code dir="auto">reggen</code>-generated files, and opentitan’s own Verible config disables the rule with the comment “we allow nested struct definitions”. One option, or one <code dir="auto">ignore</code>, expresses the same choice here.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="create-object-name-match">create-object-name-match</h2><a class="sl-anchor-link" href="#create-object-name-match"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “create-object-name-match”</span></a></div>
<p>Reports a <code dir="auto">&lt;type&gt;::type_id::create("name", …)</code> whose string does not match the handle it is assigned to. That string is the object’s UVM instance name, so every <code dir="auto">uvm_config_db</code> path, factory override and <code dir="auto">+uvm_set_config</code> plusarg written against the handle silently misses the object — and nothing fails, it just does not take. Only a plain variable target and a string-literal first argument are judged. Verible’s <code dir="auto">create-object-name-match</code>, same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="dff-name-style">dff-name-style</h2><a class="sl-anchor-link" href="#dff-name-style"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “dff-name-style”</span></a></div>
<p>Reports a nonblocking assignment in an <code dir="auto">always_ff</code> whose target does not end in a registered-output suffix (<code dir="auto">_q</code>, <code dir="auto">_r</code>, <code dir="auto">_ff</code>, <code dir="auto">_reg</code>), one whose <code dir="auto">_d</code>/<code dir="auto">_n</code>/<code dir="auto">_next</code> source does not share its base, and a name ending in one of those suffixes that is driven combinationally instead. Verible’s <code dir="auto">dff-name-style</code>, same default (off) and the same four options — <code dir="auto">input</code>, <code dir="auto">output</code>, <code dir="auto">waive_ifs_with_conditions</code> and <code dir="auto">waive_lhs_regex</code>, whose default is Verible’s <code dir="auto">(?i)mem.*</code> rewritten as <code dir="auto">[mM][eE][mM].*</code> because lucisv’s pattern engine has no inline flags.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="disable-statement">disable-statement</h2><a class="sl-anchor-link" href="#disable-statement"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “disable-statement”</span></a></div>
<p>Reports <code dir="auto">disable &lt;label&gt;</code> where the label is not a sequential block’s. Naming a <code dir="auto">fork</code> block reads as though it kills the forked processes and does something else entirely; <code dir="auto">disable fork</code> is the spelling that works. Wider than Verible: a task or function declared in the same file is also a legal target here, because <code dir="auto">disable task_name</code> is ordinary and reporting it would be a false positive. Verible’s <code dir="auto">disable-statement</code>, same default (off).</p>
<div class="sl-heading-wrapper level-h2"><h2 id="endif-comment">endif-comment</h2><a class="sl-anchor-link" href="#endif-comment"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “endif-comment”</span></a></div>
<p>Reports an <code dir="auto">`endif</code> with no comment beside it naming the condition it closes, and offers a <strong>safe fix</strong> that appends <code dir="auto">// &lt;name&gt;</code>. A bare <code dir="auto">`endif</code> two hundred lines below its <code dir="auto">`ifdef</code> says nothing about which condition just ended. A comment that names something else is reported without a fix — rewriting somebody’s words is not a repair. Verible’s <code dir="auto">endif-comment</code>, same default (off).</p>
<div class="sl-heading-wrapper level-h2"><h2 id="explicit-function-lifetime">explicit-function-lifetime</h2><a class="sl-anchor-link" href="#explicit-function-lifetime"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “explicit-function-lifetime”</span></a></div>
<p>Reports a function declared outside a class with no <code dir="auto">automatic</code> or <code dir="auto">static</code>. Such a function is <code dir="auto">static</code>, its locals are shared by every call, and nothing in the source says the author knew. A prototype declares no locals and is exempt; so is an <strong>out-of-body definition</strong> (<code dir="auto">function cls::f(…)</code>), which is wider than Verible — lexically it sits outside the class, but it <em>is</em> a class method, and on opentitan <code dir="auto">hw/</code> that one exemption removed 948 of 960 findings. Verible’s <code dir="auto">explicit-function-lifetime</code>, same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="explicit-task-lifetime">explicit-task-lifetime</h2><a class="sl-anchor-link" href="#explicit-task-lifetime"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “explicit-task-lifetime”</span></a></div>
<p>The same rule for tasks, and the case is stronger: a task can block, so a <code dir="auto">static</code> one is routinely called from two processes at once with one set of locals between them. Verible’s <code dir="auto">explicit-task-lifetime</code>, same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="forbid-line-continuations">forbid-line-continuations</h2><a class="sl-anchor-link" href="#forbid-line-continuations"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “forbid-line-continuations”</span></a></div>
<p>Reports a string literal broken across lines with a trailing <code dir="auto">\</code>. Such a string keeps every character of the next line, its indentation included, so re-indenting the file changes the string’s value. A multi-line <code dir="auto">`define</code> is not judged — that is the only spelling the language gives. Verible’s <code dir="auto">forbid-line-continuations</code>, same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="forbidden-macro">forbidden-macro</h2><a class="sl-anchor-link" href="#forbidden-macro"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “forbidden-macro”</span></a></div>
<p>Reports an invocation of a macro on the <code dir="auto">macros</code> list, which defaults to Verible’s own single entry, <code dir="auto">`uvm_warning</code> — a message nothing acts on, where the choice belongs at the point of failure (<code dir="auto">`uvm_error</code> or <code dir="auto">`uvm_info</code>). Verible hard-codes its list; here it is an option, so a project bans its own names instead of asking for a rule. Verible’s <code dir="auto">forbidden-macro</code>, same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="legacy-generate-region">legacy-generate-region</h2><a class="sl-anchor-link" href="#legacy-generate-region"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “legacy-generate-region”</span></a></div>
<p>Reports a <code dir="auto">generate … endgenerate</code> region, which SystemVerilog does not need: an <code dir="auto">if</code>, <code dir="auto">for</code> or <code dir="auto">case</code> generate is a module item like any other. Off by default in both, because a codebase that must still compile as Verilog-2001 needs the wrapper. Verible’s <code dir="auto">legacy-generate-region</code>, same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="legacy-genvar-declaration">legacy-genvar-declaration</h2><a class="sl-anchor-link" href="#legacy-genvar-declaration"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “legacy-genvar-declaration”</span></a></div>
<p>Reports a <code dir="auto">genvar</code> declared outside a <code dir="auto">for</code> header, where it outlives the loop that used it and two loops appear to share a variable. Off by default in both, for the same Verilog-2001 reason. Verible’s <code dir="auto">legacy-genvar-declaration</code>, same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="macro-string-concatenation">macro-string-concatenation</h2><a class="sl-anchor-link" href="#macro-string-concatenation"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “macro-string-concatenation”</span></a></div>
<p>Reports the <code dir="auto"> </code> <code dir="auto">token-concatenation operator written inside a *plain* string literal in a</code> <code dir="auto">define `` body, where the preprocessor does not expand it and the two backticks reach the output. The `` </code>“…<code dir="auto">" `` spelling — which the rule skips — is the one that works. Verible's </code>macro-string-concatenation`, same default (off).</p>
<div class="sl-heading-wrapper level-h2"><h2 id="module-begin-block">module-begin-block</h2><a class="sl-anchor-link" href="#module-begin-block"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “module-begin-block”</span></a></div>
<p>Reports a <code dir="auto">begin … end</code> written straight into a module body, where a module item belongs. Tools that accept it treat it as an unnamed generate block, so the declarations inside land in an invented scope and every hierarchical path written against them is wrong. lucisv’s parser <em>recovers</em> the construct in error-tolerant mode — it reads the block as that unnamed generate block and records a diagnostic at the <code dir="auto">begin</code>, so the file is still reported as not parsing cleanly and is still never formatted, while the items inside the block and after it stay visible to every rule. Verible’s <code dir="auto">module-begin-block</code>, same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="numeric-format-string-style">numeric-format-string-style</h2><a class="sl-anchor-link" href="#numeric-format-string-style"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “numeric-format-string-style”</span></a></div>
<p>Reports a <code dir="auto">0x</code>/<code dir="auto">'b</code>-style radix prefix immediately before a <code dir="auto">%</code> specifier that prints a different base (<code dir="auto">"0x%0b"</code>), and any such prefix before a decimal one (<code dir="auto">"0d%0d"</code>). A specifier with no prefix is always accepted. A log line that prints <code dir="auto">addr = 0x1010</code> for a binary value costs the reader an hour. Verible’s <code dir="auto">numeric-format-string-style</code>, same default (off).</p>
<div class="sl-heading-wrapper level-h2"><h2 id="positive-meaning-parameter-name">positive-meaning-parameter-name</h2><a class="sl-anchor-link" href="#positive-meaning-parameter-name"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “positive-meaning-parameter-name”</span></a></div>
<p>Reports a parameter whose name starts with <code dir="auto">disable</code>, in any case. <code dir="auto">if (!DisableEcc)</code> is a double negative and <code dir="auto">DisableEcc = 0</code> means “ECC is on”, which nobody reads correctly at speed. Verible’s <code dir="auto">positive-meaning-parameter-name</code>, same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="proper-parameter-declaration">proper-parameter-declaration</h2><a class="sl-anchor-link" href="#proper-parameter-declaration"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “proper-parameter-declaration”</span></a></div>
<p>Reports a <code dir="auto">parameter</code> written in a module, class or package <em>body</em> rather than in a formal parameter list, and a <code dir="auto">localparam</code> written where the project’s options do not allow it. A body <code dir="auto">parameter</code> is still overridable from outside with nothing at the declaration to say so. A formal parameter list is never judged. Verible’s <code dir="auto">proper-parameter-declaration</code>, same default (off) and the same two options, <code dir="auto">package_allow_parameter</code> (false) and <code dir="auto">package_allow_localparam</code> (true).</p>
<div class="sl-heading-wrapper level-h2"><h2 id="suggest-parentheses">suggest-parentheses</h2><a class="sl-anchor-link" href="#suggest-parentheses"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “suggest-parentheses”</span></a></div>
<p>Reports a conditional expression standing unparenthesized in the true-clause of another (<code dir="auto">a ? b ? c : d : e</code>) and offers a <strong>safe fix</strong> that adds the two characters. The language already reads it that way; the reader has to count colons to find out. A conditional in the false-clause is where the language puts it and is not reported. Verible’s <code dir="auto">suggest-parentheses</code>, same shape and same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="unpacked-dimensions-range-ordering">unpacked-dimensions-range-ordering</h2><a class="sl-anchor-link" href="#unpacked-dimensions-range-ordering"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “unpacked-dimensions-range-ordering”</span></a></div>
<p>Reports an unpacked dimension that counts downwards (<code dir="auto">[7:0]</code>, <code dir="auto">[DEPTH-1:0]</code>), where element 0 is the last one and every <code dir="auto">for (i = 0; …)</code> beside it reads the array backwards. The mirror image of <code dir="auto">packed-dimensions-range-ordering</code>, which wants a vector’s width the other way. A sized, dynamic or associative extent is not a range and is left alone; two symbolic bounds lucisv cannot compare are too. Verible’s <code dir="auto">unpacked-dimensions-range-ordering</code>, same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="uvm-macro-semicolon">uvm-macro-semicolon</h2><a class="sl-anchor-link" href="#uvm-macro-semicolon"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “uvm-macro-semicolon”</span></a></div>
<p>Reports a <code dir="auto">;</code> written after a <code dir="auto">`uvm_*</code> macro invocation. The macros expand to a <code dir="auto">begin … end</code>, so the <code dir="auto">;</code> is a null statement — usually inert, and not after <code dir="auto">if (x) </code>uvm_info(…); else …<code dir="auto">, where the </code>else<code dir="auto">then belongs to nothing. Off by default in both, because the semicolon is written everywhere in existing UVM code. No fix: deleting it is exactly the edit that is unsafe in the shape the rule exists for. Verible's</code>uvm-macro-semicolon`, same default.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="v2001-generate-begin">v2001-generate-begin</h2><a class="sl-anchor-link" href="#v2001-generate-begin"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “v2001-generate-begin”</span></a></div>
<p>Reports a bare <code dir="auto">begin … end</code> written directly inside a <code dir="auto">generate … endgenerate</code> with no <code dir="auto">if</code>, <code dir="auto">for</code> or <code dir="auto">case</code> around it. It opens an unnamed generate block — an invented path segment that renumbers when a block is added above it — and buys nothing, because the region is already a scope. Read from the same recovered block <code dir="auto">module-begin-block</code> reads, one scope in. Verible’s <code dir="auto">v2001-generate-begin</code>, same default.</p>
</div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/reference/rules.md" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-09-05T04:37:55.000Z">Sep 5, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/reference/cli/" rel="prev" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span class="astro-jgq3vlii">Previous<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">CLI</span></span></a><a href="/reference/language-tools/" rel="next" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span class="astro-jgq3vlii">Next<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Language tools</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>
+58 -15
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Rust API index | lucisv</title><link rel="canonical" href="https://lucisv.dev/reference/rust-api/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","softwareVersion":"0.9.0","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Rust API index"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/reference/rust-api/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Index of every public function and method in lucisv’s reusable Rust library crates."/><meta name="description" content="Index of every public function and method in lucisv’s reusable Rust library crates."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Rust API index | lucisv</title><link rel="canonical" href="https://lucisv.dev/reference/rust-api/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Rust API index"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/reference/rust-api/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Navigational index of the main public APIs in lucisv’s reusable Rust library crates."/><meta name="description" content="Navigational index of the main public APIs in lucisv’s reusable Rust library crates."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
window.StarlightThemeProvider = (() => {
const storedTheme =
typeof localStorage !== 'undefined' && localStorage.getItem('starlight-theme');
@@ -70,8 +70,15 @@
})();
</script></sl-sidebar-state-persist><div class="md:sl-hidden"><div class="mobile-preferences sl-flex astro-b5gddk54"><div class="social-icons astro-b5gddk54"><a href="https://git.luci.ooo/lucio/verilogrustformatter" rel="me" class="sl-flex astro-cg55etiy"><span class="sr-only astro-cg55etiy">Source repository</span><svg aria-hidden="true" class="astro-cg55etiy astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M12 .3a12 12 0 0 0-3.8 23.38c.6.12.83-.26.83-.57L9 21.07c-3.34.72-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.08-.74.09-.73.09-.73 1.2.09 1.83 1.24 1.83 1.24 1.08 1.83 2.81 1.3 3.5 1 .1-.78.42-1.31.76-1.61-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.14-.3-.54-1.52.1-3.18 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.28-1.55 3.29-1.23 3.29-1.23.64 1.66.24 2.88.12 3.18a4.65 4.65 0 0 1 1.23 3.22c0 4.61-2.8 5.63-5.48 5.92.42.36.81 1.1.81 2.22l-.01 3.29c0 .31.2.69.82.57A12 12 0 0 0 12 .3Z"/></svg></a></div><starlight-theme-select><label style="--sl-select-width: 6.25em" class="astro-r2p65idu"><span class="sr-only astro-r2p65idu">Select theme</span><svg aria-hidden="true" class="icon label-icon astro-r2p65idu astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M21 14h-1V7a3 3 0 0 0-3-3H7a3 3 0 0 0-3 3v7H3a1 1 0 0 0-1 1v2a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-2a1 1 0 0 0-1-1ZM6 7a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v7H6V7Zm14 10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-1h16v1Z"/></svg><select autocomplete="off" class="astro-r2p65idu"><option value="dark" class="astro-r2p65idu">Dark</option><option value="light" class="astro-r2p65idu">Light</option><option value="auto" selected class="astro-r2p65idu">Auto</option></select><svg aria-hidden="true" class="icon caret astro-r2p65idu astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M17 9.17a1 1 0 0 0-1.41 0L12 12.71 8.46 9.17a1 1 0 1 0-1.41 1.42l4.24 4.24a1.002 1.002 0 0 0 1.42 0L17 10.59a1.002 1.002 0 0 0 0-1.42Z"/></svg></label></starlight-theme-select><script>
StarlightThemeProvider.updatePickers();
</script></div></div></div></div></nav><div class="main-frame astro-gqpr5s5a"><script type="module">var e=document.getElementById(`starlight__sidebar`),t=e?.querySelector(`sl-sidebar-state-persist`),n=`sl-sidebar-state`,r=()=>{let r=[],i=t?.dataset.hash||``;try{let e=sessionStorage.getItem(n),t=JSON.parse(e||`{}`);Array.isArray(t.open)&&t.hash===i&&(r=t.open)}catch{}return{hash:i,open:r,scroll:e?.scrollTop||0}},i=e=>{try{sessionStorage.setItem(n,JSON.stringify(e))}catch{}},a=()=>i(r()),o=(e,t)=>{let n=r();n.open[t]=e,i(n)};t?.addEventListener(`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`summary`)?.closest(`details`);if(!t)return;let n=t.querySelector(`sl-sidebar-restore`),r=parseInt(n?.dataset.index||``);isNaN(r)||o(!t.open,r)}),addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&a()});</script><div class="lg:sl-flex astro-abfeecmu"><aside class="right-sidebar-container print:hidden astro-abfeecmu"><div class="right-sidebar astro-abfeecmu"><div class="lg:sl-hidden astro-q5mffni3"><mobile-starlight-toc data-min-h="2" data-max-h="3" class="astro-5ulgm6bh"><nav aria-labelledby="starlight__on-this-page--mobile" class="astro-5ulgm6bh"><details id="starlight__mobile-toc" class="astro-5ulgm6bh"><summary id="starlight__on-this-page--mobile" class="sl-flex astro-5ulgm6bh"><span class="toggle sl-flex astro-5ulgm6bh">On this page<svg aria-hidden="true" class="caret astro-5ulgm6bh astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg></span><span class="display-current astro-5ulgm6bh"></span></summary><div class="dropdown astro-5ulgm6bh"><ul class="isMobile astro-cxyftcne" style="--depth: 0;"><li style="--depth: 0;" class="astro-cxyftcne"><a href="#_top" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Overview</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#vlog_parser" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">vlog_parser</span></a><ul class="isMobile astro-cxyftcne" style="--depth: 1;"><li style="--depth: 1;" class="astro-cxyftcne"><a href="#entry-points-and-lexical-utilities" style="--depth: 1;" class="astro-cxyftcne"><span style="--depth: 1;" class="astro-cxyftcne">Entry points and lexical utilities</span></a></li><li style="--depth: 1;" class="astro-cxyftcne"><a href="#coordinates-and-token-queries" style="--depth: 1;" class="astro-cxyftcne"><span style="--depth: 1;" class="astro-cxyftcne">Coordinates and token queries</span></a></li><li style="--depth: 1;" class="astro-cxyftcne"><a href="#ast-queries" style="--depth: 1;" class="astro-cxyftcne"><span style="--depth: 1;" class="astro-cxyftcne">AST queries</span></a></li></ul></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#vlog_formatter" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">vlog_formatter</span></a><ul class="isMobile astro-cxyftcne" style="--depth: 1;"><li style="--depth: 1;" class="astro-cxyftcne"><a href="#formatting-and-verification" style="--depth: 1;" class="astro-cxyftcne"><span style="--depth: 1;" class="astro-cxyftcne">Formatting and verification</span></a></li><li style="--depth: 1;" class="astro-cxyftcne"><a href="#document-model-and-printer" style="--depth: 1;" class="astro-cxyftcne"><span style="--depth: 1;" class="astro-cxyftcne">Document model and printer</span></a></li><li style="--depth: 1;" class="astro-cxyftcne"><a href="#alignment-fences-and-ranges" style="--depth: 1;" class="astro-cxyftcne"><span style="--depth: 1;" class="astro-cxyftcne">Alignment, fences, and ranges</span></a></li></ul></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#vlog_linter" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">vlog_linter</span></a><ul class="isMobile astro-cxyftcne" style="--depth: 1;"><li style="--depth: 1;" class="astro-cxyftcne"><a href="#run-and-select-rules" style="--depth: 1;" class="astro-cxyftcne"><span style="--depth: 1;" class="astro-cxyftcne">Run and select rules</span></a></li><li style="--depth: 1;" class="astro-cxyftcne"><a href="#context-diagnostics-and-fixes" style="--depth: 1;" class="astro-cxyftcne"><span style="--depth: 1;" class="astro-cxyftcne">Context, diagnostics, and fixes</span></a></li></ul></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#vlog_semantic" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">vlog_semantic</span></a><ul class="isMobile astro-cxyftcne" style="--depth: 1;"><li style="--depth: 1;" class="astro-cxyftcne"><a href="#file-semantics" style="--depth: 1;" class="astro-cxyftcne"><span style="--depth: 1;" class="astro-cxyftcne">File semantics</spanLine truncated
<p>This is a navigational API index, not source documentation. It lists the public callable surface of the six reusable library crates in the workspace; command-line and language-server binaries are documented in their dedicated references.</p>
</script></div></div></div></div></nav><div class="main-frame astro-gqpr5s5a"><script type="module">var e=document.getElementById(`starlight__sidebar`),t=e?.querySelector(`sl-sidebar-state-persist`),n=`sl-sidebar-state`,r=()=>{let r=[],i=t?.dataset.hash||``;try{let e=sessionStorage.getItem(n),t=JSON.parse(e||`{}`);Array.isArray(t.open)&&t.hash===i&&(r=t.open)}catch{}return{hash:i,open:r,scroll:e?.scrollTop||0}},i=e=>{try{sessionStorage.setItem(n,JSON.stringify(e))}catch{}},a=()=>i(r()),o=(e,t)=>{let n=r();n.open[t]=e,i(n)};t?.addEventListener(`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`summary`)?.closest(`details`);if(!t)return;let n=t.querySelector(`sl-sidebar-restore`),r=parseInt(n?.dataset.index||``);isNaN(r)||o(!t.open,r)}),addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&a()});</script><div class="lg:sl-flex astro-abfeecmu"><aside class="right-sidebar-container print:hidden astro-abfeecmu"><div class="right-sidebar astro-abfeecmu"><div class="lg:sl-hidden astro-q5mffni3"><mobile-starlight-toc data-min-h="2" data-max-h="3" class="astro-5ulgm6bh"><nav aria-labelledby="starlight__on-this-page--mobile" class="astro-5ulgm6bh"><details id="starlight__mobile-toc" class="astro-5ulgm6bh"><summary id="starlight__on-this-page--mobile" class="sl-flex astro-5ulgm6bh"><span class="toggle sl-flex astro-5ulgm6bh">On this page<svg aria-hidden="true" class="caret astro-5ulgm6bh astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg></span><span class="display-current astro-5ulgm6bh"></span></summary><div class="dropdown astro-5ulgm6bh"><ul class="isMobile astro-cxyftcne" style="--depth: 0;"><li style="--depth: 0;" class="astro-cxyftcne"><a href="#_top" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Overview</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#vlog_parser" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">vlog_parser</span></a><ul class="isMobile astro-cxyftcne" style="--depth: 1;"><li style="--depth: 1;" class="astro-cxyftcne"><a href="#entry-points-and-lexical-utilities" style="--depth: 1;" class="astro-cxyftcne"><span style="--depth: 1;" class="astro-cxyftcne">Entry points and lexical utilities</span></a></li><li style="--depth: 1;" class="astro-cxyftcne"><a href="#coordinates-and-token-queries" style="--depth: 1;" class="astro-cxyftcne"><span style="--depth: 1;" class="astro-cxyftcne">Coordinates and token queries</span></a></li><li style="--depth: 1;" class="astro-cxyftcne"><a href="#ast-queries" style="--depth: 1;" class="astro-cxyftcne"><span style="--depth: 1;" class="astro-cxyftcne">AST queries</span></a></li></ul></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#vlog_formatter" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">vlog_formatter</span></a><ul class="isMobile astro-cxyftcne" style="--depth: 1;"><li style="--depth: 1;" class="astro-cxyftcne"><a href="#formatting-and-verification" style="--depth: 1;" class="astro-cxyftcne"><span style="--depth: 1;" class="astro-cxyftcne">Formatting and verification</span></a></li><li style="--depth: 1;" class="astro-cxyftcne"><a href="#document-model-and-printer" style="--depth: 1;" class="astro-cxyftcne"><span style="--depth: 1;" class="astro-cxyftcne">Document model and printer</span></a></li><li style="--depth: 1;" class="astro-cxyftcne"><a href="#alignment-fences-and-ranges" style="--depth: 1;" class="astro-cxyftcne"><span style="--depth: 1;" class="astro-cxyftcne">Alignment, fences, and ranges</span></a></li></ul></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#vlog_linter" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">vlog_linter</span></a><ul class="isMobile astro-cxyftcne" style="--depth: 1;"><li style="--depth: 1;" class="astro-cxyftcne"><a href="#run-and-select-rules" style="--depth: 1;" class="astro-cxyftcne"><span style="--depth: 1;" class="astro-cxyftcne">Run and select rules</span></a></li><li style="--depth: 1;" class="astro-cxyftcne"><a href="#context-diagnostics-and-fixes" style="--depth: 1;" class="astro-cxyftcne"><span style="--depth: 1;" class="astro-cxyftcne">Context, diagnostics, and fixes</span></a></li></ul></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#vlog_semantic" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">vlog_semantic</span></a><ul class="isMobile astro-cxyftcne" style="--depth: 1;"><li style="--depth: 1;" class="astro-cxyftcne"><a href="#file-semantics" style="--depth: 1;" class="astro-cxyftcne"><span style="--depth: 1;" class="astro-cxyftcne">File semantics</spanLine truncated
<p>This is a navigational API index, not source documentation. It summarizes the main public callable surface of the six reusable library crates in the workspace; command-line and language-server binaries are documented in their dedicated references.</p>
<p>The workspace baseline is v0.41.0. For the complete signatures and fields,
run <code dir="auto">cargo doc --workspace --no-deps</code>; this hand-maintained index is not an
exhaustive replacement for rustdoc. The parser’s strict and tolerant entry
points share one grammar; tolerant errors do not imply formatter acceptance.
Any thread calling parsing, analysis, or formatting on deeply nested input
must provide at least <code dir="auto">vlog_parser::PARSE_STACK_SIZE</code> (16 MiB) of stack.
The CLI and server configure their worker threads accordingly.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="vlog_parser"><code dir="auto">vlog_parser</code></h2><a class="sl-anchor-link" href="#vlog_parser"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “vlog_parser”</span></a></div>
<div class="sl-heading-wrapper level-h3"><h3 id="entry-points-and-lexical-utilities">Entry points and lexical utilities</h3><a class="sl-anchor-link" href="#entry-points-and-lexical-utilities"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Entry points and lexical utilities”</span></a></div>
<table>
@@ -218,7 +225,7 @@
</tr>
<tr>
<td><code dir="auto">verify_equivalence</code></td>
<td>Confirm normalized syntax is unchanged</td>
<td>Re-lex and compare normalized tokens, including comments</td>
</tr>
<tr>
<td><code dir="auto">verify_convergence</code></td>
@@ -324,7 +331,15 @@
</tr>
<tr>
<td><code dir="auto">select_rules</code></td>
<td>Apply select/ignore names to the registry</td>
<td>Apply select/ignore rule names or severity classes to the registry</td>
</tr>
<tr>
<td><code dir="auto">rules_named</code></td>
<td>Expand a rule name or severity class to registered rules</td>
</tr>
<tr>
<td><code dir="auto">module_interfaces</code></td>
<td>Build the module interface facts used by lint oracles</td>
</tr>
<tr>
<td><code dir="auto">rules_markdown</code></td>
@@ -343,15 +358,15 @@
<tbody>
<tr>
<td><code dir="auto">ParsedSource</code></td>
<td><code dir="auto">parse</code>, <code dir="auto">lex_error</code>, <code dir="auto">tokens</code>, <code dir="auto">context</code></td>
<td><code dir="auto">parse</code>, <code dir="auto">lex_error</code>, <code dir="auto">tokens</code>, <code dir="auto">file</code>, <code dir="auto">context</code></td>
</tr>
<tr>
<td><code dir="auto">LintContext</code></td>
<td><code dir="auto">new</code>, <code dir="auto">from_parse</code>, <code dir="auto">with_tab_width</code>, <code dir="auto">with_semantics</code>, <code dir="auto">with_oracle</code>, <code dir="auto">mentioned_elsewhere</code>, <code dir="auto">has_oracle</code>, <code dir="auto">semantics</code>, <code dir="auto">source</code>, <code dir="auto">tokens</code>, <code dir="auto">file</code>, <code dir="auto">line_index</code>, <code dir="auto">path</code>, <code dir="auto">tab_width</code>, <code dir="auto">line_text</code>, <code dir="auto">touches_string</code>, <code dir="auto">comments</code></td>
<td><code dir="auto">new</code>, <code dir="auto">from_parse</code>, <code dir="auto">with_tab_width</code>, <code dir="auto">with_line_length</code>, <code dir="auto">with_options</code>, <code dir="auto">with_semantics</code>, <code dir="auto">with_oracle</code>, <code dir="auto">mentioned_elsewhere</code>, <code dir="auto">has_oracle</code>, <code dir="auto">module_interface</code>, <code dir="auto">parsed_cleanly</code>, <code dir="auto">line_length</code>, <code dir="auto">options</code>, <code dir="auto">option_bool</code>, <code dir="auto">option_int</code>, <code dir="auto">option_str</code>, <code dir="auto">option_list</code>, <code dir="auto">option_is_set</code>, <code dir="auto">semantics</code>, <code dir="auto">source</code>, <code dir="auto">tokens</code>, <code dir="auto">file</code>, <code dir="auto">line_index</code>, <code dir="auto">path</code>, <code dir="auto">tab_width</code>, <code dir="auto">line_text</code>, <code dir="auto">touches_string</code>, <code dir="auto">comments</code></td>
</tr>
<tr>
<td><code dir="auto">MentionOracle</code></td>
<td>Implement <code dir="auto">mentioned_outside</code> to supply a project-wide identifier census</td>
<td>Supply <code dir="auto">mentioned_outside</code> and optional <code dir="auto">module_interface</code> for project-aware checks</td>
</tr>
<tr>
<td><code dir="auto">Violation</code></td>
@@ -367,7 +382,23 @@
</tr>
<tr>
<td>module function</td>
<td><code dir="auto">apply_fixes</code></td>
<td><code dir="auto">apply_fixes</code> (caller must filter format-fenced edits)</td>
</tr>
<tr>
<td><code dir="auto">Severity</code></td>
<td><code dir="auto">as_str</code>, <code dir="auto">from_name</code>, <code dir="auto">describes</code>; classes <code dir="auto">Error</code>, <code dir="auto">Warning</code>, <code dir="auto">Style</code></td>
</tr>
<tr>
<td><code dir="auto">RuleOptions</code></td>
<td><code dir="auto">new</code>, <code dir="auto">is_empty</code>, <code dir="auto">set_raw</code>, <code dir="auto">set</code>, <code dir="auto">overlay</code>, <code dir="auto">is_set</code>, <code dir="auto">bool</code>, <code dir="auto">int</code>, <code dir="auto">str</code>, <code dir="auto">list</code></td>
</tr>
<tr>
<td><code dir="auto">OptionKind</code> / <code dir="auto">OptionDefault</code></td>
<td><code dir="auto">as_str</code>, <code dir="auto">vocabulary</code> / <code dir="auto">value</code>, <code dir="auto">as_written</code></td>
</tr>
<tr>
<td>editor settings functions</td>
<td><code dir="auto">vscode_lint_settings</code>, <code dir="auto">rule_setting</code>, <code dir="auto">severity_setting</code></td>
</tr>
</tbody>
</table>
@@ -387,7 +418,7 @@
</tr>
<tr>
<td><code dir="auto">Semantics</code></td>
<td><code dir="auto">scopes</code>, <code dir="auto">symbols</code>, <code dir="auto">symbols_named</code>, <code dir="auto">references</code>, <code dir="auto">file_scope</code>, <code dir="auto">scope</code>, <code dir="auto">symbol</code>, <code dir="auto">symbol_at</code>, <code dir="auto">reference_at</code>, <code dir="auto">reference_id_at</code>, <code dir="auto">reference</code>, <code dir="auto">definition_of</code>, <code dir="auto">references_of</code>, <code dir="auto">document_symbols</code>, <code dir="auto">resolution_counts</code>, <code dir="auto">member_site</code>, <code dir="auto">unit_site</code>, <code dir="auto">instantiable_scope</code>, <code dir="auto">member_scopes</code>, <code dir="auto">file_span</code></td>
<td><code dir="auto">scopes</code>, <code dir="auto">symbols</code>, <code dir="auto">symbols_named</code>, <code dir="auto">duplicates</code>, <code dir="auto">references</code>, <code dir="auto">file_scope</code>, <code dir="auto">scope</code>, <code dir="auto">symbol</code>, <code dir="auto">symbol_at</code>, <code dir="auto">reference_at</code>, <code dir="auto">reference_id_at</code>, <code dir="auto">reference</code>, <code dir="auto">definition_of</code>, <code dir="auto">references_of</code>, <code dir="auto">document_symbols</code>, <code dir="auto">resolution_counts</code>, <code dir="auto">member_site</code>, <code dir="auto">unit_site</code>, <code dir="auto">instantiable_scope</code>, <code dir="auto">member_scopes</code>, <code dir="auto">file_span</code></td>
</tr>
<tr>
<td><code dir="auto">Reference</code></td>
@@ -414,7 +445,7 @@
<tbody>
<tr>
<td><code dir="auto">WorkspaceIndex</code></td>
<td><code dir="auto">build</code>, <code dir="auto">files</code>, <code dir="auto">path</code>, <code dir="auto">file_id</code>, <code dir="auto">units</code>, <code dir="auto">member</code>, <code dir="auto">members_of</code>, <code dir="auto">members_of_chain</code>, <code dir="auto">member_unit</code>, <code dir="auto">instantiations_of</code>, <code dir="auto">subclasses_of</code>, <code dir="auto">base_of</code>, <code dir="auto">instantiations</code>, <code dir="auto">subclasses</code>, <code dir="auto">facts_for</code>, <code dir="auto">defines</code>, <code dir="auto">find_define</code>, <code dir="auto">references_to</code>, <code dir="auto">references_are_ambiguous</code>, <code dir="auto">files_spelling</code>, <code dir="auto">files_mentioning</code>, <code dir="auto">mentioned_outside</code>, <code dir="auto">workspace_symbols</code>, <code dir="auto">units_of</code>, <code dir="auto">instantiable_units</code>, <code dir="auto">counts</code>, <code dir="auto">update_file</code>, <code dir="auto">update_facts</code>, <code dir="auto">absorb</code>, <code dir="auto">remove_file</code>, <code dir="auto">fingerprint</code></td>
<td><code dir="auto">build</code>, <code dir="auto">files</code>, <code dir="auto">path</code>, <code dir="auto">file_id</code>, <code dir="auto">units</code>, <code dir="auto">member</code>, <code dir="auto">members_of</code>, <code dir="auto">members_of_chain</code>, <code dir="auto">member_unit</code>, <code dir="auto">instantiations_of</code>, <code dir="auto">subclasses_of</code>, <code dir="auto">base_of</code>, <code dir="auto">instantiations</code>, <code dir="auto">subclasses</code>, <code dir="auto">facts_for</code>, <code dir="auto">defines</code>, <code dir="auto">find_define</code>, <code dir="auto">references_to</code>, <code dir="auto">references_are_ambiguous</code>, <code dir="auto">files_spelling</code>, <code dir="auto">files_mentioning</code>, <code dir="auto">files_naming_in_macros</code>, <code dir="auto">mentioned_outside</code>, <code dir="auto">workspace_symbols</code>, <code dir="auto">units_of</code>, <code dir="auto">instantiable_units</code>, <code dir="auto">counts</code>, <code dir="auto">update_file</code>, <code dir="auto">update_facts</code>, <code dir="auto">absorb</code>, <code dir="auto">remove_file</code>, <code dir="auto">fingerprint</code></td>
</tr>
<tr>
<td><code dir="auto">IndexBuilder</code></td>
@@ -422,7 +453,7 @@
</tr>
<tr>
<td><code dir="auto">FileFacts</code></td>
<td><code dir="auto">of</code>, <code dir="auto">from_analysis</code>, <code dir="auto">words</code>, <code dir="auto">path</code>, <code dir="auto">encode</code>, <code dir="auto">decode</code></td>
<td><code dir="auto">of</code>, <code dir="auto">from_analysis</code>, <code dir="auto">words</code>, <code dir="auto">macro_words</code>, <code dir="auto">path</code>, <code dir="auto">encode</code>, <code dir="auto">decode</code></td>
</tr>
<tr>
<td><code dir="auto">DefinitionKey</code></td>
@@ -445,11 +476,15 @@
<td>Sort workspace inputs into their deterministic index order</td>
</tr>
<tr>
<td><code dir="auto">words::harvest</code> / <code dir="auto">harvest_text</code></td>
<td><code dir="auto">words::harvest</code> / <code dir="auto">harvest_text</code> / <code dir="auto">harvest_raw</code></td>
<td>Build the shared identifier census from tokens or source text</td>
</tr>
</tbody>
</table>
<p><code dir="auto">FACTS_FORMAT</code> is <strong>17</strong>. Cached facts include normal and macro identifier
censuses; <code dir="auto">Def::lines.positions</code> can carry <code dir="auto">DeclPositions</code> with UTF-16 ranges
for file-scope declarations. Any persisted shape or fact-census change needs
a codec-version decision so stale caches cannot silently omit answers.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="vlog_refactor"><code dir="auto">vlog_refactor</code></h2><a class="sl-anchor-link" href="#vlog_refactor"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “vlog_refactor”</span></a></div>
<div class="sl-heading-wrapper level-h3"><h3 id="rename-and-references">Rename and references</h3><a class="sl-anchor-link" href="#rename-and-references"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Rename and references”</span></a></div>
<table>
@@ -528,6 +563,10 @@
<td>Search indexed module names</td>
</tr>
<tr>
<td><code dir="auto">sites_phrase</code></td>
<td>Share the port-action site-count wording with server offers</td>
</tr>
<tr>
<td><code dir="auto">instantiation_plan</code></td>
<td>Build an instantiation plan from an indexed module</td>
</tr>
@@ -577,7 +616,7 @@
</tr>
</tbody>
</table>
<div class="sl-heading-wrapper level-h3"><h3 id="cache">Cache</h3><a class="sl-anchor-link" href="#cache"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Cache”</span></a></div>
<div class="sl-heading-wrapper level-h3"><h3 id="atomic-writes-and-cache">Atomic writes and cache</h3><a class="sl-anchor-link" href="#atomic-writes-and-cache"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Atomic writes and cache”</span></a></div>
<table>
<thead>
<tr>
@@ -587,6 +626,10 @@
</thead>
<tbody>
<tr>
<td><code dir="auto">atomic::write_atomic</code></td>
<td>Replace file contents through a sibling temp file and rename; callers must coordinate concurrent writes to one target</td>
</tr>
<tr>
<td><code dir="auto">content_hash</code></td>
<td>Compute the cache’s FNV-1a content fingerprint</td>
</tr>
@@ -597,4 +640,4 @@
</tbody>
</table>
<aside aria-label="Types" class="starlight-aside starlight-aside--note"><p class="starlight-aside__title" aria-hidden="true"><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" class="starlight-aside__icon"><path d="M12 11a1 1 0 0 0-1 1v4a1 1 0 0 0 2 0v-4a1 1 0 0 0-1-1Zm.38-3.92a1 1 0 0 0-.76 0 1 1 0 0 0-.33.21 1.15 1.15 0 0 0-.21.33 1 1 0 0 0 .21 1.09c.097.088.209.16.33.21A1 1 0 0 0 13 8a1.05 1.05 0 0 0-.29-.71 1 1 0 0 0-.33-.21ZM12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm0 18a8 8 0 1 1 0-16.001A8 8 0 0 1 12 20Z"/></svg>Types</p><div class="starlight-aside__content"><p>The crates also expose their data models—AST nodes, diagnostics, rule traits, workspace identifiers, edits, plans, and formatter document nodes. This page intentionally indexes callable behavior; generated Rust API docs remain the right place for field-level type details.</p></div></aside>
</div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/reference/rust-api.md" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-08-27T03:31:44.000Z">Aug 27, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/reference/language-tools/" rel="prev" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span class="astro-jgq3vlii">Previous<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Language tools</span></span></a><a href="/reference/architecture/" rel="next" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span class="astro-jgq3vlii">Next<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Architecture</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>
</div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/reference/rust-api.md" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-09-05T04:37:55.000Z">Sep 5, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/reference/language-tools/" rel="prev" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span class="astro-jgq3vlii">Previous<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Language tools</span></span></a><a href="/reference/architecture/" rel="next" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span class="astro-jgq3vlii">Next<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Architecture</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>
+53 -10
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Configuration | lucisv</title><link rel="canonical" href="https://lucisv.dev/start/configuration/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","softwareVersion":"0.9.0","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Configuration"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/start/configuration/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Configure formatting, exclusions, filelists, caching, and editor behavior for lucisv."/><meta name="description" content="Configure formatting, exclusions, filelists, caching, and editor behavior for lucisv."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Configuration | lucisv</title><link rel="canonical" href="https://lucisv.dev/start/configuration/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Configuration"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/start/configuration/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Configure formatting, exclusions, filelists, caching, and editor behavior for lucisv."/><meta name="description" content="Configure formatting, exclusions, filelists, caching, and editor behavior for lucisv."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
window.StarlightThemeProvider = (() => {
const storedTheme =
typeof localStorage !== 'undefined' && localStorage.getItem('starlight-theme');
@@ -72,7 +72,9 @@
StarlightThemeProvider.updatePickers();
</script></div></div></div></div></nav><div class="main-frame astro-gqpr5s5a"><script type="module">var e=document.getElementById(`starlight__sidebar`),t=e?.querySelector(`sl-sidebar-state-persist`),n=`sl-sidebar-state`,r=()=>{let r=[],i=t?.dataset.hash||``;try{let e=sessionStorage.getItem(n),t=JSON.parse(e||`{}`);Array.isArray(t.open)&&t.hash===i&&(r=t.open)}catch{}return{hash:i,open:r,scroll:e?.scrollTop||0}},i=e=>{try{sessionStorage.setItem(n,JSON.stringify(e))}catch{}},a=()=>i(r()),o=(e,t)=>{let n=r();n.open[t]=e,i(n)};t?.addEventListener(`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(`summary`)?.closest(`details`);if(!t)return;let n=t.querySelector(`sl-sidebar-restore`),r=parseInt(n?.dataset.index||``);isNaN(r)||o(!t.open,r)}),addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&a()});</script><div class="lg:sl-flex astro-abfeecmu"><aside class="right-sidebar-container print:hidden astro-abfeecmu"><div class="right-sidebar astro-abfeecmu"><div class="lg:sl-hidden astro-q5mffni3"><mobile-starlight-toc data-min-h="2" data-max-h="3" class="astro-5ulgm6bh"><nav aria-labelledby="starlight__on-this-page--mobile" class="astro-5ulgm6bh"><details id="starlight__mobile-toc" class="astro-5ulgm6bh"><summary id="starlight__on-this-page--mobile" class="sl-flex astro-5ulgm6bh"><span class="toggle sl-flex astro-5ulgm6bh">On this page<svg aria-hidden="true" class="caret astro-5ulgm6bh astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg></span><span class="display-current astro-5ulgm6bh"></span></summary><div class="dropdown astro-5ulgm6bh"><ul class="isMobile astro-cxyftcne" style="--depth: 0;"><li style="--depth: 0;" class="astro-cxyftcne"><a href="#_top" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Overview</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#keys" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Keys</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#discovery" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Discovery</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#strict-parsing" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Strict parsing</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#editor-settings" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Editor settings</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#cache" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Cache</span></a></li></ul></div></details></nav></mobile-starlight-toc><script type="module" src="/_astro/MobileTableOfContents.astro_astro_type_script_index_0_lang.BcSo_yiZ.js"></script></div><div class="right-sidebar-panel sl-hidden lg:sl-block astro-q5mffni3"><div class="sl-container astro-q5mffni3"><starlight-toc data-min-h="2" data-max-h="3"><nav aria-labelledby="starlight__on-this-page"><h2 id="starlight__on-this-page">On this page</h2><ul class="astro-cxyftcne" style="--depth: 0;"><li style="--depth: 0;" class="astro-cxyftcne"><a href="#_top" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Overview</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#keys" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Keys</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#discovery" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Discovery</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#strict-parsing" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Strict parsing</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#editor-settings" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Editor settings</span></a></li><li style="--depth: 0;" class="astro-cxyftcne"><a href="#cache" style="--depth: 0;" class="astro-cxyftcne"><span style="--depth: 0;" class="astro-cxyftcne">Cache</span></a></li></ul></nav></starlight-toc><script type="module" src="/_astro/TableOfContents.astro_astro_type_script_index_0_lang.Csloo1VZ.js"></script></div></div></div></aside><div class="main-pane astro-abfeecmu"><main data-pagefind-body class="astro-vdxcvpsm" lang="en" dir="ltr"><div class="content-panel astro-oil7k7jf"><div class="sl-container astro-oil7k7jf"><h1 id="_top" class="astro-2sm4b3ln">Configuration</h1></div></div><diLine truncated
<div class="expressive-code"><link rel="stylesheet" href="/_astro/ec.w36nc.css"><script type="module" src="/_astro/ec.0vx5m.js"></script><figure class="frame has-title not-content"><figcaption class="header"><span class="title">lucisv.toml</span></figcaption><pre data-language="toml"><code><div class="ec-line"><div class="code"><span style="--0:#C5E478;--1:#3B61B0">line-length</span><span style="--0:#D6DEEB;--1:#403F53"> = </span><span style="--0:#F78C6C;--1:#AA0982">100</span></div></div><div class="ec-line"><div class="code"><span style="--0:#C5E478;--1:#3B61B0">indent</span><span style="--0:#D6DEEB;--1:#403F53"> = </span><span style="--0:#F78C6C;--1:#AA0982">2</span></div></div><div class="ec-line"><div class="code"><span style="--0:#C5E478;--1:#3B61B0">exclude</span><span style="--0:#D6DEEB;--1:#403F53"> = [</span><span style="--0:#D9F5DD;--1:#111111">"</span><span style="--0:#ECC48D;--1:#984E4D">*_gen.sv</span><span style="--0:#D9F5DD;--1:#111111">"</span><span style="--0:#D6DEEB;--1:#403F53">, </span><span style="--0:#D9F5DD;--1:#111111">"</span><span style="--0:#ECC48D;--1:#984E4D">build</span><span style="--0:#D9F5DD;--1:#111111">"</span><span style="--0:#D6DEEB;--1:#403F53">]</span></div></div><div class="ec-line"><div class="code"><span style="--0:#C5E478;--1:#3B61B0">filelist</span><span style="--0:#D6DEEB;--1:#403F53"> = </span><span style="--0:#D9F5DD;--1:#111111">"</span><span style="--0:#ECC48D;--1:#984E4D">rtl/files.f</span><span style="--0:#D9F5DD;--1:#111111">"</span></div></div><div class="ec-line"><div class="code">
</div></div><div class="ec-line"><div class="code"><span style="--0:#D6DEEB;--1:#403F53">[lint]</span></div></div><div class="ec-line"><div class="code"><span style="--0:#C5E478;--1:#3B61B0">select</span><span style="--0:#D6DEEB;--1:#403F53"> = [</span><span style="--0:#D9F5DD;--1:#111111">"</span><span style="--0:#ECC48D;--1:#984E4D">no-tabs</span><span style="--0:#D9F5DD;--1:#111111">"</span><span style="--0:#D6DEEB;--1:#403F53">, </span><span style="--0:#D9F5DD;--1:#111111">"</span><span style="--0:#ECC48D;--1:#984E4D">unused-signal</span><span style="--0:#D9F5DD;--1:#111111">"</span><span style="--0:#D6DEEB;--1:#403F53">]</span></div></div><div class="ec-line"><div class="code"><span style="--0:#C5E478;--1:#3B61B0">ignore</span><span style="--0:#D6DEEB;--1:#403F53"> = [</span><span style="--0:#D9F5DD;--1:#111111">"</span><span style="--0:#ECC48D;--1:#984E4D">module-filename</span><span style="--0:#D9F5DD;--1:#111111">"</span><span style="--0:#D6DEEB;--1:#403F53">]</span></div></div></code></pre><div class="copy"><div aria-live="polite"></div><button title="Copy to clipboard" data-copied="Copied!" data-code="line-length = 100indent = 2exclude = [&quot;*_gen.sv&quot;, &quot;build&quot;]filelist = &quot;rtl/files.f&quot;[lint]select = [&quot;no-tabs&quot;, &quot;unused-signal&quot;]ignore = [&quot;module-filename&quot;]"><div></div></button></div></figure></div>
</div></div><div class="ec-line"><div class="code"><span style="--0:#D6DEEB;--1:#403F53">[lint]</span></div></div><div class="ec-line"><div class="code"><span style="--0:#C5E478;--1:#3B61B0">select</span><span style="--0:#D6DEEB;--1:#403F53"> = [</span><span style="--0:#D9F5DD;--1:#111111">"</span><span style="--0:#ECC48D;--1:#984E4D">no-tabs</span><span style="--0:#D9F5DD;--1:#111111">"</span><span style="--0:#D6DEEB;--1:#403F53">, </span><span style="--0:#D9F5DD;--1:#111111">"</span><span style="--0:#ECC48D;--1:#984E4D">unused-signal</span><span style="--0:#D9F5DD;--1:#111111">"</span><span style="--0:#D6DEEB;--1:#403F53">]</span></div></div><div class="ec-line"><div class="code"><span style="--0:#C5E478;--1:#3B61B0">ignore</span><span style="--0:#D6DEEB;--1:#403F53"> = [</span><span style="--0:#D9F5DD;--1:#111111">"</span><span style="--0:#ECC48D;--1:#984E4D">module-filename</span><span style="--0:#D9F5DD;--1:#111111">"</span><span style="--0:#D6DEEB;--1:#403F53">]</span></div></div><div class="ec-line"><div class="code">
</div></div><div class="ec-line"><div class="code"><span style="--0:#D6DEEB;--1:#403F53">[lint.line-length]</span></div></div><div class="ec-line"><div class="code"><span style="--0:#C5E478;--1:#3B61B0">length</span><span style="--0:#D6DEEB;--1:#403F53"> = </span><span style="--0:#F78C6C;--1:#AA0982">120</span></div></div><div class="ec-line"><div class="code">
</div></div><div class="ec-line"><div class="code"><span style="--0:#D6DEEB;--1:#403F53">[lint.signal-name-style]</span></div></div><div class="ec-line"><div class="code"><span style="--0:#C5E478;--1:#3B61B0">style_regex</span><span style="--0:#D6DEEB;--1:#403F53"> = </span><span style="--0:#D9F5DD;--1:#111111">"</span><span style="--0:#ECC48D;--1:#984E4D">[a-z_0-9]+</span><span style="--0:#D9F5DD;--1:#111111">"</span></div></div></code></pre><div class="copy"><div aria-live="polite"></div><button title="Copy to clipboard" data-copied="Copied!" data-code="line-length = 100indent = 2exclude = [&quot;*_gen.sv&quot;, &quot;build&quot;]filelist = &quot;rtl/files.f&quot;[lint]select = [&quot;no-tabs&quot;, &quot;unused-signal&quot;]ignore = [&quot;module-filename&quot;][lint.line-length]length = 120[lint.signal-name-style]style_regex = &quot;[a-z_0-9]+&quot;"><div></div></button></div></figure></div>
<div class="sl-heading-wrapper level-h2"><h2 id="keys">Keys</h2><a class="sl-anchor-link" href="#keys"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Keys”</span></a></div>
<table>
<thead>
@@ -117,18 +119,29 @@
<td><code dir="auto">[lint].select</code></td>
<td>string array</td>
<td style="text-align: right">defaults</td>
<td>lint rule names</td>
<td>CLI and server</td>
<td>rule names or severity classes</td>
<td>CLI</td>
</tr>
<tr>
<td><code dir="auto">[lint].ignore</code></td>
<td>string array</td>
<td style="text-align: right"><code dir="auto">[]</code></td>
<td>lint rule names</td>
<td>CLI and server</td>
<td>rule names or severity classes</td>
<td>CLI</td>
</tr>
<tr>
<td><code dir="auto">[lint].waivers</code></td>
<td>string array</td>
<td style="text-align: right"><code dir="auto">[]</code></td>
<td>external waiver files, resolved against this file’s directory (Verible’s format; see the linter guide)</td>
<td>CLI and editor</td>
</tr>
</tbody>
</table>
<p><code dir="auto">[lint.&lt;rule-name&gt;]</code> tables configure individual rules. The rule registry
validates option names, types, bounds, and patterns; <code dir="auto">lucisv check --rules-doc</code>
lists every supported option and default. Configuring a rule’s options does
not enable a rule that is off by default.</p>
<p><code dir="auto">filelist</code> does not change what a bare <code dir="auto">lucisv rtl/</code> formats. The CLI reads a filelist only when <code dir="auto">-f</code> names one.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="discovery">Discovery</h2><a class="sl-anchor-link" href="#discovery"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Discovery”</span></a></div>
<p>For each input, lucisv searches upward from that path’s directory:</p>
@@ -140,7 +153,7 @@
</ol>
<p>The first file wins; configuration files are never merged. CLI options override file values per setting. Exclusions are the exception: configuration and CLI patterns are combined.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="strict-parsing">Strict parsing</h2><a class="sl-anchor-link" href="#strict-parsing"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Strict parsing”</span></a></div>
<p>Unknown keys, out-of-range numbers, invalid values, tables other than <code dir="auto">[lint]</code>, multiline arrays, and string escapes are rejected. A bad configuration is an error for the CLI, preventing partial writes. In an editor, the server reports the problem and falls back to the next available setting.</p>
<p>Unknown keys, out-of-range numbers, invalid values, tables other than <code dir="auto">[lint]</code> and <code dir="auto">[lint.&lt;rule&gt;]</code>, and multiline arrays are rejected. This is a deliberate TOML subset. Top-level strings reject backslashes; per-rule strings retain backslashes literally for the pattern dialect and reject embedded quotes. They do not decode TOML string escapes. A bad configuration is an error for the CLI, preventing partial writes. In an editor, the server reports the problem and falls back to the next available setting.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="editor-settings">Editor settings</h2><a class="sl-anchor-link" href="#editor-settings"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Editor settings”</span></a></div>
<table>
<thead>
@@ -244,11 +257,41 @@
<tr>
<td><code dir="auto">lucisv.lint.ignore</code></td>
<td style="text-align: right"><code dir="auto">[]</code></td>
<td>Remove rules from the selected or default set</td>
<td>Remove rules or severity classes from the selected or default set</td>
</tr>
<tr>
<td><code dir="auto">lucisv.lint.severity.error</code> / <code dir="auto">.warning</code> / <code dir="auto">.style</code></td>
<td style="text-align: right"><code dir="auto">true</code></td>
<td>Enable each severity class</td>
</tr>
<tr>
<td><code dir="auto">lucisv.lint.rules.&lt;rule&gt;</code></td>
<td style="text-align: right"><code dir="auto">default</code></td>
<td>Override a rule with <code dir="auto">default</code>, <code dir="auto">on</code>, or <code dir="auto">off</code></td>
</tr>
<tr>
<td><code dir="auto">lucisv.lint.options</code></td>
<td style="text-align: right"><code dir="auto">{}</code></td>
<td>Per-rule option objects, using the same validator as project configuration</td>
</tr>
<tr>
<td><code dir="auto">lucisv.lint.waivers</code></td>
<td style="text-align: right"><code dir="auto">[]</code></td>
<td>External waiver files, absolute or relative to the first workspace folder; added to <code dir="auto">[lint] waivers</code>. A missing file or a bad directive is logged once and dropped. Unused external waivers are reported by <code dir="auto">lucisv check</code> only</td>
</tr>
</tbody>
</table>
<p>Project configuration takes priority over editor settings. For regular VS Code format-on-save, use <code dir="auto">editor.formatOnSave</code>; do not also enable <code dir="auto">lucisv.formatOnSave</code>.</p>
<p>For formatting, project configuration wins over editor line length and
indentation, then editor tab size supplies an indent fallback, then built-in
defaults apply. For regular VS Code format-on-save, use <code dir="auto">editor.formatOnSave</code>;
do not also enable <code dir="auto">lucisv.formatOnSave</code>.</p>
<p>For lint selection, the server currently reads editor settings only. Project
<code dir="auto">[lint] select/ignore</code> lists affect the CLI and are not inherited by the server.
Selection proceeds through defaults → select → severity switches → per-rule
toggles → ignore. Editor rule options overlay project rule options key by key.
Invalid editor options are logged and dropped. Invalid project rule-option
entries are currently dropped by server linting without a per-entry log;
<code dir="auto">lucisv check</code> reports them as configuration errors.</p>
<div class="sl-heading-wrapper level-h2"><h2 id="cache">Cache</h2><a class="sl-anchor-link" href="#cache"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 1 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 0 0-1.42-1.42m8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 1 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l3.88-3.89a4.49 4.49 0 0 0 0-6.33M8.83 15.17a1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.92-4.92a1 1 0 1 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Cache”</span></a></div>
<p>Successful “already formatted” verdicts are cached under <code dir="auto">.lucisv_cache/</code>. Entries are keyed by file, content hash, line length, indentation, and lucisv version. Files that would change or fail are never cached. Use <code dir="auto">--no-cache</code> to disable reads and writes or <code dir="auto">--cache-dir</code> to relocate the store.</p>
</div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/start/configuration.md" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-08-27T03:31:44.000Z">Aug 27, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/start/quick-start/" rel="prev" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span class="astro-jgq3vlii">Previous<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Quick start</span></span></a><a href="/guides/formatter/" rel="next" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span class="astro-jgq3vlii">Next<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Formatter</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>
</div><footer class="sl-flex astro-xhxjzfa7"><div class="meta sl-flex astro-xhxjzfa7"><a href="https://git.luci.ooo/lucio/verilogrustformatter/src/branch/master/docs/site/src/content/docs/start/configuration.md" class="sl-flex print:hidden astro-xk5gmzsg"><svg aria-hidden="true" class="astro-xk5gmzsg astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.2em;"><path d="M22 7.24a1 1 0 0 0-.29-.71l-4.24-4.24a1 1 0 0 0-1.1-.22 1 1 0 0 0-.32.22l-2.83 2.83L2.29 16.05a1 1 0 0 0-.29.71V21a1 1 0 0 0 1 1h4.24a1 1 0 0 0 .76-.29l10.87-10.93L21.71 8c.1-.1.17-.2.22-.33a1 1 0 0 0 0-.24v-.14l.07-.05ZM6.83 20H4v-2.83l9.93-9.93 2.83 2.83L6.83 20ZM18.17 8.66l-2.83-2.83 1.42-1.41 2.82 2.82-1.41 1.42Z"/></svg>Edit page</a><p>Last updated: <time datetime="2026-09-05T04:37:55.000Z">Sep 5, 2026</time></p></div><div class="pagination-links print:hidden astro-jgq3vlii" dir="ltr"><a href="/start/quick-start/" rel="prev" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg><span class="astro-jgq3vlii">Previous<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Quick start</span></span></a><a href="/guides/formatter/" rel="next" class="astro-jgq3vlii"><svg aria-hidden="true" class="astro-jgq3vlii astro-n5k4ipy7" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.5rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg><span class="astro-jgq3vlii">Next<br class="astro-jgq3vlii"><span class="link-title astro-jgq3vlii">Formatter</span></span></a></div></footer></div></div></main></div></div></div></div></body></html>
+1 -1
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Quick start | lucisv</title><link rel="canonical" href="https://lucisv.dev/start/quick-start/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","softwareVersion":"0.9.0","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Quick start"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/start/quick-start/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Install lucisv, format your first SystemVerilog file, add linting to CI, and connect an editor."/><meta name="description" content="Install lucisv, format your first SystemVerilog file, add linting to CI, and connect an editor."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-vdxcvpsm"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Quick start | lucisv</title><link rel="canonical" href="https://lucisv.dev/start/quick-start/"/><link rel="sitemap" href="/sitemap-index.xml"/><script type="application/ld+json">{"@context":"https://schema.org","@type":"SoftwareApplication","name":"lucisv","applicationCategory":"DeveloperApplication","operatingSystem":"macOS, Linux, Windows","license":"https://opensource.org/licenses/MIT","description":"A fast Verilog and SystemVerilog formatter, linter, and language server written in Rust.","codeRepository":"https://git.luci.ooo/lucio/verilogrustformatter"}</script><link rel="shortcut icon" href="/favicon.png" type="image/png"/><meta name="generator" content="Astro v7.2.8"/><meta name="generator" content="Starlight v0.41.9"/><meta property="og:title" content="Quick start"/><meta property="og:type" content="article"/><meta property="og:url" content="https://lucisv.dev/start/quick-start/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Install lucisv, format your first SystemVerilog file, add linting to CI, and connect an editor."/><meta name="description" content="Install lucisv, format your first SystemVerilog file, add linting to CI, and connect an editor."/><meta name="theme-color" content="#07111f"/><meta property="og:site_name" content="lucisv documentation"/><meta property="og:image" content="https://lucisv.dev/og.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:alt" content="lucisv — Verilog tooling that stays out of your way."/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://lucisv.dev/og.png"/><script>
window.StarlightThemeProvider = (() => {
const storedTheme =
typeof localStorage !== 'undefined' && localStorage.getItem('starlight-theme');
@@ -31,7 +31,11 @@ localparam int LONGER = 22;
// verilog_format: on
```
`// lucisv: off` and `// lucisv: on` are aliases. Fences preserve exact bytes inside whole-item regions and also prevent lint fixes there.
`// lucisv: off` and `// lucisv: on` are aliases. Fences preserve exact bytes between items (including class members) and
between statements in blocks, forks, functions, tasks, and procedural bodies.
They also prevent lint fixes there. A fence must begin on its own line;
port/parameter lists, case-label lists, and property/sequence local declarations
do not have independent fence scopes. Fenced text must still parse.
## Range formatting
@@ -47,7 +51,7 @@ The atomic unit is an item: selecting a statement formats its containing `always
## Safety invariants
1. **Parse first.** Whole-file formatting produces no output for a file that cannot be fully parsed.
2. **Preserve meaning.** Verification compares normalized syntax before accepting output.
2. **Preserve meaning.** Verification re-lexes input and output and compares normalized tokens, including comments; it does not elaborate the design.
3. **Converge.** Formatting twice reaches the same fixed point.
4. **Write atomically.** An error leaves the affected file untouched.
5. **Stay deterministic.** Parallel worker count changes performance, never output order or exit status.
+54 -3
View File
@@ -15,15 +15,31 @@ lucisv check --output-format json rtl/
## Selecting rules
`--select` replaces the default set with a comma-separated list. It can be repeated. `--ignore` then removes rules from the selected or default set. Both can also be written in `lucisv.toml` under a `[lint]` table (`select = [...]`, `ignore = [...]`), which a command-line flag overrides key by key, and in an editor as `lucisv.lint.select` / `lucisv.lint.ignore`.
`--select` replaces the default set with a comma-separated list. It can be repeated. `--ignore` then removes rules from the selected or default set. Both accept rule names and the severity classes `error`, `warning`, and `style` (for example, `--ignore style`). Both can also be written in `lucisv.toml` under a `[lint]` table (`select = [...]`, `ignore = [...]`), which a command-line flag overrides key by key, and in an editor as `lucisv.lint.select` / `lucisv.lint.ignore`.
The semantic rules — `unused-signal`, `undriven-net`, `multiply-driven` — run by default wherever lucisv can see the other files of your project (`lucisv check rtl/`, or the language server), because it can then tell that another file reads a signal through a hierarchical path. Over a **single file** or a stdin buffer there is nothing to ask, so they are off and must be `--select`ed.
## Fixes
`--fix` applies safe changes and rewrites the file. Today, `no-tabs` and `no-trailing-whitespace` provide safe fixes. `--unsafe-fixes` widens applicability, but no built-in rule currently offers an unsafe fix.
`--fix` applies safe changes and rewrites the file. Safe fixes include whitespace cleanup, `posix-eof`, `empty-item`,
`undersized-binary-literal`, `explicit-begin`, `suggest-parentheses`, and
`endif-comment`; the rule reference lists applicability per rule.
`--unsafe-fixes` also permits the `always-comb` rewrite, whose scheduling
semantics can differ from `always @*`. Editor quick fixes offer safe fixes only.
Fixes are sorted, overlap-checked, and never applied inside format-fenced regions.
Fixes are sorted, overlap-checked, and filtered against format-fenced regions
by the CLI and server. The reusable linter and `apply_fixes` API are
fence-blind; callers performing automatic edits must apply that protection.
## Options and diagnostics
Use `[lint.<rule>]` in `lucisv.toml` or `lucisv.lint.options` in the editor for
per-rule options. See [configuration](/start/configuration/) for precedence.
`lucisv check --rules-doc` prints all 73 registered rules, their severity,
default selection, fix applicability, and option defaults.
Text output uses `FILE:LINE:COL: severity: message [rule]`. JSON output is one
array, with a `severity` field on each diagnostic.
## Waivers
@@ -39,4 +55,39 @@ endmodule
`verilog_lint:` is accepted in place of `lucisv:` for Verible compatibility. The `unused-waiver` rule reports malformed, unknown, or no-longer-needed suppressions when their target rule is enabled.
Findings can also be suppressed from **outside** the RTL, in Verible's
waiver-file format — one directive per line, `#` comments and blank lines
ignored:
```text
# every line of every file
waive --rule=no-tabs
# one line, or a range with both ends included
waive --rule=line-length --line=12
waive --rule=line-length --line=12-20
# only the files a pattern names
waive --rule=no-tabs --location=legacy/top.sv
```
`--rule` is required and names exactly one rule (a severity word is not
accepted). `--line` is 1-based. `--location` is matched the way an
`--exclude` pattern is — `*` within one path component, a pattern with `/`
matching a path suffix, one without matching the file name at any depth — and
**not** as a regular expression; a pattern that looks like one (`.*`, `\.`,
`[…]`) is an error naming the difference.
Waiver files come from three places, and they add up: `lucisv check
--waiver-file <path>` (repeatable, relative to the working directory),
`waivers` under `[lint]` in `lucisv.toml` (relative to that file; read by the
CLI and the editor), and the editor setting `lucisv.lint.waivers` (relative to
the first workspace folder). External and inline waivers are a union: a
finding either covers is suppressed, and one both cover leaves neither
reported as dead. A missing file or an unparsable directive fails `lucisv
check` with `<file>:<line>: <message>` and exit 2; in an editor the bad line
is dropped and the rest of the file applies — a bad line in a file named by
the editor setting is written once to the lucisv log, one named by
`lucisv.toml` is not (run `lucisv check` to see it). Unused external waivers
are reported under `unused-waiver` at their line of the waiver file, by
`lucisv check` only and only after the whole run.
See the [complete rule reference](/reference/rules/).
@@ -12,8 +12,8 @@ lucisv follows the same separation of concerns that makes ruff fast and maintain
| `vlog_linter` | rule registry, diagnostics, fixes, waiver engine | CLI and language server |
| `vlog_semantic` | scopes, symbols, references, workspace units, external resolution | linter, refactors, language server |
| `vlog_refactor` | rename, references, port propagation, instantiation planning | language server |
| `lucisv_core` | configuration, filelists, walking, exclusions, cache | CLI and language server |
| `lucisv` | argument parsing, parallel processing, output, atomic writes | command-line users and CI |
| `lucisv_core` | configuration, filelists, walking, exclusions, cache, atomic replacement | CLI and language server |
| `lucisv` | argument parsing, parallel per-file processing, reports, write orchestration | command-line users and CI |
| `lucisv_server` | LSP transport, overlays, indexing, capabilities, editor settings | all LSP clients |
## Data flow
@@ -31,15 +31,47 @@ lucisv follows the same separation of concerns that makes ruff fast and maintain
<div><b>LSP</b>Queries, diagnostics, navigation, UI actions.</div>
</div>
## Execution paths and ownership
- **Format:** strict parse → AST-to-document layout → width-aware printer →
normalized token comparison → second parse/format and convergence check.
Only a verified string is returned. Ranges splice whole items; format fences
also protect statement scopes, and verification covers the complete output.
- **Lint:** `ParsedSource` bundles one tokenization and tolerant parse;
`LintContext` supplies source facts and lazy semantics. The registry selects
73 rules with severities and validated options. Inline waivers filter findings,
and the front ends protect fenced bytes before applying fixes.
- **Refactor:** parsed spans and resolved references produce an edit plan;
the engine checks the whole candidate edit before returning it. Server source
selectors bound the input set but must include every file the engine might
edit or refuse over. No formatter dependency is involved.
- **Editor:** one ordered synchronous loop owns `Workspace`; open documents
overlay disk facts. Scans publish index/include/completion batches together.
Closed-file facts persist under codec 17; a bounded file-view cache serves
queries that still need source text. Lazy port actions defer the edit until
selection; recorded file-scope definition positions avoid a closed-file read.
`vlog_parser` and `lucisv_core` depend on no other crates. Formatting and
semantics each depend on the parser; linting and refactoring depend on parser
and semantics. The CLI composes core, parser, formatter, and linter; the server
composes all six libraries. The linter's formatter dependency is test-only.
External dependencies are confined to the CLI worker pool (`rayon`) and the
server's synchronous LSP/JSON stack.
The main change-impact boundaries are the AST and all its walkers, formatter
verification, persisted semantic facts, server state/ordering, and matching
server/editor setting names. Source modules are split by grammar domain under
`parser/`, `ast/`, `format/`, `bind/`, `workspace/`, `ports/`, and `server/`.
## Design invariants
- **Source fidelity:** comments and blank-line intent survive the parser.
- **Determinism:** worker scheduling never affects ordering, formatting, or exit codes.
- **Fixed points:** formatter tests require the second pass to match the first.
- **Fixed points:** every successful formatting call requires the second pass to match the first.
- **Conservative analysis:** incomplete cross-file knowledge produces false negatives rather than noisy false positives.
- **Shared answers:** CLI and editor features call the same library APIs.
- **Recoverable state:** caches are disposable; open buffers remain authoritative while an editor session is active.
## Release surface
One release builds the `lucisv` and `lucisv-server` binaries for Apple Silicon and Intel macOS, static-musl and RHEL-compatible glibc Linux, and Windows, plus the VS Code `.vsix` and checksums. The release tooling audits file type, dynamic linkage, and the glibc ceiling for cross-built artifacts.
The supported publication surface is seven VS Code `.vsix` packages plus checksums: five platform packages (Apple Silicon/Intel macOS, x86-64/ARM64 static-musl Linux, Windows), one all-platform package, and one universal package requiring binaries on `PATH`. Both `lucisv` and `lucisv-server` are bundled in platform packages. Standalone binaries are built by the tooling but are not published as release assets. The release tooling audits file type, dynamic linkage, and the glibc ceiling for cross-built artifacts.
+6 -4
View File
@@ -40,17 +40,19 @@ The subcommand is recognized only as the first argument. To format a file named
| Option | Value | Effect |
|---|---|---|
| `--select` | rule list | Replace defaults with named rules; comma-separated and repeatable |
| `--ignore` | rule list | Remove named rules from the enabled set |
| `--select` | rule/class list | Replace defaults with named rules or `error`, `warning`, `style`; comma-separated and repeatable |
| `--ignore` | rule/class list | Remove named rules or severity classes from the enabled set |
| `--output-format` | `text` or `json` | Select human or machine-readable diagnostics |
| `--fix` | — | Apply safe fixes and rewrite files |
| `--unsafe-fixes` | — | Allow unsafe fixes when a rule provides them |
| `--waiver-file <PATH>` | path | Read Verible-format waiver directives from this file; repeatable. Adds to `[lint] waivers` from `lucisv.toml`. Relative to the working directory. A missing file or an unparsable directive is an error (exit 2) |
| `--rules-doc` | — | Print registry-generated rule and option documentation and exit; takes no files |
Text diagnostics use `FILE:LINE:COL: message [rule]`. JSON output is one array of diagnostic objects.
Text diagnostics use `FILE:LINE:COL: severity: message [rule]`. JSON output is one array of diagnostic objects, each carrying `severity`. JSON output is lint-only; formatter errors remain text on stderr.
## Filelists
An EDA `.f` filelist accepts one source path per line, nested `-f` entries, `+incdir+`, `+define+`, `#` or `//` comments, and `$VAR`/`${VAR}` expansion. Paths resolve relative to the filelist that names them. Include and define options are accepted but ignored because lucisv does not preprocess.
An EDA `.f` filelist accepts one source path per line, nested `-f` entries, `+incdir+`, `+define+`, `#` or `//` comments, and `$VAR`/`${VAR}` expansion. Paths resolve relative to the filelist that names them. The CLI accepts include and define options without preprocessing. The server uses include directories for include navigation; neither front end expands cross-file macros while parsing.
Filelist paths bypass `--exclude` and `.gitignore`, just like direct command-line files. Duplicates are processed once. Unknown options, unset variables, and missing listed files warn without changing the exit code; an unreadable filelist is an error.
@@ -48,9 +48,20 @@ The server speaks standard LSP over stdio. Features are derived from one in-memo
| Pull diagnostics | `textDocument/diagnostic` | Returns current parse and lint diagnostics for a buffer |
| Workspace diagnostics | `workspace/diagnostic` | Streams diagnostics across indexed files |
| Published diagnostics | `textDocument/publishDiagnostics` | Updates clients that use push diagnostics |
| Quick fixes | `textDocument/codeAction` | Exposes safe lint fixes and bulk safe fixes |
| Quick fixes | `textDocument/codeAction` | Exposes safe lint fixes, bulk safe fixes, and port refactor offers |
| Resolve port action | `codeAction/resolve` | Computes a selected port edit against current workspace state |
| Execute command | `workspace/executeCommand` | Applies workspace-aware refactor actions |
Port edits are deferred when the client advertises code-action resolve support
for `edit`; other clients receive eager edits. Lint fixes remain eager. An
inapplicable or stale port action is rejected when resolved. Closed-file
file-scope definition and workspace-symbol locations use recorded index
positions; member locations and open buffers still use current text.
Inlay hints require the instantiated module to be in the active index scope.
A missing hint can therefore be a scope limitation; use a filelist or workspace
index scope when the defining module lives outside the default folder scope.
## Refactoring
| Tool | Protocol method | What it does |
@@ -11,7 +11,7 @@ Every `error`-class rule is held to one discipline: it goes **silent whenever th
This page is hand-written prose. The generated truth is `lucisv check --rules-doc`, which prints every rule with its class, default, fix and rationale straight from the registry — **and every option a rule takes, with its kind and default**.
A configurable rule is configured in a `[lint.<rule-name>]` table of a `lucisv.toml`, or from an editor in the `lucisv.lint.options` object; the option names are Verible's wherever it has the same option. An unknown rule or option name, a value of the wrong kind, an out-of-range integer or a pattern that does not compile fails a CLI run naming the file and the line, and is ignored (with a log line) in an editor.
A configurable rule is configured in a `[lint.<rule-name>]` table of a `lucisv.toml`, or from an editor in the `lucisv.lint.options` object; the option names are Verible's wherever it has the same option. An unknown rule or option name, a value of the wrong kind, an out-of-range integer or a pattern that does not compile fails a CLI run naming the file and the line. Invalid editor option settings are logged and dropped; invalid project-file option entries are currently dropped silently by server linting.
```toml
[lint.line-length]
@@ -1,11 +1,19 @@
---
title: Rust API index
description: Index of every public function and method in lucisv’s reusable Rust library crates.
description: Navigational index of the main public APIs in lucisv’s reusable Rust library crates.
---
<span class="badge">Public functions indexed</span>
This is a navigational API index, not source documentation. It lists the public callable surface of the six reusable library crates in the workspace; command-line and language-server binaries are documented in their dedicated references.
This is a navigational API index, not source documentation. It summarizes the main public callable surface of the six reusable library crates in the workspace; command-line and language-server binaries are documented in their dedicated references.
The workspace baseline is v0.41.0. For the complete signatures and fields,
run `cargo doc --workspace --no-deps`; this hand-maintained index is not an
exhaustive replacement for rustdoc. The parser's strict and tolerant entry
points share one grammar; tolerant errors do not imply formatter acceptance.
Any thread calling parsing, analysis, or formatting on deeply nested input
must provide at least `vlog_parser::PARSE_STACK_SIZE` (16 MiB) of stack.
The CLI and server configure their worker threads accordingly.
## `vlog_parser`
@@ -55,7 +63,7 @@ This is a navigational API index, not source documentation. It lists the public
|---|---|
| `format_source` | Format a complete source string |
| `format_range` | Format only items selected by line ranges |
| `verify_equivalence` | Confirm normalized syntax is unchanged |
| `verify_equivalence` | Re-lex and compare normalized tokens, including comments |
| `verify_convergence` | Confirm a second formatting pass is identical |
### Document model and printer
@@ -90,20 +98,26 @@ This is a navigational API index, not source documentation. It lists the public
| `default_rules` | Return rules enabled for a single-file run |
| `workspace_rules` | Return defaults plus project-aware semantic rules |
| `rule_by_name` | Resolve a registered rule by stable name |
| `select_rules` | Apply select/ignore names to the registry |
| `select_rules` | Apply select/ignore rule names or severity classes to the registry |
| `rules_named` | Expand a rule name or severity class to registered rules |
| `module_interfaces` | Build the module interface facts used by lint oracles |
| `rules_markdown` | Generate canonical Markdown rule documentation |
### Context, diagnostics, and fixes
| Type | Public surface |
|---|---|
| `ParsedSource` | `parse`, `lex_error`, `tokens`, `context` |
| `LintContext` | `new`, `from_parse`, `with_tab_width`, `with_semantics`, `with_oracle`, `mentioned_elsewhere`, `has_oracle`, `semantics`, `source`, `tokens`, `file`, `line_index`, `path`, `tab_width`, `line_text`, `touches_string`, `comments` |
| `MentionOracle` | Implement `mentioned_outside` to supply a project-wide identifier census |
| `ParsedSource` | `parse`, `lex_error`, `tokens`, `file`, `context` |
| `LintContext` | `new`, `from_parse`, `with_tab_width`, `with_line_length`, `with_options`, `with_semantics`, `with_oracle`, `mentioned_elsewhere`, `has_oracle`, `module_interface`, `parsed_cleanly`, `line_length`, `options`, `option_bool`, `option_int`, `option_str`, `option_list`, `option_is_set`, `semantics`, `source`, `tokens`, `file`, `line_index`, `path`, `tab_width`, `line_text`, `touches_string`, `comments` |
| `MentionOracle` | Supply `mentioned_outside` and optional `module_interface` for project-aware checks |
| `Violation` | `new`, `with_fix` |
| `Fix` | `safe`, `unsafe_fix` |
| `Applicability` | `as_str` |
| module function | `apply_fixes` |
| module function | `apply_fixes` (caller must filter format-fenced edits) |
| `Severity` | `as_str`, `from_name`, `describes`; classes `Error`, `Warning`, `Style` |
| `RuleOptions` | `new`, `is_empty`, `set_raw`, `set`, `overlay`, `is_set`, `bool`, `int`, `str`, `list` |
| `OptionKind` / `OptionDefault` | `as_str`, `vocabulary` / `value`, `as_written` |
| editor settings functions | `vscode_lint_settings`, `rule_setting`, `severity_setting` |
## `vlog_semantic`
@@ -112,7 +126,7 @@ This is a navigational API index, not source documentation. It lists the public
| Function or type | Public methods |
|---|---|
| `analyze` | Build a semantic model for one parsed file |
| `Semantics` | `scopes`, `symbols`, `symbols_named`, `references`, `file_scope`, `scope`, `symbol`, `symbol_at`, `reference_at`, `reference_id_at`, `reference`, `definition_of`, `references_of`, `document_symbols`, `resolution_counts`, `member_site`, `unit_site`, `instantiable_scope`, `member_scopes`, `file_span` |
| `Semantics` | `scopes`, `symbols`, `symbols_named`, `duplicates`, `references`, `file_scope`, `scope`, `symbol`, `symbol_at`, `reference_at`, `reference_id_at`, `reference`, `definition_of`, `references_of`, `document_symbols`, `resolution_counts`, `member_site`, `unit_site`, `instantiable_scope`, `member_scopes`, `file_span` |
| `Reference` | `resolved`, `is_external_candidate`, `is_inherited_candidate` |
| `Import` | `path`, `supplies` |
| `Scope` | `lookup_local`, `extends` |
@@ -121,15 +135,20 @@ This is a navigational API index, not source documentation. It lists the public
| Function or type | Public methods |
|---|---|
| `WorkspaceIndex` | `build`, `files`, `path`, `file_id`, `units`, `member`, `members_of`, `members_of_chain`, `member_unit`, `instantiations_of`, `subclasses_of`, `base_of`, `instantiations`, `subclasses`, `facts_for`, `defines`, `find_define`, `references_to`, `references_are_ambiguous`, `files_spelling`, `files_mentioning`, `mentioned_outside`, `workspace_symbols`, `units_of`, `instantiable_units`, `counts`, `update_file`, `update_facts`, `absorb`, `remove_file`, `fingerprint` |
| `WorkspaceIndex` | `build`, `files`, `path`, `file_id`, `units`, `member`, `members_of`, `members_of_chain`, `member_unit`, `instantiations_of`, `subclasses_of`, `base_of`, `instantiations`, `subclasses`, `facts_for`, `defines`, `find_define`, `references_to`, `references_are_ambiguous`, `files_spelling`, `files_mentioning`, `files_naming_in_macros`, `mentioned_outside`, `workspace_symbols`, `units_of`, `instantiable_units`, `counts`, `update_file`, `update_facts`, `absorb`, `remove_file`, `fingerprint` |
| `IndexBuilder` | `new`, `add_file`, `add_facts`, `finish` |
| `FileFacts` | `of`, `from_analysis`, `words`, `path`, `encode`, `decode` |
| `FileFacts` | `of`, `from_analysis`, `words`, `macro_words`, `path`, `encode`, `decode` |
| `DefinitionKey` | `of` |
| `resolve_external` | Resolve unresolved file references against a workspace index |
| `ExternalTarget` | `defs`, `best` |
| `ExternalResolutions` | `get`, `iter`, `counts`, `definition_of` |
| `index_order` | Sort workspace inputs into their deterministic index order |
| `words::harvest` / `harvest_text` | Build the shared identifier census from tokens or source text |
| `words::harvest` / `harvest_text` / `harvest_raw` | Build the shared identifier census from tokens or source text |
`FACTS_FORMAT` is **17**. Cached facts include normal and macro identifier
censuses; `Def::lines.positions` can carry `DeclPositions` with UTF-16 ranges
for file-scope declarations. Any persisted shape or fact-census change needs
a codec-version decision so stale caches cannot silently omit answers.
## `vlog_refactor`
@@ -156,6 +175,7 @@ This is a navigational API index, not source documentation. It lists the public
| `enclosing_module` | Return the module containing a cursor position |
| `module_definition` | Find a unique indexed module definition |
| `module_names` | Search indexed module names |
| `sites_phrase` | Share the port-action site-count wording with server offers |
| `instantiation_plan` | Build an instantiation plan from an indexed module |
| `PortAction` | `label` |
| `InstantiationPlan` | `instance_name`, `has_escaped_identifier`, `render`, `render_with` |
@@ -173,10 +193,11 @@ This is a navigational API index, not source documentation. It lists the public
| `walk::collect_files` | Walk inputs with ignores and exclusions |
| `walk::is_excluded` | Test a path against exclusion patterns |
### Cache
### Atomic writes and cache
| Function or type | Public methods |
|---|---|
| `atomic::write_atomic` | Replace file contents through a sibling temp file and rename; callers must coordinate concurrent writes to one target |
| `content_hash` | Compute the cache’s FNV-1a content fingerprint |
| `Cache` | `load`, `disabled`, `is_clean`, `record`, `store` |
@@ -14,6 +14,12 @@ filelist = "rtl/files.f"
[lint]
select = ["no-tabs", "unused-signal"]
ignore = ["module-filename"]
[lint.line-length]
length = 120
[lint.signal-name-style]
style_regex = "[a-z_0-9]+"
```
## Keys
@@ -24,8 +30,14 @@ ignore = ["module-filename"]
| `indent` | integer | `2` | `1..8` | CLI and server |
| `exclude` | string array | `[]` | path patterns | CLI walk and server index |
| `filelist` | string | — | EDA `.f` path | server index |
| `[lint].select` | string array | defaults | lint rule names | CLI and server |
| `[lint].ignore` | string array | `[]` | lint rule names | CLI and server |
| `[lint].select` | string array | defaults | rule names or severity classes | CLI |
| `[lint].ignore` | string array | `[]` | rule names or severity classes | CLI |
| `[lint].waivers` | string array | `[]` | external waiver files, resolved against this file's directory (Verible's format; see the linter guide) | CLI and editor |
`[lint.<rule-name>]` tables configure individual rules. The rule registry
validates option names, types, bounds, and patterns; `lucisv check --rules-doc`
lists every supported option and default. Configuring a rule's options does
not enable a rule that is off by default.
`filelist` does not change what a bare `lucisv rtl/` formats. The CLI reads a filelist only when `-f` names one.
@@ -42,7 +54,7 @@ The first file wins; configuration files are never merged. CLI options override
## Strict parsing
Unknown keys, out-of-range numbers, invalid values, tables other than `[lint]`, multiline arrays, and string escapes are rejected. A bad configuration is an error for the CLI, preventing partial writes. In an editor, the server reports the problem and falls back to the next available setting.
Unknown keys, out-of-range numbers, invalid values, tables other than `[lint]` and `[lint.<rule>]`, and multiline arrays are rejected. This is a deliberate TOML subset. Top-level strings reject backslashes; per-rule strings retain backslashes literally for the pattern dialect and reject embedded quotes. They do not decode TOML string escapes. A bad configuration is an error for the CLI, preventing partial writes. In an editor, the server reports the problem and falls back to the next available setting.
## Editor settings
@@ -66,9 +78,24 @@ Unknown keys, out-of-range numbers, invalid values, tables other than `[lint]`,
| `lucisv.index.cachePath` | `""` | Override the persistent index location |
| `lucisv.largeFile.threshold` | `4194304` | Switch oversized open buffers to large-file mode |
| `lucisv.lint.select` | `[]` | Replace the default lint rule set |
| `lucisv.lint.ignore` | `[]` | Remove rules from the selected or default set |
| `lucisv.lint.ignore` | `[]` | Remove rules or severity classes from the selected or default set |
| `lucisv.lint.severity.error` / `.warning` / `.style` | `true` | Enable each severity class |
| `lucisv.lint.rules.<rule>` | `default` | Override a rule with `default`, `on`, or `off` |
| `lucisv.lint.options` | `{}` | Per-rule option objects, using the same validator as project configuration |
| `lucisv.lint.waivers` | `[]` | External waiver files, absolute or relative to the first workspace folder; added to `[lint] waivers`. A missing file or a bad directive is logged once and dropped. Unused external waivers are reported by `lucisv check` only |
Project configuration takes priority over editor settings. For regular VS Code format-on-save, use `editor.formatOnSave`; do not also enable `lucisv.formatOnSave`.
For formatting, project configuration wins over editor line length and
indentation, then editor tab size supplies an indent fallback, then built-in
defaults apply. For regular VS Code format-on-save, use `editor.formatOnSave`;
do not also enable `lucisv.formatOnSave`.
For lint selection, the server currently reads editor settings only. Project
`[lint] select/ignore` lists affect the CLI and are not inherited by the server.
Selection proceeds through defaults → select → severity switches → per-rule
toggles → ignore. Editor rule options overlay project rule options key by key.
Invalid editor options are logged and dropped. Invalid project rule-option
entries are currently dropped by server linting without a per-entry log;
`lucisv check` reports them as configuration errors.
## Cache
+90 -34
View File
@@ -3,8 +3,9 @@
**Purpose.** This document is the map an agent reads before touching anything:
which modules depend on which, which features consume which, and where the
two graphs meet. It exists to make parallel multi-agent development safe —
every edge below is an interface somebody can break, and every *absent* edge
is a place two agents can work at the same time without talking.
every edge below is an interface somebody can break. An absent edge is only
a candidate for independent work: confirm current imports, shared files, and
open handshakes before assigning ownership.
Sources of truth this document is derived from (and defers to on conflict):
each crate's `Cargo.toml`, each feature's `docs/features/<name>/README.md`
@@ -23,14 +24,22 @@ null-items (108 feature READMEs); updated 2026-09-02 through v0.33.0 for the
testbench grammar/semantics wave, comment slots, bind semantics, SVA bodies,
and the four decomposition rounds (125 feature READMEs).
**Code audit: 2026-09-04, HEAD `d5abf81`, after the v0.41.0 release (`97aa2fe`).** The crate
edges below were checked against all eight manifests. Current facts codec:
**17**. Recent feature contracts are summarized in §1.4. HEAD
also contains **parser-skips** (TODO §38): implementation committed and QA
accepted, intended for v0.42.0; it is not part of the v0.41.0 release. External
waiver files (TODO §39) remain planned. See [repository-analysis.md](repository-analysis.md)
for findings, validation, and the distinction between measured and historical results.
**Edge notation, used in all three sections:**
| notation | meaning |
|---|---|
| `A ──▶ B` | **A depends solely on B.** A consumes B's published interface; B was not changed for A and does not know A exists. Breaking B's interface breaks A; breaking A costs B nothing. |
| `A ──▶ B` | **A consumes B.** This edge does not imply B is A's only dependency. A consumes B's published interface; B was not changed for A and does not know A exists. Breaking B's interface breaks A; breaking A costs B nothing. |
| `A ◀──▶ B` | **Handshake.** A negotiated, two-sided contract: B changed something *for* A (or both sides pin one wire shape / file format / naming convention), and the contract is written down in one or both READMEs. Either side moving unilaterally breaks the other. |
| `A ─▶ B` | **Not a dependency** — a one-way note whose `kind` column says what it is: `sequencing` (corpus files handed from one bucket to the next), `standing promise` (A imposes a rule on B and its successors), `open request`, or `depends (consumed by)` — the last reads **B depends on A**. |
| *(absent)* | The two are independent. Independent pairs are **not listed** — their absence is the claim. |
| *(absent)* | No dependency is recorded here. Confirm source and file ownership before treating the pair as independent. |
A handshake that was **requested but not yet delivered** is an *open
handshake*; those are collected in §2.9 because they are exactly the
@@ -41,7 +50,7 @@ coordination points parallel agents must not both grab.
## 1. Module dependency graph
"Module" here means: the eight workspace crates, the two editor trees, and
the script layer (`tools/`, `scripts/`, CI). Intra-crate structure that
the script layer (`tools/`, `scripts/`, CI), and the documentation site. Intra-crate structure that
matters for parallel work is in §1.3.
### 1.1 Crate-level graph
@@ -76,18 +85,20 @@ graph TD
TOOLS -.builds/packages.-> SRV
TOOLS -.builds/packages.-> VSC
CI[Gitea Actions] --> TOOLS
DOCS[docs/site] -.documents CLI and generated rule reference.-> CLI
DOCS -.documents protocol.-> SRV
CORPUS[scripts/ + tools/corpus_*] -.exit codes, msg prefixes.-> CLI
```
*(The diagram shows direction only; §1.2 is authoritative on `depends` vs
`handshake` for each edge.)*
External dependencies (all exactly pinned in the workspace `Cargo.toml`):
External Rust dependencies (all exactly pinned in the workspace `Cargo.toml`):
`rayon` (CLI only, sanctioned by TODO §3), `lsp-server` + `lsp-types` +
`serde`/`serde_json` (server only, sanctioned by TODO §6). Those are the only
**direct** external dependencies; everything the workspace itself writes is
std (they pull in ~20 transitive crates — see `Cargo.lock` — which is what an
audit counts, not what an agent can call). `lsp-types` carries
std. Resolved transitive dependencies are recorded in `Cargo.lock`; Node
dependencies for the editor and documentation site have separate manifests. `lsp-types` carries
`features = ["proposed"]` for LSP 3.18 `inlineCompletion` (inline-templates).
### 1.2 Crate edges, documented
@@ -100,17 +111,18 @@ what a change on the pointed-to side must not silently break.
| `vlog_formatter ──▶ vlog_parser` | depends | `parse(tokens, source)` / `parse_source`, the whole AST, `tokenize` (re-used by `verify.rs` to re-lex both sides of the safety net), trivia attachment (`Meta::{leading,trailing,before_sep,attrs}` — comments are never dropped), `RawText.col` (the dedent column for verbatim re-indent), spans. The formatter is the AST's primary consumer: **every new `ItemKind`/`StmtKind`/`ExprKind` variant costs an arm in `format/`** (its matches are exhaustive). |
| `vlog_semantic ──▶ vlog_parser` | depends | The AST read-only, `parse_source_tolerant`/`parse_tolerant` (never fails; `Error` nodes are opaque leaves), the **name-span contract** `src[name_span] == name` on every declaring node, `token::is_keyword`, `defines::collect_defines`/`DefineTable`, `TextRange`. `bind/`'s `ItemKind`/`ExprKind`/`DimKind` matches are exhaustive — new variants cost an arm here too. |
| `vlog_linter ──▶ vlog_parser` | depends | `ParsedSource::parse` = `tokenize` + `parse_tolerant` (one-parse bundle), `LineIndex`, `TextRange`, AST shapes walked by `visit.rs` (which ends in `_ => {}`, so new variants usually cost nothing here), token facts for text rules (a macro use is one `Ident` token; a directive is one `Directive` token). |
| `vlog_linter ──▶ vlog_semantic` | depends | `analyze`, `Semantics::{symbols, references, references_of}` for the three semantic rules (`unused-signal`, `undriven-net`, `multiply-driven`). Lazy: a run with no semantic rule enabled never calls `analyze`. Justified in `vlog_linter/Cargo.toml`; adds no external code (`vlog_semantic` is `vlog_parser` + std). |
| `vlog_linter ──▶ vlog_semantic` | depends | `analyze`, `Semantics::{symbols, references, references_of}` for semantic rules, including signal usage and duplicate-declaration checks. `Semantics::duplicates()` was added by linter-expansion-1 without changing persisted facts. `LintContext::semantics()` computes analysis lazily when a rule asks for it. Justified in `vlog_linter/Cargo.toml`; adds no external code (`vlog_semantic` is `vlog_parser` + std). |
| `vlog_linter ──▶ lucisv_core` | depends | `walk::is_excluded`, the `--exclude` matcher, reused for a waiver file's `--location` so one pattern language serves the whole tool (waiver-files, §39, 2026-09-04). `lucisv_core` still depends on nothing, so no cycle. |
| `vlog_linter ──▶ vlog_formatter` **(dev-only)** | depends (tests) | The `.lint` fix harness asserts a lint fix never produces text `format_source` refuses. **The library dependency list is still `vlog_parser` + `vlog_semantic` + std** — `cargo tree -p vlog_linter -e normal` is the pinned check. Do not promote this to a normal dep; the fence filter deliberately lives in the front ends instead (see shared-fence-filter, §2.4). |
| `vlog_refactor ──▶ vlog_parser` | depends | `tokenize`, `parse_source_tolerant` + diagnostics, `LineIndex`, `TextRange`, the port/instantiation/module AST shapes, `token::is_keyword` (new-name validity), `defines` via the index. Every edit span originates in a parsed node — no textual search-and-replace. |
| `vlog_refactor ──▶ vlog_semantic` | depends | `Semantics` queries (`symbol_at`, `references_of`, `reference_id_at`, …), `Resolution` variants (three of them are refusal rules), `WorkspaceIndex` + `resolve_external` + `ExternalTarget`, and the exactness promise on `name_span` (re-checked before each edit is emitted). One historical exception: refactor-rename added `Target::Declaration` + end-label uses *into* `vlog_semantic` (lead-authorized, additive — see §2.6). |
| `lucisv ──▶ lucisv_core` | depends | `config::{FileConfig, Discovery}` (lucisv.toml discovery — `config::parse` is reached through `Discovery`, not called directly), `walk::{collect_files, EXTENSIONS}` (the `.gitignore`/`--exclude` walk), `filelist::read` (`-f`), `cache` (the format cache). (`walk::is_excluded` is `pub` but currently has no consumer outside the crate.) |
| `lucisv ──▶ lucisv_core` | depends | `config::{FileConfig, Discovery}` (lucisv.toml discovery — `config::parse` is reached through `Discovery`, not called directly), `walk::{collect_files, EXTENSIONS}` (the `.gitignore`/`--exclude` walk), `filelist::read` (`-f`), `cache` (the format cache), `atomic::write_atomic` (formatter and lint-fix replacement). (`walk::is_excluded` is `pub` but currently has no consumer outside the crate.) |
| `lucisv ──▶ vlog_formatter` | depends | `format_source` / `format_range` / `LineRanges` / `Config` / `FormatError`, and `fence::{protected_regions, is_protected}` (the `--fix` fence filter — the linter crate deliberately has no fence notion). |
| `lucisv ──▶ vlog_linter` | depends | The public linter API for `lucisv check` — `lint` + `LintContext`/`ParsedSource`, `apply_fixes`, `select_rules` (the CLI does not call `run` itself). Relies on: rule names stable, linting never panics/writes, findings sorted by `(span.start, span.end, rule)`. |
| `lucisv ──▶ vlog_parser` | depends | `LineIndex` / `TextRange` for lint report coordinates, plus `PARSE_STACK_SIZE` for both the named `lucisv` thread and rayon workers. (The CLI otherwise reaches the parser through the formatter and linter.) |
| `lucisv ──▶ rayon` | depends | The worker pool. Pinned exactly; pool must keep `stack_size(vlog_parser::PARSE_STACK_SIZE)` (currently 16 MiB; recursion-limit handshake) or the parser's depth guarantee regresses to a stack overflow. |
| `lucisv_server ──▶ lucisv_core` | depends | Same config discovery and walk as the CLI (that sameness is the point — format-on-save must agree with `lucisv --check`), `filelist::read` (index scope rung 1, `+incdir+` for the include graph), `cache::content_hash` (re-used by the persistent index cache — one FNV-1a, not two). |
| `lucisv_server ──▶ vlog_parser` | depends | `tokenize`, `parse_source_tolerant`/`parse_tolerant`, `ParseDiagnostic`, `LineIndex`, `TextRange`, tokens + trivia, `defines`, `KEYWORDS` (completion keyword tier; also the source the VS Code grammar is generated from), and `PARSE_STACK_SIZE` for the named `lucisv-main` thread. |
| `lucisv_server ──▶ vlog_parser` | depends | `tokenize`, `parse_source_tolerant`/`parse_tolerant`, `ParseDiagnostic`, `LineIndex`, `TextRange`, tokens + trivia, `defines`, `KEYWORDS` (completion keyword tier; also the source the hand-maintained VS Code grammar is test-locked to), and `PARSE_STACK_SIZE` for the named `lucisv-main` thread. |
| `lucisv_server ──▶ vlog_semantic` | depends | `analyze`/`Semantics` (every navigation answer), `WorkspaceIndex` (build/incremental update, units/members/defines, `instantiations_of`/`subclasses_of` edge tables, `FileFacts` codec for the persistent cache), `resolve_external` overlay, `index_order`/`IndexBuilder` (watched builds). |
| `lucisv_server ◀──▶ vlog_semantic` | handshake | Two negotiated additions, both 2026-08-28 and both additive: **`Symbol::detail_span` / `Def::detail_span`** (where a non-ANSI port's body declaration completes the header that names it — the server's hover card and `nav::definition` both read it, and they show/jump to it in the same order), and **`Semantics::symbols_named`** (name → declarations, built in `analyze`, in declaration order — the server replaced two scan-every-symbol loops with it and the *first-match tie-break must stay declaration order* or hover's choice between two live declarations of one name changes). `docs/features/port-detail-spans/README.md`. |
| `lucisv_server ◀──▶ vlog_semantic` | handshake | Three later additive performance surfaces: **`DeclLines` / `Def::lines`** record declaration and detail lines at index time (`FACTS_FORMAT` 3 → 4); **`WorkspaceIndex::absorb`** folds a scan batch with one merge rather than one merge per file; and **`WorkspaceIndex::files_spelling`** finds external uses by spelling, resolved or not, for rename's dangling-use refusal. The first feeds hover-line-index, the second scan-interleave, and the third refactor-rename's six-rung fan-out. Changing the facts codec, reference-fact census or merge semantics breaks those consumers. |
@@ -158,7 +170,7 @@ what a change on the pointed-to side must not silently break.
grammar, depth/chain budgets from recursion-limit — since the 2026-09-02
decomposition one module per grammar domain: `cursor`, `recover`,
`directive`, `split`, `verbatim`, `item`, `module`, `decl`, `tf`,
`instance`, `stmt`, `keyword_stmt`, `expr`, `primary`, `class`,
`instance`, `recover_list` (header/list-local tolerant recovery), `stmt`, `keyword_stmt`, `expr`, `primary`, `class`,
`covergroup`, `assertion`, `sva`, tests in `parser/tests/`) → `ast/`
(`mod` holds `Meta`/`Comment`/spans/`RawText`; `module`, `decl`, `stmt`,
`expr`, `class`, `covergroup`, `sva` hold the nodes, all re-exported as
@@ -194,7 +206,7 @@ incremental update and `fingerprint`, `record` = the `FileFacts` read-off,
inheritance edge tables, incremental `update_file`/`remove_file`,
reference postings, `files_spelling`, batch `absorb`, declaration `DeclLines`,
`fingerprint`); `facts.rs` (`FileFacts` codec for the persistent cache;
`FACTS_FORMAT` is 16);
`FACTS_FORMAT` is 17);
`instantiations.rs`, `classes.rs` (the shared walks, lifted from the server
so the index census and the request handlers cannot drift).
@@ -202,9 +214,13 @@ so the index census and the request handlers cannot drift).
upward search with its per-instance cache), `walk.rs` (`collect_files`,
`EXTENSIONS`, `.gitignore`/`--exclude` filtering), `filelist.rs` (the `.f`
reader: files, `+incdir+`, defines, warnings), `cache.rs` (the format cache +
`content_hash` — the one FNV-1a the server's index cache also reuses). Knows
nothing of Verilog; depends on nothing; owns two open handshakes (§2.9-1,
§2.9-8).
`content_hash` — the one FNV-1a the server's index cache also reuses),
`atomic.rs` (shared replacement for CLI source writes and the format cache). Knows
nothing of Verilog; depends on nothing. Config stores `LintOption` entries
raw with source/line information; front ends validate them through
`vlog_linter::RuleOptions`, so core still has no linter dependency. Open
contracts include path normalization, walk cycles, and same-target write
coordination (§2.9-1, §2.9-8, §2.9-26).
**`vlog_linter`** — `registry.rs` (`Rule` trait, `all_rules`/`default_rules`/
`select_rules`), `rules/` (one file per rule; names are **stable API** — they
@@ -212,10 +228,14 @@ appear in users' waivers), `context.rs` (`LintContext<'a>`, `ParsedSource`,
lazy `semantics()`), `visit.rs` (the item/statement walk), `waiver.rs`,
`violation.rs` (+ `Fix`, `Applicability`), `signals.rs` (the shared signal
table for the three semantic rules), `naming.rs`, `rule_docs.rs`
(`rules_markdown()` — docs generated from the registry).
(`rules_markdown()` — docs generated from the registry). There are 73 rules;
`severity.rs` classifies them, `options.rs` validates per-rule configuration,
`regex.rs` implements the bounded pattern dialect, and `vscode.rs` generates
editor rule toggles. `decls.rs`, `module_decls.rs`, `exprs.rs`, `preproc.rs`,
`literal.rs`, and `interfaces.rs` share facts and walks across the rule families.
**`vlog_refactor`** — `rename/` (`mod` = the rename, `scope` = the crate-wide
`Scope` cache, `warnings` = the text scans, `tests` = the parity suite;
**`vlog_refactor`** — crate-level `scope.rs` owns the shared `Scope` cache;
`rename/` (`mod` = the rename, `warnings` = the text scans, `tests` = the parity suite;
also the engine of `references.rs::find_references`; publishes the cheap
`prepare_rename_here`/`rename_name_at` selectors whose parity with the full
engine is test-pinned), `ports/` (one file per refactoring: `find`, `add`,
@@ -231,7 +251,7 @@ startup — **keep it that way**, cli-polish → parallel-files handshake),
`args.rs`, `diff.rs`, `lint.rs` (the `check` subcommand; owns the CLI-side
fence filter).
**`lucisv_server`** — layered, 57 production files (`includes.rs` is the one file that
**`lucisv_server`** — layered by responsibility (`includes.rs` is the one file that
spans two layers — the include graph *and* the `documentLink` handler;
`perf.rs` is `#[cfg(test)]`-only and is not a layer — see
`docs/perf/README.md`):
@@ -250,7 +270,7 @@ capabilities), `package.json` (languages, grammar, snippets, settings,
colour ids), `syntaxes/` (hand-maintained grammar, test-locked to
`KEYWORDS`), `snippets/` (static, server-independent), `restart.js` (the one
serialized start/restart chain, so a `lucisv.verbose` toggle cannot be lost to
an in-flight start — shipped, and the only module `extension.js` requires),
an in-flight start — shipped, shared by the extension restart paths),
`hierarchyView.js`/`hierarchyModel.js` (the indexed instance hierarchy sidebar),
`smoke.js` (headless handshake check) and `restart_test.js` (headless check of
that chain, against a scripted fake client), `README.md` (the Marketplace
@@ -258,6 +278,37 @@ Details page, owned by editor-marketplace-page).
---
**`docs/site`** — Astro/Starlight content in `src/content/docs/`, sidebar and
metadata in `astro.config.mjs`, styles in `src/styles/custom.css`, and tracked
static output/search in `dist/`. It consumes the CLI/API/LSP contracts as
documentation, not through a Rust build dependency. Its rule page is editorial;
`lucisv check --rules-doc` is registry-generated truth. Rebuild the tracked
output after content changes, and keep historical measurements dated.
### 1.4 Contracts added since the decomposition baseline
| Feature | Surfaces that must move together | Current state |
|---|---|---|
| macro-word-census | semantic `FileFacts::macro_words`, `files_naming_in_macros`, codec 17 ↔ server rename warnings; linter `rules_markdown` → CLI `--rules-doc` | Delivered; §2.9-5 and -18 closed |
| interface-dpi-arms | parser AST/formal arguments → formatter, binder, spans and argument consumers | Delivered in v0.35.0 |
| statement-fences | formatter `fence.rs` ↔ `format/stmt.rs`, routine bodies and `range.rs`; front ends keep consuming `protected_regions` | Delivered; §2.9-3 closed |
| header-recovery | parser `ListElem::{Ok,Error}`, `ExprKind::Error`, `recover_list.rs` → formatter, semantic, linter, refactor and server list walkers | Tolerant mode preserves valid siblings; strict formatting still rejects malformed input |
| linter-expansion-1 | `Severity`, `Violation::severity`, `rules_named`, `MentionOracle::module_interface`, `Semantics::duplicates` ↔ CLI reports, server diagnostics/settings, generated VS Code toggles | Delivered; duplicate facts are in-memory only |
| linter-expansion-2 | core `FileConfig::lint_options`/`LintOption` → linter `RuleOptions`; registry specs ↔ CLI validation, server option overlay and editor settings | Delivered; core records raw values and does not depend on the linter |
| linter-expansion-3 | shared scoped-item/expression/preprocessor walkers ↔ 73-rule registry, rule docs and generated editor toggles | Delivered; rule names and option keys are user-facing contracts |
| small-items-3 | parser `ItemKind::GenBlock` → every recursive item walker; `recover_list` lookahead; core `atomic::write_atomic` → CLI format/fix and format cache | Delivered in v0.40.0; atomic replacement does not yet coordinate same-target writers (§2.9-26) |
| lazy-code-action | refactor `sites_phrase` ↔ server `ports.rs`; `ClientAbilities::code_action_resolve` ↔ dispatch and `{uri, position, title}` action data; indexed `DeclPositions` → `locate::definition_location` | Delivered in v0.41.0; clients without resolve support retain eager port actions, lint fixes remain eager |
| parser-skips | parser `module.rs`/`split.rs` rival-header detection; `DataDecl::delay: Option<NetDelay>` → formatter `format/decl.rs` and semantic `bind/decl.rs` | **Committed after v0.41.0; QA accepted, release pending**; preserves the written delay position; no verifier normalization change |
| external waiver files | proposed linter waiver parser ↔ core config, CLI args, server settings/diagnostics and VS Code manifest | **Planned (TODO §39)**; no callable API, CLI flag, or config setting yet |
The lazy action resolves against current workspace state and rejects a stale
or inapplicable action. Indexed definition locations bypass closed-file reads
only for file-scope declarations carrying `DeclPositions`; members and open
buffers retain the text-based path. Missing inlay hints can reflect a module
outside the configured index scope, rather than a hint-generation failure.
---
## 2. Feature dependency graph
125 features. They cluster into eight lanes; edges inside a lane are listed in
@@ -491,7 +542,7 @@ promise:
| `refactor-instantiate (M4) ──▶ workspace-index, editor-scopes` | depends | Plans from the index's real definitions; the item-position gate is built on `pairs::analyze`'s published output only. |
| `apply-edit ──▶ refactor-ports` | depends | The port commands now *push* `workspace/applyEdit` (the protocol's actual mechanism) instead of answering the edit as a result no client applies. `ports::execute`'s signature and behavior unchanged — the only `ports.rs` edit was correcting a now-false doc comment, so this is consumption, not a handshake. |
| `references-nav ──▶ refactor-rename` | depends | `find_references` is `Scope::collect_occurrences` lifted out of `collect_edits` — the references list and a rename's touch-set **cannot disagree**, by construction (deliberately not moved to `vlog_semantic`; the walk needs refactor-crate concerns). |
| `refactor-rename ◀──▶ workspace-index / lucisv_server` | handshake | `prepareRename` answers from the open `Document` plus index through `prepare_rename_here`; `rename` asks `rename_name_at` for the engine's target and feeds only `Workspace::rename_sources`'s six-rung superset. The rungs cover declarations/members, resolved postings, instantiation edges, macro definitions, every open buffer, and `files_spelling` for unresolved new-name uses; if a rung cannot bound a case it falls back to all sources. Refusal sentences and whole-scope parity are pinned. Open residue: macro-invocation-argument warnings need §2.9-18. |
| `refactor-rename ◀──▶ workspace-index / lucisv_server` | handshake | `prepareRename` answers from the open `Document` plus index through `prepare_rename_here`; `rename` asks `rename_name_at` for the engine's target and feeds only `Workspace::rename_sources`'s six-rung superset. The rungs cover declarations/members, resolved postings, instantiation edges, macro definitions, every open buffer, and `files_spelling` for unresolved new-name uses; if a rung cannot bound a case it falls back to all sources. Refusal sentences and whole-scope parity are pinned. Macro-invocation warnings outside the selected source set were delivered by macro-word-census (§2.9-18). |
| `file-operations ◀──▶ include-nav / lucisv_server` | handshake | `IncludeGraph::includers` exposes the files that can contain a resolving include; `Workspace::include_sources` overlays open buffers and reads only that set for `willRenameFiles`, instead of the workspace. It is sound only while the graph's held-edge census and `resolve` agree. |
### 2.7 LSP server lane
@@ -566,7 +617,7 @@ update the filing README(s) and this file.
| 1 | `lucisv_core::path::normalize` — one `.`/`..` folding instead of three private copies (`filelist::Reader::normalize`, `config::Discovery::absolute`, `includes::normalize`, the last now `pub`) | include-nav; restated by file-operations | lucisv_core |
| 2 | A span for `DataType` (and `ExprKind::Cast::ty` tails) — the last thing keeping `vlog_semantic/src/scan.rs` alive | vlog-semantic (item 2); restated by class-semantics | vlog_parser |
| ~~3~~ | ~~`fence::scan_nested` has no `ItemKind::Class` arm — formatter fences are inert inside class bodies (the `--fix` backstop still holds; asymmetry errs hands-off)~~ — **delivered 2026-09-02 by statement-fences (TODO §31)**: `scan_nested` enters class bodies, functions, tasks, `always`/`initial`/`final`; statement lists (`begin…end`, `fork…join`, every compound body) are fenceable through `scan_stmt_scope`/`scan_nested_stmt` on the shared `scan_units`; `stmt_docs`/`stmt_seq` obey the two swallowed-unit rules; fence regions merge into `range.rs`'s plan (load-bearing — a fenced statement has no verbatim run behind it). A region opens only at a line start (`opens_line`), so `module m; // lucisv: off` no longer opens one — the rule the format-fences README has stated since round 1. Deferred with reasons: port lists, case-item label lists, same-line fences, `PropSeqDecl.locals`. Opentitan: 4 of its 9 fenced files now keep their fenced bytes. | classes | ~~vlog_formatter (fence.rs)~~ done |
| ~~4~~ | ~~A `lint` key in `lucisv.toml` (`[lint.<rule>]` config; selected-rules list) with CLI>config precedence~~ — **delivered 2026-09-02 by semantic-lints-on**: `[lint] select = […] / ignore = […]` in `lucisv.toml` (CLI over config, key by key; unknown rule names fail the run naming the file; `[lint.<rule>]` tables rejected by name — per-rule config stays filed) and `lucisv.lint.select/ignore` settings (registry-validated, republish on change). | linter-core; restated by lint-rules-2, semantic-lints, server-lint | ~~config-discovery / lucisv_core~~ done |
| ~~4~~ | ~~A `lint` key in `lucisv.toml` (`[lint.<rule>]` config; selected-rules list) with CLI>config precedence~~ — **delivered 2026-09-02 by semantic-lints-on**: `[lint] select = […] / ignore = […]` in `lucisv.toml` (CLI over config, key by key; unknown rule names fail the run naming the file; `[lint.<rule>]` tables rejected by name — per-rule config was delivered later by linter-expansion-2, v0.38.0; the earlier rejection described here is historical) and `lucisv.lint.select/ignore` settings (registry-validated, republish on change). | linter-core; restated by lint-rules-2, semantic-lints, server-lint | ~~config-discovery / lucisv_core~~ done |
| ~~5~~ | ~~`lucisv check --rules-doc` printing `rules_markdown()`~~ — **delivered 2026-09-02 by macro-word-census (TODO §29.3)**: `lucisv check --rules-doc` prints `rules_markdown()` and exits 0, takes no files, is lint-only; the example binary is gone | lint-rules-2 | ~~crates/lucisv~~ done |
| ~~6~~ | ~~Workspace-wide "does any file mention this name" query — the precondition for the semantic lints defaulting on~~ — **delivered 2026-09-02 by semantic-lints-on**: `FileFacts::words` (one identifier harvest, `vlog_semantic::words`, lifted from the server's candidates) and `WorkspaceIndex::files_mentioning` / `mentioned_outside(name, own_file)`; `FACTS_FORMAT` 12 → 13. The three rules consult a `MentionOracle` and are on by default whenever one exists. | semantic-lints | ~~vlog_semantic (index)~~ done |
| ~~7~~ | ~~`SymbolKind::Interface` (interfaces currently indexed as `Module`; modport/clocking names unbound)~~ — **delivered 2026-09-01 by interface-semantics**: `SymbolKind::{Interface, Modport, Clocking}`, `is_instantiable()` threaded through every Module-exact filter, an interface export rule that treats its signals as its surface, modport/clocking-internal names bound as scope-local references, the modport half of a glued type name bound as `Target::TypeMember`. `program` still indexes as `Module`. Corpus unresolved fell 1 256 → 1 203 | interfaces | ~~vlog_semantic~~ done |
@@ -574,9 +625,9 @@ update the filing README(s) and this file.
| ~~9~~ | ~~Chasing `InheritedCandidate` through the member tables (in-file and cross-file) + hover for `extends`~~ — **delivered 2026-09-01 by class-member-access**: `resolve::member_in_chain` walks the in-file `extends` chain, `WorkspaceIndex::base_of` + `member_chain` walk it across files (inside `follow_one`, so hover and cross-file references agree), both cycle-guarded; `this.x`/`super.x` misses ride the same loop. `extends` hover/definition on the base name was already answered by overlay-promotion's type-position promotion. Residue filed in TODO §15 round 2: a `base` field on `ReferenceFact` so `this.x` misses get index postings too | class-semantics | ~~vlog_semantic~~ done |
| ~~10~~ | ~~`Fmt::raw_text`'s string-crossing path emits a `Doc::Text` carrying newlines~~ — **delivered 2026-08-26 (`53f2269`)**: both `raw_text` and the parameterized-type `#( … )` now emit `Doc::Inline`, whose printer arm resumes measuring from the text's own last line. directive-split's README (QA round 3 note) still documents it as open and should be struck there too | directive-split QA | ~~vlog_formatter~~ done |
| 11 | Corpus scripts match `parse error:` / `lex error:` / `verification failed:` textually; a structured `--output-format json` for format mode would remove it | corpus-check | crates/lucisv |
| 12 | `vlog_refactor::rename::Scope::build` re-derives sort-and-dedup by hand; could call `index_order` | indexing-ux | vlog_refactor |
| 12 | `vlog_refactor::scope::Scope::build` re-derives sort-and-dedup by hand; could call `index_order` | indexing-ux | vlog_refactor |
| ~~13~~ | ~~Anonymous-aggregate members (`enum {A,B} x;`) not declared as symbols — hover/definition gap~~ — **delivered 2026-09-01 by struct-members**: anonymous enum variants land in the enclosing scope via the shared `bind_enum_body`; an anonymous `struct {…} s;` declarator and every inline nested struct field carry their own `Struct` child scope, and `member_scope` accepts any symbol whose child scope is a `Struct` scope. Residue filed in the struct-members README: cross-file anonymous struct *variables*, `typeDefinition` inside an anonymous aggregate written as a data declaration | types-decls | ~~vlog_semantic~~ done |
| 14 | A `program` node with `name_span`/`end_label_span` (today it lands in `Error`/verbatim), which would let linked-editing serve it with one arm | linked-editing | vlog_parser |
| ~~14~~ | ~~A `program` node with `name_span`/`end_label_span` for linked editing~~ — **delivered by vendor-formal-grammar (0.30.0)**: `parser/item.rs` routes `program` to `parse_module("endprogram")`; the resulting `ItemKind::Module` carries both spans and `linked.rs::module_pairs` consumes them. Confirmed in the 2026-09-04 source audit. | linked-editing | ~~vlog_parser~~ done |
| ~~15~~ | ~~Bind semantics: whether a `bind`'s target scope and connections should resolve through the workspace index (today only the instantiated module name is recorded)~~ — **delivered 2026-09-02 by bind-semantics**: `BindDirective::target` is `Vec<PathSegment { name, span, index }>`; a lone target binds as `Target::Module`, an instance path records nothing (a guess would be a wrong answer); each connection's port half is `Target::Port(inst.module)` and its expression half `Target::BindScope` — the target's own scope first (`resolve::in_bind_target`, `None` on a miss because generate blocks open scopes of their own), the workspace's one-segment member path when the target lives elsewhere, the writing scope last. `FACTS_FORMAT` 14 → 15 | bind | ~~vlog_semantic~~ done |
| 16 | DPI/package re-export halves as real references (`export pkg::item` doesn't resolve; `*::*` has `"*"` as its package name, which nothing expects) | dpi-export | vlog_semantic |
| 17 | Inline aggregate as a parameter-override *argument* (`m #(.T(struct packed { logic a; })) u ();`) is rejected in expression position; M4's `instantiation_plan` drops such a `parameter type` default rather than emit unparseable text | refactor-instantiate (gap 1; its gap 2 was delivered by ansi-first-port) | vlog_parser |
@@ -589,6 +640,10 @@ update the filing README(s) and this file.
| ~~24~~ | ~~A **half-typed `#(` parameter override whose value can read as a call** (`sub #(.W(` ⏎ `u0 (.a(x))`) — the greedy expression grammar swallows the next instance's name before any error fires, so the whole instantiation still degrades to an item-level `Error` node instead of getting header recovery's benefit. Found by §32's QA; the fix is a lookahead in the override grammar (an identifier followed by `(` on a later line is the next instance, not a call).~~ — **delivered 2026-09-04 by small-items-3 (TODO §36)** | header-recovery (QA) | vlog_parser |
| ~~25~~ | ~~The parser **refuses** a module-scope `begin … end` and a bare `begin` inside a `generate` region (an `ItemKind::Error`) rather than recovering them as an unnamed generate block, so `module-begin-block` and `v2001-generate-begin` (TODO §35) fire on an error leaf and the rest of the unit is lost to recovery. Wanted: tolerant-mode recovery that keeps the block's items.~~ — **delivered 2026-09-04 by small-items-3 (TODO §36)** | linter-expansion-3 (dev) | vlog_parser |
| 26 | **Same-target atomic writers share a temp path.** `atomic::temp_path` uses canonical target + process ID; parallel workers following distinct symlink spellings can reach that same name, while CLI dedup is lexical. A bounded direct helper probe (100 rounds, two threads, 1 MiB each) returned 100 write errors in 200 calls; no mixed final bytes observed in that probe. Use exclusive per-operation temp creation and coordinate/deduplicate target writes. See repository-analysis.md for limits. | repository audit, 2026-09-04 | lucisv_core / lucisv |
| 27 | **Net-delay comment slot**: parser-skips records a pre-existing refusal for a comment immediately before `#` in a net declaration. The regression cases mark it `#SKIP`; preserve the verifier's rejection until a parser/formatter comment slot handles it. | parser-skips (dev + QA) | vlog_parser / vlog_formatter |
| 28 | **Project lint selection is not consumed by the server.** `enabled_rules` reads `ClientSettings`; `configured` reads project rule options and line length only. `[lint] select/ignore` currently controls CLI runs, while the editor needs `lucisv.lint.select/ignore`. Decide and test a common precedence contract before claiming project-wide parity. | repository audit, 2026-09-04 | lucisv_server |
---
## 3. Combined graph — features mapped onto modules
@@ -598,8 +653,9 @@ update the filing README(s) and this file.
Where a feature's code chiefly lives (its README remains the authority on
exact file scope). Cross-module touches are recorded per-feature in §2 and in
each feature README's Handshakes; this matrix names only the primary home.
The newer features and their complete cross-crate touch sets are in §1.4.
Grammar-lane features (*italicized*) routinely add exhaustive-match arms in
other crates — see §3.3's `ast.rs` row — though not always a formatter arm:
other crates — see §3.3's `ast/` row — though not always a formatter arm:
directive-split and ansi-first-port shipped with `vlog_formatter/src`
untouched, reusing existing arms.
@@ -607,7 +663,7 @@ untouched, reusing existing arms.
|---|---|
| `vlog_parser` | spans, name-spans, recursion-limit, error-recovery, define-table, lexer-cleanup, decomposition-parser, and the grammar lane: *macro-items*, *classes*, *bind*, *dynamic-types*, *types-decls*, *item-misc*, *directives-in-lists*, *directives-in-instances*, *dpi-export*, *assertions*, *interfaces*, *expressions-2*, *dv-statements*, *mop-up-2*, *directive-split*, *ansi-first-port*, *null-items*, *constraint-bodies*, *covergroup-bodies*, *fragment-mode*, *vendor-formal-grammar*, *comment-slots*, *bind-semantics*, *sva-bodies* (most also add formatter arms — parser+formatter pairs by default; directive-split and ansi-first-port reused existing arms and left `vlog_formatter/src` untouched) |
| `vlog_formatter` | safety-net (`verify.rs`), case-tables, formatter-bug-fixes, corpus-bugs, comments-round, comments-round-2, alignment (`align.rs`), format-fences (`fence.rs`), range-formatting (`range.rs`), shared-fence-filter, decomposition-formatter, and the layout halves of constraint-bodies, covergroup-bodies, comment-slots, bind-semantics and sva-bodies (`format/`) |
| `vlog_semantic` | vlog-semantic (`bind/`, `resolve.rs`, `model.rs`), workspace-index (`workspace/`), decomposition-semantic, class-semantics, interface-semantics, class-member-access, struct-members, overlay-promotion, port-detail-spans (`Symbol`/`Def::detail_span` and `Semantics::symbols_named`), hover-line-index (`DeclLines`, facts codec), vscode-hierarchy-sidebar's declaration/instance positions, scan-interleave (`WorkspaceIndex::absorb`), semantic-lints-on's word census, bind-semantics and sva-bodies, refactor-rename's performance amendment (`files_spelling`), plus the index halves of indexing-ux (`index_order`/`IndexBuilder`), index-scope (order-insensitive `finish`, facts-from-analysis), incremental-index (`update_file`, edge/reference tables, `instantiations.rs`, `classes.rs`), index-persistence (`facts.rs`; current `FACTS_FORMAT` 16; plus a small `vlog_parser::defines` touch — `DefineTable::from_entries`, `Eq` derives) |
| `vlog_semantic` | vlog-semantic (`bind/`, `resolve.rs`, `model.rs`), workspace-index (`workspace/`), decomposition-semantic, class-semantics, interface-semantics, class-member-access, struct-members, overlay-promotion, port-detail-spans (`Symbol`/`Def::detail_span` and `Semantics::symbols_named`), hover-line-index (`DeclLines`, facts codec), vscode-hierarchy-sidebar's declaration/instance positions, scan-interleave (`WorkspaceIndex::absorb`), semantic-lints-on's word census, bind-semantics and sva-bodies, refactor-rename's performance amendment (`files_spelling`), plus the index halves of indexing-ux (`index_order`/`IndexBuilder`), index-scope (order-insensitive `finish`, facts-from-analysis), incremental-index (`update_file`, edge/reference tables, `instantiations.rs`, `classes.rs`), index-persistence (`facts.rs`; current `FACTS_FORMAT` 17; plus a small `vlog_parser::defines` touch — `DefineTable::from_entries`, `Eq` derives) |
| `vlog_linter` | linter-core, lint-harness, lint-rules-2, semantic-lints (`signals.rs`), semantic-lints-on (workspace oracle), one-parse (`context.rs`) |
| `vlog_refactor` | refactor (plan), refactor-rename (including `prepare_rename_here` / `rename_name_at` selector half), refactor-ports (including module-target selectors), refactor-instantiate, references-nav (whole-scope equivalence oracle), and the refactor half of decomposition-semantic |
| `lucisv_core` | lucisv-core-lift (`config.rs`, `walk.rs`), filelist (`filelist.rs`), format-cache (`cache.rs`) |
@@ -642,7 +698,7 @@ graph TD
clif[cli lane features]
end
subgraph srv [lucisv_server]
caps[capability features &#40;~30&#41;]
caps[capability handlers]
end
subgraph ed [editors/vscode + tools/CI]
pkg[packaging lane]
@@ -670,7 +726,7 @@ graph TD
Reading it feature-side: a grammar feature is by default a
**parser+formatter pair** (new AST + its layout, plus minimal arms in
`bind.rs`/`spans.rs`) — though one that reuses an existing arm ships with the
`bind/`/`tests/spans.rs`) — though one that reuses an existing arm ships with the
formatter untouched (directive-split, ansi-first-port); an index feature is a
**vlog_semantic + lucisv_server pair** (the data structure and the
events/settings around it); a capability feature is usually **server-only
@@ -692,13 +748,13 @@ ownership explicitly.
| choke point | owner (feature) | consumers | the rule |
|---|---|---|---|
| `vlog_parser/src/ast/` | the grammar lane collectively | formatter, semantic, linter, refactor, server, `tests/spans.rs` | A new variant costs, at minimum: a `format/` arm, a `bind/` arm, a `spans.rs` arm. `visit.rs` is catch-all for compilation only — a variant containing items/statements still needs an arm there or AST lint rules never see inside it. Prefer **additive fields / parallel vectors** over changing vector element types — that is why `ListDirective` sits beside the lists instead of inside them (two rounds chose it independently for blast-radius reasons). |
| `vlog_formatter/src/verify.rs` | safety-net | every formatter feature; the CLI's exit-2 promise | CLAUDE.md invariant #4. Never widen a normalization without masked-corruption attack tests; the standing pattern is "untouched + rejection tests anyway". The single widening in history is macro-items' backtick-`Ident` arm in `normalize` — which produced lucisv's one real corruption; its repair, `trim_lines_outside_strings`, is a *narrowing*, and the pattern to copy: the widening shipped without attack tests, the fix shipped with them. `line_starts_inside_string` is the one definition of "which line breaks are data" — both `format.rs` and `verify.rs` must read it. |
| `vlog_formatter/src/fence.rs` | format-fences | range-formatting, shared-fence-filter, CLI `--fix` (`lucisv/src/lint.rs`), server quick fixes (`lucisv_server/src/lint.rs`) | `protected_regions`/`is_protected` are the **only** supported way to ask "may an automatic edit touch these bytes". One answer, **two** front ends — and `vlog_linter` is deliberately not one of them (it stays fence-blind; the filter lives in each front end). Open gap: no `Class` arm in `scan_nested` (§2.9-3). |
| `vlog_formatter/src/verify.rs` | safety-net | every formatter feature; the CLI's exit-2 promise | CLAUDE.md invariant #4. Never widen a normalization without masked-corruption attack tests; the standing pattern is "untouched + rejection tests anyway". The single widening in history is macro-items' backtick-`Ident` arm in `normalize` — which produced lucisv's one real corruption; its repair, `trim_lines_outside_strings`, is a *narrowing*, and the pattern to copy: the widening shipped without attack tests, the fix shipped with them. `line_starts_inside_string` is the one definition of "which line breaks are data" — both `format/` and `verify.rs` must read it. |
| `vlog_formatter/src/fence.rs` | format-fences | range-formatting, shared-fence-filter, CLI `--fix` (`lucisv/src/lint.rs`), server quick fixes (`lucisv_server/src/lint.rs`) | `protected_regions`/`is_protected` are the **only** supported way to ask "may an automatic edit touch these bytes". One answer, **two** front ends — and `vlog_linter` is deliberately not one of them (it stays fence-blind; the filter lives in each front end). Class and statement scopes are supported by statement-fences (§2.9-3 delivered); `range::plan` must merge these protected spans with unselected runs. Port and case-label lists remain outside independent fence scopes. |
| `lucisv_server/src/pairs.rs` | editor-scopes | documentHighlight, missing-closer diagnostics, scopePairs rainbow, folding, completion gates, on-type indent, inline-templates, expand-selection (`selection.rs`) | The `RULES` table + no-closer guard list is shared truth. Any keyword added to/removed from `token.rs` requires re-checking it (a word that stops being a keyword silently stops being matched). |
| `lucisv_server/src/server/` | lucisv-server; amended by cancel-request, change-debounce, scan-interleave, index-scope, verbose-timing | every request/notification and every rebuild trigger | One ordered loop owns all mutable server state. A startup scan may publish a prefix and answer queued work between files; a request queued behind a rescan trigger is held until that rescan lands, and its cancel travels with it. Never make the distinction time-based: machine load must not change which index a request sees. Verbose timing may observe each wrapper/lifecycle but must be entirely silent when off and must not move protocol ordering. The queue thread only forwards protocol messages and must never parse. |
| `lucisv_server/src/state.rs` | lucisv-server; amended by filelist, index-scope, scan-interleave, indexing-ux, incremental-index, index-persistence, hover-line-index, large-file-mode, one-parse (`Document.tree`), editor-settings + folders-and-config (`set_client_settings`/`change_roots`), include-nav (the include graph), completion-core (candidates), file-watching, interactive-latency (`first_token_reaching`/`first_token_from`), refactor performance fan-outs | every handler | `Workspace` is immutable through request handlers except the interior-mutable four-entry/8 MiB `FileView` cache. The scope ladder (filelist > `index.scope: "workspace"` > folder-scope at shipped depth 2; a rootless session never climbs and always reads its own directory flat) and open-buffer overlay are contracts. `Scan` has whole/widen shapes but one step/finish path; index/candidate/include prefixes publish together. `module_sources`, `rename_sources`, and `include_sources` must remain supersets of what their engines can edit/refuse over; `rename_sources` falls back to `sources()` when an ambiguous posting prevents a proven bound. `update_one` and a completed scan must equal a fresh build (`fingerprint`). Handlers reading `doc.text` instead of tokens/tree must check `doc.large`. |
| `lucisv_server/src/state.rs` | lucisv-server; amended by filelist, index-scope, scan-interleave, indexing-ux, incremental-index, index-persistence, hover-line-index, large-file-mode, one-parse (`Document.tree`), editor-settings + folders-and-config (`set_client_settings`/`change_roots`), include-nav (the include graph), completion-core (candidates), file-watching, interactive-latency (`first_token_reaching`/`first_token_from`), refactor performance fan-outs | every handler | `Workspace` is immutable through request handlers except the interior-mutable four-entry/8 MiB `FileView` cache. The scope ladder (filelist > `index.scope: "workspace"` > folder-scope at shipped depth 2; a rootless session never climbs; it reads flat at depth 0 and walks descendants at positive depth (including the default 2)) and open-buffer overlay are contracts. `Scan` has whole/widen shapes but one step/finish path; index/candidate/include prefixes publish together. `module_sources`, `rename_sources`, and `include_sources` must remain supersets of what their engines can edit/refuse over; `rename_sources` falls back to `sources()` when an ambiguous posting prevents a proven bound. `update_one` and a completed scan must equal a fresh build (`fingerprint`). Handlers reading `doc.text` instead of tokens/tree must check `doc.large`. |
| `lucisv_server/src/settings.rs` | editor-settings | folders-and-config, indexing-ux, index-scope, index-persistence, inline-templates, will-save-wait-until, filelist, large-file-mode | One parser for both doors (push and pull, via `from_section` re-wrapping). Every key drops garbage independently; defaults that are not "silence" (1 MiB cap, log on, persist on, 4 MiB large-file threshold) are hand-written in `Default`. `set_client_settings` returns whether a reindex is owed — new keys must decide that question explicitly. |
| `vlog_semantic/src/workspace/` (+ `facts.rs`) | workspace-index; extended by incremental-index, index-persistence, index-scope, hover-line-index, scan-interleave, member semantics, semantic-lints-on, bind-semantics, SVA bodies and refactor-rename performance | server state, hierarchy/lens/type-hierarchy, refactor, completion, semantic lints | Determinism (same inputs → same index, any order), the `paths` spelling coupling with `resolve.rs`, `FACTS_FORMAT` bumped on any codec change (currently 16), edge/posting tables built by the same lifted walks the engines use. `DeclLines` must round-trip and participate in `fingerprint`; `absorb` must equal one build over the resulting record set; `files_spelling` must continue to include unresolved non-empty external/inherited paths or rename loses its dangling-use refusal; `FileFacts::words` is the shared project mention/completion census. |
| `vlog_semantic/src/workspace/` (+ `facts.rs`) | workspace-index; extended by incremental-index, index-persistence, index-scope, hover-line-index, scan-interleave, member semantics, semantic-lints-on, bind-semantics, SVA bodies and refactor-rename performance | server state, hierarchy/lens/type-hierarchy, refactor, completion, semantic lints | Determinism (same inputs → same index, any order), the `paths` spelling coupling with `resolve.rs`, `FACTS_FORMAT` bumped on any codec change (currently 17), edge/posting tables built by the same lifted walks the engines use. `DeclLines` must round-trip and participate in `fingerprint`; `absorb` must equal one build over the resulting record set; `files_spelling` must continue to include unresolved non-empty external/inherited paths or rename loses its dangling-use refusal; `FileFacts::words` is the shared project mention/completion census. |
| `vlog_refactor/src/rename/` | refactor-rename; shared by references-nav and the performance wave | server rename/prepareRename/references and port refactor verification | `Scope` remains the whole-scope authority and `collect_occurrences` the one rename/references walk. The fast `prepare_rename_here` answer/refusal and `rename_name_at` target are parity contracts, not alternate semantics. Any new refusal must be expressible on the fast path or force a deferral; any new occurrence shape must be reflected in the server fan-out or trigger its all-sources fallback. |
| `vlog_parser/src/token.rs` keyword table | completion-core (`KEYWORDS` export) | lexer, pairs.rs, editor grammar (test-locked), completion | Adding a keyword = lexer change + `pairs.rs` re-check + a hand edit to the grammar (`tests/grammar.rs` names the missing word) + potentially `verify.rs`-adjacent behavior. dv-statements added `randcase`/`let` to `is_keyword` and recorded it as shared with the adjacent lexer-cleanup round — the precedent for treating this file as coordinated even between back-to-back rounds. |
| `editors/vscode/package.json` | editor-packaging | editor-settings, editor-scopes (colour ids), editor-snippets, index-persistence, verbose-timing, platform-vsix, marketplace-page | Settings/colour/snippet ids referenced from `extension.js` or the server must move in lockstep; mismatches are *silent* (VS Code ignores unknown ids). `lucisv.verbose` is special: it changes a spawn argument and therefore restarts the server instead of flowing through the ordinary settings push. Version number is one of the four version files. |
@@ -711,7 +767,7 @@ ownership explicitly.
parallelism. Two features in one lane usually share a choke point (§3.3);
check before spawning both.
2. **A grammar feature is a pair by default** (parser + formatter arms +
minimal `bind.rs`/`spans.rs` arms) — unless it reuses an existing arm, as
minimal `bind/`/`tests/spans.rs` arms) — unless it reuses an existing arm, as
the verbatim producers and ansi-first-port did. Say which arms you owe in
the feature scope up front; the compile-fix arms in other crates are
legitimate and should be listed in Handshakes, per the established
+17
View File
@@ -5,6 +5,23 @@ for you. The extension and its bundled language server share one version
number; the full engineering notes live in the
[project changelog](https://git.luci.ooo/lucio/lucisv/src/branch/master/CHANGELOG.md).
## 0.42.0 — 2026-09-05
- **Waiver files.** Point `lucisv.lint.waivers` (or `[lint] waivers` in
`lucisv.toml`) at a Verible-format waiver file and its suppressions
apply in the editor: diagnostics, quick fixes and fix-on-save alike.
- Two vendor shapes that used to be parse errors now format: a module
header written twice across an `ifdef`/`else`, and a net delay after
the type.
## 0.41.0 — 2026-09-04
- **A quieter cursor.** Resting the cursor on an instantiation of a
widely used module no longer stalls the editor: port refactorings are
offered instantly and their edit is computed only when you pick one.
- **Faster go-to-definition** for declarations in files you have not
opened.
## 0.40.0 — 2026-09-04
- **Better recovery while you type.** A stray `begin … end` at module
+12 -1
View File
@@ -30,7 +30,7 @@ Install **lucisv — Verilog/SystemVerilog** from the VS Code Extensions view,
then open a Verilog or SystemVerilog file. There is no separate server or CLI
setup.
The current release is **0.40.0**. Its platform packages include both
The current release is **0.42.0**. Its platform packages include both
`lucisv-server` and the `lucisv` command-line tool:
| Package target | Machines |
@@ -288,6 +288,7 @@ Server-side templates add `if`, `if/else`, `else if`, `case`, `for`, `while`,
| `lucisv.lint.select` | `[]` | Power-user spelling of `lucisv check --select`: run exactly these rules, replacing the default set. A severity word (`error`, `warning`, `style`) stands for its whole class |
| `lucisv.lint.ignore` | `[]` | Power-user spelling of `--ignore`, and the off switch of last resort; takes a severity word too |
| `lucisv.lint.options` | `{}` | Per-rule options, as `{ "<rule>": { "<option>": value } }` — the editor's spelling of a `[lint.<rule>]` table in `lucisv.toml`. Each rule's own dropdown names the options it takes, and `lucisv check --rules-doc` prints every one with its kind and default. A bad entry is ignored and reported in the lucisv output channel, so one typo cannot switch the linter off |
| `lucisv.lint.waivers` | `[]` | External waiver files, absolute or relative to the first workspace folder — the editor's spelling of `lucisv check --waiver-file` and of `waivers` under `[lint]` in `lucisv.toml`, and added to whatever that table names. Verible's format: one `waive --rule=<rule> [--line=N|--line=N-M] [--location=<pattern>]` per line. A missing file or an unparsable directive is dropped and reported in the lucisv output channel. Unused external waivers are reported by `lucisv check` only |
| `lucisv.formatOnSave` | `false` | Protocol save hook for editors without native format-on-save; keep off in VS Code. Its indent comes from `lucisv.toml` or `lucisv.indent`, never from the editor tab size, which the protocol does not send on this path |
| `lucisv.serverPath` | bundled | Explicit server override for advanced use; an unchanged setting uses the bundled server |
| `lucisv.verbose` | `false` | Print how long every operation took in the lucisv output channel — one `timing:` line per request, notification, scan, widen, buffer flush, and per request that had to wait behind a rescan. **Restarts the language server when changed**, because it is an argument the server is started with |
@@ -364,6 +365,16 @@ Every nesting color is a proper VS Code theme color:
}
```
## Release 0.42.0 highlights
Version 0.42.0 adds external waiver files (Verible's format) and formats
two vendor shapes the opentitan sweep used to skip.
## Release 0.41.0 highlights
Version 0.41.0 takes the code-action request off the module fan-out and
answers go-to-definition from the index.
## Release 0.40.0 highlights
Version 0.40.0 recovers a stray `begin` block and a half-typed `#(`
+10 -1
View File
@@ -2,7 +2,7 @@
"name": "lucisv",
"displayName": "lucisv — Verilog/SystemVerilog",
"description": "Fast Verilog/SystemVerilog formatting, linting, navigation, refactoring, semantic highlighting and RTL design intelligence.",
"version": "0.40.0",
"version": "0.42.0",
"publisher": "guoliangchen",
"author": "Guoliang Chen",
"license": "MIT",
@@ -356,6 +356,15 @@
"additionalProperties": true,
"markdownDescription": "Per-rule lint options, as `{ \"<rule-name>\": { \"<option>\": value } }` — the editor's spelling of a `[lint.<rule-name>]` table in `lucisv.toml`. Example: `{ \"line-length\": { \"length\": 120 }, \"generate-label-prefix\": { \"prefix\": [\"g_\", \"gen_\"] } }`. Each rule's own toggle below names the options it takes, and `lucisv check --rules-doc` prints every option with its kind and default. An entry naming a rule or an option that does not exist — or carrying a value of the wrong kind, an integer out of range or a pattern that does not compile — is ignored and reported in the lucisv log, so one typo cannot switch the linter off. A rule option set here beats the same option in a `lucisv.toml`, key by key. Takes effect immediately — every open file is re-checked."
},
"lucisv.lint.waivers": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"order": 14,
"markdownDescription": "External waiver files to apply, absolute or relative to the first workspace folder — the editor's spelling of `lucisv check --waiver-file` and of `waivers` under `[lint]` in `lucisv.toml`. They **add** to whatever that table names; a finding an external waiver or an inline `// lucisv: waive` comment covers is suppressed. The format is Verible's: one `waive --rule=<rule> [--line=<n>|--line=<n>-<m>] [--location=<pattern>]` per line, `#` comments and blank lines ignored. Unlike Verible's, `--location` is not a regular expression — it is matched the way `#lucisv.exclude#` patterns are. A file that is missing, or a directive that does not parse, is dropped and reported in the lucisv log, so one typo cannot switch the linter off. The editor never reports an *unused* external waiver: only a whole `lucisv check` run over the project can tell that a waiver matched nothing. Takes effect immediately — every open file is re-checked."
},
"lucisv.lint.severity.error": {
"type": "boolean",
"default": true,