84 KiB
TODO — best practices adopted from ruff and Verible
Curated backlog for lucisv, drawn from astral-sh/ruff (architecture, CLI/UX,
fix model) and chipsalliance/verible (formatter safety, alignment,
waivers, and especially test methodology). Items reference the current
draft's files. Roughly ordered by priority within each section.
Legend: [V] = practice from Verible, [R] = from ruff, [V+R] = both.
1. Correctness safety net (highest priority)
-
[V] Token-stream equivalence verification. Verible's formatter re-lexes its output and asserts it is lexically equivalent to the input (
verilog_equivalence.cc); on mismatch it emits the original text. Addverify_equivalence(input, output)tovlog_formatter: re-lex both throughvlog_parser::lexer, compare token kinds + text (whitespace excluded, comments included). Run it insideformat_source()on every call — not just in tests. This turns "the formatter can never corrupt code" from a test-suite property into a runtime guarantee. -
[V] Convergence (idempotency) verification at runtime. Verible formats twice and checks a fixed point before writing. Do the same in
format_source()(optionally behind--no-verifyfor speed later). Today idempotency is only asserted intests/fixtures.rs. -
[V] Failsafe fallback semantics. On any internal verification failure, return the input unchanged with a diagnostic and nonzero exit, never partially formatted output. Parse errors already behave this way (README notes it); extend the same contract to the two checks above.
-
[R] Panic containment. ruff catches panics per-file and reports them as errors instead of killing the whole run. Wrap per-file work in
crates/lucisv/src/main.rswithstd::panic::catch_unwind. -
@(* )fails to lex (bug-fix QA find):(*followed by anything but)is unconditionally lexed as an attribute (lexer.rs), so a bare space inside@( * )-style spellings errors out. Make the attribute scan back off when the contents are just*. →docs/features/lexer-cleanup/README.md, with the BOM and non-ASCII message fixes and thelucisv checklex-error silence fix. -
Recursion-depth limit in the parser. Found by cli-polish QA: ~150 levels of expression nesting overflow the stack and abort the whole process — uncatchable by
catch_unwind, so mid-batch files after the crash never get processed. Add an explicit depth counter invlog_parser::parserthat 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, pre-existing):
process_fileand the--fixpath write with plainfs::write(open/truncate/write) whilecache.rsnext 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.
2. Formatter features
- [V] Format-off fences. Support
// verilog_format: off/// verilog_format: on(accept alucisv: off/onalias). Verible implements this as "emit the original byte range verbatim" — the trivia inMetaalready carries comments, so detect fences during formatting informat.rsand splice source text by span. Requires nodes to carry byte spans (see §5, it's needed for LSP anyway). →crates/vlog_formatter/src/fence.rs; grammar, item-level semantics and join rules indocs/features/format-fences/README.md. Item scopes only — statement-level fences are documented as not implemented. - [V] Range formatting:
--lines M-N[,M-N...]. Format only constructs intersecting the given line ranges; emit everything else verbatim. This is what makes adoption in dirty legacy codebases possible (Verible shipsgit-verible-verilog-format.shon top of it). Follow-up: alucisv --diff-base <rev>or contrib script that derives ranges fromgit diff. →crates/vlog_formatter/src/range.rs(format_range,LineRanges), the CLI's--lines, the server'sdocumentRangeFormattingProvider, andtools/lucisv-changed.shfor thegit diffhalf of the follow-up (a--diff-baseflag inside lucisv is still open). The unit is one item; modules and packages are descended into so a three-line edit does not reflow a two-thousand-line body; statements and generate regions are deliberately atomic. Fences outrank ranges, the cache is bypassed, and the runtime safety net runs over the whole output — the convergence half by replaying the per-item decisions, since line numbers move when text does. 578 corpus files × 8236 range trials: 0 refusals, and whole-file output is byte-identical to before. Semantics, interaction rules and the honest limits indocs/features/range-formatting/README.md. - [V] Alignment inference for declaration/port/connection groups.
Verible's most-loved feature: infer align-vs-flush-left intent from the
original spacing (≥4 excess spaces = author wants alignment), and break
alignment groups at blank lines and standalone comments
(
--alignment_group_boundary). Start with the three constructs where RTL culture demands it: port declarations, named connections (.clk (clk)), and localparam/parameter lists. This needs original-spacing info preserved through the lexer — record "excess spaces before token" as trivia. →crates/vlog_formatter/src/align.rs; all three constructs ship (ports align the name column, connections the(, parameters the name and=columns). No lexer trivia was needed after all:name_spanplus the source text the formatter already holds gives both the preceding gap and the token's column, so the spans suite is untouched. Zero churn on the 397-case table; 291 of 578 formattable corpus files now format differently, with 0 verification errors and 0 round-trip failures over 2312 config-sweep runs. Rule, fixed-point argument and the parked columns (#( ... )parameter ports, the type column, the trailing-comment column) indocs/features/alignment/README.md. - Comment inside port/param lists and assignment patterns is
dropped → refused (found at scale by format-fences QA: 112 of 1868
corpus injection trials refuse with exit 2). The failsafe holds, but
this is the largest remaining comment-attachment gap; fix alongside the
three documented expression refusals (replication, compact bracket,
assign-value) from docs/features/formatter-bug-fixes and corpus-bugs.
→
Meta::before_sepkeeps a comment on its element's side of the separator, at every list kind; replication, gate arguments, header imports, event lists, a connection's own parens and the enum dangling bucket all gained comment slots too. Injection-harness refusal rate 2.3% → 0.4%. Still refused (documented, not hacked around):[a : b]-style bracket interiors and a comment before a procedural statement's;— seedocs/features/comments-round/README.md. → Round 2 closed the two shapes a plain line-insertion sweep still hit (14 of 989 trials): a comment before a module/instantiation head's#(or((four newVec<Comment>fields), and a comment written next to an(* attribute *), whichFmt::leadingnow interleaves by span instead of printing all comments then all attributes. Sweep 14 → 0; the exhaustive per-line sweep's survivors are the shapes parked above plus a comment beforeelse— seedocs/features/comments-round-2/README.md. → QA round-1 follow-up closed three more shapes with no node of their own: betweenbindand its target (and before the bound module name), before a call's(/ inside an empty(), and on either side of a postfixwith. Still parked: a comment before a procedural statement's;, and one inside abind's: instance, list. - Two leading comments separated by one blank line come out
separated by two (format-fences QA find, pre-existing):
leadingpushes a HardLine after each comment and a BlankLine before the next. Fix churns snapshots; take it with the comments round above. →Fmt::leading_commentsemits the break before each comment instead of after; 6 corpus files became fixed points, zero test churn. - [R]
--diffmode. Likeruff format --diff/ Verible's autofixpatchmode: print a unified diff instead of rewriting, for CI logs and code review. - [R]
--stdin-filename <path>. Editors pipe buffer contents via stdin; the filename is needed for good error messages and (later) per-directory config resolution.
3. CLI / UX (mostly ruff)
- [R] Config file discovery. Search upward from each input file for
lucisv.toml/.lucisv.toml(analog ofruff.toml/pyproject.toml). Keys:line-length,indent,excludeglobs. CLI flags override file config. Keep Verible's philosophy of few knobs — don't grow a clang-format-sized option surface. →crates/lucisv_core/src/config.rs(lifted from crates/lucisv by lucisv-core-lift); discovery rule, TOML subset and precedence indocs/features/config-discovery/README.md. - [R] Parallel file processing. ruff's speed story is embarrassing
parallelism over files.
main.rsformats serially; userayonpar_iter over the collected file list (formatting is already pure). →crates/lucisv/src/main.rs; pool sizing (vlog_parser::PARSE_STACK_SIZEworker stacks, per the recursion-limit handshake), the reworked panic hook and the ordered-reporting determinism argument indocs/features/parallel-files/README.md.--threads Npins the worker count; output is byte-identical at any count. 3.6× on 10 cores. - [R] Content-hash cache. Skip files whose (content hash, config
hash, lucisv version) triple is unchanged, stored in
.lucisv_cache/. Do this after parallelism; it matters for big monorepo RTL trees. →crates/lucisv_core/src/cache.rs(--no-cache,--cache-dir); the key stores the resolvedline-length/indentvalues, and only the "already formatted" verdict is ever cached — a would-reformat or an error is re-checked every run, so--check/--diffcannot go stale. Hand-rolled FNV-1a and a hand-rolled tab-separated store (no new dependency); corrupt or another version's entries are ignored, never fatal. Warm--checkover the pre-formatted corpus: 7.7× on one thread, 2.3× at the default thread count. Collision posture, the semantics table and the cwd-relative-default limitation indocs/features/format-cache/README.md. - [R] Respect
.gitignoreand add--excludeglobs when walking directories (collect_filesinmain.rscurrently walks everything, including e.g. generated netlists). →--excludeshipped with cli-polish;.gitignoreis hand-rolled incrates/lucisv_core/src/walk.rs(anchoring, directory-only,!negation, nested files override) with a--no-gitignoreescape hatch. The supported subset and everything git does that this does not are listed indocs/features/parallel-files/README.md. - [V+R] Exit-code contract doc. Already ruff-like (0 clean / 1 would-reformat / 2 error) — document it in README and freeze it; CI scripts will depend on it.
4. Linter (lucisv check) — new crate vlog_linter
Design it ruff-style from day one (shared parse, fix model), with Verible's rule ergonomics (waivers, configurable rules).
- [R] One parse, two tools.
lucisv checkandlucisv formatmust sharevlog_parseroutput in a single invocation (lucisv check --fix --formatstyle workflows come free later).Not done:→ Delivered on the linter side (lucisv checkre-parses today (tolerantly, which the formatter does not), and nothing invlog_linter's API prevents sharing a tree later — onlyLintContextwould change.docs/features/one-parse/README.md):LintContext::from_parseaccepts pre-built products,ParsedSourceis the owned bundle,lucisv checkparses once per file (one lex instead of two — corpus check 266 → 208 ms single-threaded), andlucisv_serverlints from theDocumentit already analyzed (didChange→publish 18 → 11 ms on picorv32.v). Byte-identical output proven against a HEAD-worktree binary. The formatter half stands unchanged by design:lucisv formatneeds the strict parse its safety net is defined over, so a combinedcheck --fix --formatworkflow remains a future feature — but nothing in the API blocks it anymore. - [V+R] Rule trait + registry. Each rule: stable kebab-case name,
one-line summary, longer doc with style-guide rationale (Verible links
each rule to a style-guide section — do the same), and a
check(node/token) -> Vec<Diagnostic>over syntax tree or token stream. →crates/vlog_linter:Rule(name/summary/doc/check over aLintContextcarrying tokens, the tolerant AST, the source and aLineIndex),all_rules/default_rules/rule_by_name/select_rules. Rules, waiver grammar and the corpus baseline indocs/features/linter-core/README.md. - [V] Diagnostic format
FILE:LINE:COL: message [rule-name]plus [R]--output-format jsonfor tooling from the start. →lucisv check; text sorted by file then position, JSON one array on stdout (hand-rolled, no new dependency) with location, end_location, range and fix. - [R] Fix applicability model. ruff distinguishes safe vs
unsafe fixes (
--fixvs--unsafe-fixes). Adopt it now — retrofitting safety classification is painful. →Fix { edits, applicability: Safe | Unsafe }and--fix/--unsafe-fixes. Onlyno-tabsandno-trailing-whitespaceship fixes (both Safe); the unsafe path is plumbed and tested but no rule uses it yet. - [V] Waiver mechanisms: inline
// lucisv: waive rule-name(acceptverilog_lint: waivefor migration),waive-start/waive-stopranges, 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.- inline
waive,waive-start/waive-stop, both spellings, and theunused-waiverpseudo-rule (unused, unknown rule, malformed, unmatchedwaive-stop). Averilog_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.
- inline
- [V] Configurable naming rules via regex (module/instance/
parameter/enum naming), with named presets like Verible's
(snake_case, ALL_CAPS, etc.).
→ Named presets ship, without a regex dependency:
parameter-name-style,enum-name-style,struct-union-name-style(Verible-default-on, Verible's own names and patterns) andmodule-name-style(default-off — Verible has no such rule to inherit a default from). Presets are character-class predicates incrates/vlog_linter/src/naming.rs; the justification, the parked rules and the corpus baseline are indocs/features/lint-rules-2/README.md. Not done: making the style configurable per rule — that needs thelintkey inlucisv.toml, still open below. - [V]
--generate_markdown-style self-documentation — generate the rule reference from the registry so docs can't drift. ruff does the same for its 900+ rules. →vlog_linter::rules_markdown() -> Stringrenders the whole registry (name, default on/off, fix applicability, summary, doc), with a golden shape test and an "every registered rule appears" test. Renderable today viacargo run -p vlog_linter --example rules_markdown; alucisv check --rules-docflag is filed as a handshake forcrates/lucisv. - 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.no-tabs,no-trailing-whitespace,explicit-parameter-storage-type,case-missing-default,always-ff-non-blocking,always-comb-blocking,module-filename— corpus baseline per rule indocs/features/linter-core/README.md.wire/regmixups in SV files —wire-reg-mixup, default on. The SystemVerilog-ness decision is the file extension (.sv/.svh), so a stdin buffer without--stdin-filenameis silent. It flags theregkeyword only;wireis legitimate SystemVerilog and is not flagged. Note for the record: unlike the other seed rules this one is not from Verible's default set — Verible has no wire/reg rule at all; the rationale is IEEE 1800 (logicandregare one type) and the lowRISC style guide. Seedocs/features/lint-rules-2/README.md.
5. Testing — adapt Verible's methodology
Verible's formatter confidence comes from a few complementary layers
(formatter_test.cc, component tests, equivalence/convergence checks).
Adapt each:
- [V] Massive text-in/text-out table tests. Verible's
formatter_test.ccis thousands of small{input, expected}pairs — the backbone of the formatter.small_casesincrates/vlog_formatter/tests/fixtures.rsis the seed; grow it into a dedicatedtests/cases/organized by construct (one file per area: ports, expressions, case-statements, generate, comments, macros...). Port cases directly fromformatter_test.ccwhere 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
snapshots — once §1's
verify_equivalenceexists, 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
separately (
token-annotator_test.cc,tree-unwrapper_test.cc). Ours: unit tests forlexer.rstrivia attachment (comment → leading/trailing decisions, blank-line counting),parser.rsper-construct parse tests, andprinter.rsgroup-breaking behavior on synthetic docs. - [V] Lint test harness with inline violation markers. Port the
LintTestCase/RunLintTestCasesidea: test cases embed expected findings positionally in the source (Verible splicesExpectedTokenInfofragments inline). A Rust adaptation: annotate with a marker comment or a^^^caret line, e.g.assert_lint::<NoTabsRule>("module m;\n\twire x;\n ^ no-tabs\nendmodule"). Exact-match: unexpected findings fail the test too. → File-driven:crates/vlog_linter/tests/cases/*.lint(76 cases, all 13 rules with violating/clean/waived/unused-waiver coverage) run bytests/lint_cases.rs—//^ <col> <rule>markers carry the exactline:colthe CLI prints, matched exactly in both directions, with stale-marker detection (a marker naming a dead rule fails the suite) and 12 self-policing tests pinning the failure reports. Format spec and migration stats indocs/features/lint-harness/README.md. - [V]
RunApplyFixCasesequivalent: every autofix rule gets(input, fixed_output)pairs, and the fixed output must itself be lint-clean and formatter-idempotent. → A----section in a.lintcase: the CLI's fix→re-lint loop must land exactly on the expected text, leave nothing Safe-fixable, and the fixed output must be accepted and converged byvlog_formatter::format_source(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 with the expected error position — locks in the failsafe path.
- [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,
PULP cores, picorv32. Script: clone pinned revs, run lucisv over every
.sv/.v, report parse-success rate + equivalence/convergence failures; fail CI on regression. Also the honest tracker for the "not yet supported" list in README. →tools/corpus_fetch.sh+tools/corpus_check.sh, baseline and findings indocs/features/corpus-check/README.md. CI wiring is the one part left open (network access is a separate decision). → Latest movement: classes/constraints (docs/features/classes/README.md) took the corpus from 476/820 formattable (58.0%) to 578/820 (70.5%) — 102 files gained, 0 lost, 0 verification errors, 0 crashes, checked by diffing the two TSVs by path. 72 of the 142extends-blocked files now format; the other 70 advanced to a second blocker, and the new top blocker is dynamic arrays and queues (README roadmap item 4, 41 files). → Dynamic types (docs/features/dynamic-types/README.md) then took it from 578/820 to 636/820 (77.6%) — 58 files gained, 0 lost, 0 verification errors, 0 crashes, all 636 round-tripped individually. Queues/dynamic arrays, named call arguments andcase ... insideare done; the new top blocker isinterfacedeclarations (25 files, README roadmap item 8), then`elseinside an element (13, the documented directives-in-lists non-goal) and`uvm_field_int(11, the documented macro-items lexer gap). → item-misc (docs/features/item-misc/README.md) then took it from 636/820 to 661/820 (80.6%) — 25 files gained, 0 lost, passing set verified as a strict superset. The`uvm_field_intgap is closed (in the parser, at item position only — the lexer glue stays parked for the reasondocs/features/lexer-cleanup/README.mdgives), along with a bare macro item followed by a declaration on the next line,`error/`warningdirectives and elaboration system tasks ($error/$fatal/$warning/$info) at item position.interface(31 files) andbind(28) are now the top two blockers. → bind (docs/features/bind/README.md) then took it from 671/820 (81.8%, the baseline after round 21) to 699/820 (85.2%) — all 28bindfiles gained, 0 lost, passing set verified as a strict superset.interface(31 files) is now the top blocker. → interfaces (docs/features/interfaces/README.md) then took it from 712/820 (86.8%, the baseline after round 21) to 740/820 (90.2%) — 28 of the 31interfacefiles gained, 0 lost, passing set verified as a strict superset and all 28 round-tripped individually.interface/modport/clockingandvirtualinterface types in every type position are done; the 3 files left advanced to blockers in theexpressionsandotherbuckets.dv-statements(26 files) is now the top blocker. → expressions-2 (docs/features/expressions-2/README.md) then took it from 751/820 (91.6%, the baseline after round 21) to 772/820 (94.1%) — 20 of the 21expressionsfiles plus thedv_utils_pkg.svotherfile gained, 0 lost, passing set verified as a strict superset. Casts over any constant primary, streaming concatenations,->/<->implication, drive strengths on continuous assigns, attributes on named port connections, the'{N{0}}pattern replication,insidea macro andconst refarguments are done; the one file left (compare_helper.sv) advanced to a macro-items blocker (`MACRO exprin expression position).dv-statements(26 files) is still the top blocker. → dv-statements (docs/features/dv-statements/README.md) then took it from 772/820 (94.1%, the baseline on the same tree) to 796/820 (97.1%) — 24 of the 26dv-statementsfiles gained, 0 lost, passing set verified as a strict superset.randomize() with { ... }, array-methodwith (expr), package-scoped and hierarchicalforeach,randcase,wait fork, block-levelimport,let, omitted call arguments, statement labels and a stray;after a task/function footer are done, along with a comment written beforeelse(which had been crossing the keyword and failing verification). The 2 files left advanced to blockers other clusters own:dv_base_vseq.svto macro-items (a bare macro followed by@on the next line),riscv_instr.svto thenew objshallow-copy expression.directive-split(14 files) is now the top blocker. → mop-up-2 (docs/features/mop-up-2/README.md) then took it from 796/820 (97.1%, the baseline on the same tree) to 800/820 (97.6%) — 4 files gained, 0 lost, passing set verified as a strict superset. A macro statement that ends its line followed by a symbol on the next one, thenew objshallow copy (IEEE 1800 §8.12), and a based number whose digits are a macro (32'h`DM_ADDR) are done; thelex-macro-numberbucket is gone.compare_helper.svstays failing and is not fixable:`X_EACH_CSR 1needs the macro's body, which 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-fuzztargets: (a) parser must never panic on arbitrary bytes, (b) for inputs that parse, format must satisfy equivalence + convergence. - [R] Consider
instafor the snapshot harness (review workflowcargo insta reviewbeatsUPDATE_SNAPSHOTS=1), keeping the idempotency loop fromfixtures.rs.
6. LSP: full editor support (a first-class goal, not a maybe)
Goal (owner's requirement, 2026-08-19): lucisv becomes a language server for VS Code and Vim/Neovim with feature parity, for Verilog/ SystemVerilog, with what the Python VS Code stack (ruff + Pylance) offers over LSP — scoped to synthesizable Verilog first:
- semantic syntax highlighting (
semanticTokens) - formatting (document + range) and lint diagnostics as you type
- go-to-definition and find-all-references
- hover: declaration/type info, and
`defineexpansion on hover (hover a macro usage → see its value/body) - document + workspace symbols; later: completion, rename, signature help for module instantiation
- cross-file resolution through header imports:
import pkg::*;/import pkg::name;at the top of a file or in a module header must resolve into the package's file anywhere in the workspace (workspace index of modules/packages;`includepaths resolved too)
One server binary serves both editors (VS Code via a thin extension, Vim/Neovim via built-in LSP config); no editor-specific logic below the protocol layer. Foundation decisions that are cheap now and expensive later:
- Byte spans on every token and AST node. Prerequisite for
everything in this section (and for §2 fences/range formatting).
token.rs/ast.rsshould carryTextRange { start, end }offsets; add a line-index utility (ruff'sruff_source_file) for offset↔line:col. →docs/features/spans/README.md.vlog_parser::span::TextRangeon every token, comment and node;vlog_parser::line_index::LineIndexfor offset↔line:col; token-level losslessness is a test (crates/vlog_parser/tests/spans.rs). - Error-tolerant parsing mode. A formatter may refuse broken input;
an LSP cannot — code is mid-edit most of the time. Add recovery in
parser.rs: on statement-level error, record a diagnostic, skip to a sync token (;,end,endmodule), continue. Formatter keeps requiring zero errors; the LSP consumes the partial tree. →vlog_parser::parse_source_tolerant(src) -> (SourceFile, Vec<ParseDiagnostic>); unparsable ranges becomeItemKind::Error/StmtKind::Errorleaves. Sync tokens, the four guarantees and the deliberate gaps (no tolerant lexer, no recovery inside headers or lists) indocs/features/error-recovery/README.md.parse_sourceunchanged. - Keep the CST lossless. Current design (trivia in
Meta) is format-oriented; verify every source byte is reachable from the tree (tokens + trivia + spans). Areconstruct(tree) == inputround-trip test makes losslessness a tested invariant — this is what makes the same tree serve formatter, linter, and highlighter. If gaps appear, consider a rowan-style green tree (rust-analyzer / ruff direction) rather than patchingMeta. - New crate
vlog_semantic(analog ofruff_python_semantic): symbol tables per scope (module/package/function/block/generate), binding → references. Serves go-to-definition/hover first, then semantic lint rules (unused-signal, undriven-net) which are the lint rules people actually want and Verible can't do (it's syntax-only — this is the differentiation opportunity). →vlog_semantic::analyze(&SourceFile, src) -> Semantics, never failing, withsymbol_at/definition_of/references_of/document_symbols. Two-pass bind-then-resolve (so forward references work), imports of in-file packages resolved and all others kept asResolution::ExternalCandidatefor the workspace index below. Rules, simplifications and the corpus baseline (79.5% of uses resolved in-file on cleanly-parsed corpus files, 19.6% external, 0.9% unresolved) indocs/features/vlog-semantic/README.md. → The crate's biggest named gap — "no name declared inside a class body is indexed, hovered or navigable" (the classes round's handshake) — has since closed:docs/features/class-semantics/README.mdbinds classes (SymbolKind::Class,ScopeKind::Class, members,extends,this/super, out-of-body methods, the honestResolution::InheritedCandidatefor what only a base class could supply), indexes classes and their members in the workspace layer, and grows the corpus tables by +4 232 symbols / +16 631 references (clean files: 74.0 % in-file, 17.9 % external, 7.1 % inherited, 1.0 % unresolved, 0 unplaced). `definetable for hover expansion. Record every`define(name, params, body text, source span) during lexing instead of treating it as fully opaque — no expansion during formatting (that non-goal stands), but the table feeds hover (`WIDTH→ "defined as 8 in defs.svh:12") and later single-step macro expansion display. Cheap to collect now that directives carryRawText. →vlog_parser::defines::collect_defines(&tokens) -> DefineTable, a post-lex pass with zero lexer changes.Define { kind, name, params, body, span, name_span }; every definition of a name is kept (all/latest) and`undefis recorded as an event. Body normalization (backslash-newline removed, nothing else touched) and the gaps — no`ifdefevaluation, no cross-file`include— indocs/features/define-table/README.md. Hover itself waits onlucisv_server; this is only the table.- Workspace index for cross-file navigation. Map module/package/
typedef names → (file, span) across all workspace files, so header
imports (
import pkg::*;) and instantiations resolve to definitions in other files. Start as a full-scan-on-startup index (Verilog codebases are small);incrementality comes with salsa later— one file at a time since 2026-08-27, without salsa (docs/features/incremental-index/README.md); andre-scanned from zero on every startup— what a scan learns persists since 2026-08-27, so a reopened workspace indexes from records rather than parses and an interrupted scan resumes (docs/features/index-persistence/README.md). →vlog_semantic::WorkspaceIndex::build(files)+resolve_external(&Semantics, &WorkspaceIndex) -> ExternalResolutions, a two-layer design: the index is a full scan (860 corpus files in 0.7 s), the answers arrive as an overlay keyed byReferenceIdandSemanticsis never mutated. Package/module members and per-file`definetables are indexed too, soimport p::*,p::xand.port(...)all reach into the other file. On cleanly-parsed corpus files the workspace answers 87 % of the external candidates, taking the unresolved- external rate from 19.6 % to 2.6 % of all references. Duplicate-name policy,`definelookup (no include graph → no resolution order) and the honest gaps indocs/features/workspace-index/README.md. → The index's biggest named gap has since closed: accepting`ifdefinside a port/parameter/enum list (README roadmap item 6,docs/features/directives-in-lists/README.md) meanspicorv32,picorv32_axiandpicorv32_wbindex at all — 521 → 530 modules, 8044 → 9174 exported members, external candidates answered 87.0 % → 93.6 % on cleanly-parsed files (unresolved-external rate 2.6 % → 1.3 % of all references). The instantiation half followed indocs/features/directives-in-instances/README.md(directives in an instantiation's#( ... )overrides and an instance's( ... )connections); after it no corpus file is blocked on a compiler directive at all, so nothing is left unindexed for this reason. The index counts above did not move (530 modules, 9174 exported members, 502 defines — the six files it unblocked have headers that already parsed, so their modules were already indexed); what moved is 6 more files that now format, and with them external candidates answered 93.6 % → 94.0 % on cleanly-parsed files (unresolved-external rate 1.3 % → 1.2 %). - New crate
lucisv_server(analog ofruff_server): LSP over stdio viatower-lsporlsp-server. Order of capabilities:textDocument/formatting+rangeFormatting(reuses §2--lines),- publish parse/lint diagnostics,
semanticTokensfor highlighting (needs only the lexer + spans),hover(decl info + define table) /definition/references(needsvlog_semantic+ workspace index),- document/workspace symbols; then completion, rename, signature
help for instantiations.
→
crates/lucisv_server, binarylucisv-server, onlsp-server+lsp-types(synchronous, no async runtime). Shipped:textDocument/formatting,textDocument/rangeFormatting(round 18, on §2's--lines), parse diagnostics on didOpen/didChange/didSave,semanticTokens/full,hover(in-file and workspace`defineexpansion, declaration snippets),definition(both resolution layers, all locations when ambiguous),references(in-file),documentSymbolandworkspace/symbol. Not shipped, deliberately:delivered, lint diagnostics (waits onrangeFormatting(waits on §2--lines)vlog_linter) delivered, cross-file references, completion/rename/signature help. Byte↔UTF-16 position conversion, the state/staleness model and the dependency audit are indocs/features/lucisv-server/README.md.
- Editor packaging. A minimal VS Code extension (launch the
server, register file types) and a documented Vim/Neovim
lspconfigsnippet. No editor-specific features beyond launching. →editors/vscode/(41-line plain-JSextension.json the officialvscode-languageclient, pinned9.0.1; one setting,lucisv.serverPath;.v/.vh→verilog,.sv/.svh→systemverilog; no grammar — semantic tokens come from the server; no commands, no status bar) andeditors/nvim/README.md(vim.lsp.configfor Neovim 0.11+, plusnvim-lspconfig, Vim 9vim-lspand coc.nvim).editors/vscode/smoke.jsis the pre-publish check: zero-dependency node, spawns the server with the extension's exact contract and drivesinitialize/didOpen/shutdown/exitover hand-rolled framing. Manual install steps only — CI packaging and Marketplace publishing are out of scope, andpublisheris a placeholder.docs/features/editor-packaging/README.md. - Salsa-style incrementality — defer. ruff's
ruff_dbuses 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 (docs/features/incremental-index/README.md):WorkspaceIndex::update_filereplaces one file's contribution and provably gives the index a whole build would have, so a save costs 33 ms instead of 1.5 s over the corpus. No query graph and no dependency tracking — the salsa question is still open, and is still deferred. A second piece answered without salsa, 2026-08-27 (docs/features/index-persistence/README.md): every file'sFileFactsare written to a content-keyed store as a scan parses them, so the recompute a new session would otherwise repeat is skipped instead — 1.8x on a whole corpus rescan, and a scan interrupted halfway resumes where it stopped. A third piece answered without salsa, 2026-08-28 (docs/features/change-debounce/README.md): the per-keystroke recompute a query graph would have made unnecessary is instead not started — a burst ofdidChanges is coalesced into one reanalysis. Still no query graph and no dependency tracking; the salsa question remains open and deferred. Measured costs for what a recompute actually is are now recorded indocs/perf/README.md. Round 2, 2026-08-28 (docs/features/interactive-latency/README.md): that recompute is now broken down stage by stage, and 79 % of it is lexing and parsing. If the salsa question is ever reopened, that is the number it has to beat — incremental lexing and parsing, not incremental queries over a whole-file parse, and it lands squarely onCLAUDE.md's hard invariants 1 and 2. A fourth piece answered without salsa, 2026-08-28 (docs/features/hover-line-index/README.md): a derived fact a query used to recompute — the line a declaration is written on, which cost a whole file read and a wholeLineIndexper request — is now computed once when the file is indexed and stored beside the span (Def::lines,FACTS_FORMAT3 → 4), and the one thing still needing that file's text is served from a small bounded cache of closed files. A repeat hover into a 12 MB closed file goes 5.75 ms → 0.95 µs; a whole scan is unchanged and the store grows 2.9 %. Still no query graph: what is cached is a value, invalidated at four named points, not a node in a dependency graph. The larger number the same round measured is not an incrementality problem at all: the first request of a session waits out the startup scan (780 ms cold, 287 ms warm), becauseServer::newscans before the message loop starts. Filed there, not fixed. → Fixed 2026-08-28 (docs/features/scan-interleave/README.md): the scan is now per-file steps with the message queue drained between them, so a startup scan of more than 64 files answers requests while it runs — 780 ms → 15.5 ms cold, 287 ms → 12.8 ms warm, with the scan's own total moving under a percent (860-file corpus: 351 → 353 ms cold, 187 → 189 ms warm). The merge cost was measured first and ruled per-file feeding out: a merge is a pass over the whole index, so one per file would have cost 631 ms of merging on 200 files against 464 ms of parsing. Records are staged per file and folded in with oneWorkspaceIndex::absorbper drain, and a drain only happens when a message is waiting — so a scan nobody is waiting on pays nothing. 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. - 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+SHA256SUMSinto a gitignoreddist/) andtools/RELEASING.md.docs/features/release-prep/README.md. Publishing (owner actions): fully optional and deferred per the owner (2026-08-19) — sideloading the.vsixis the supported path. If it is ever revisited, only the owner can do it: create a Marketplace publisher id and replaceREPLACE-ME(done 2026-08-25: publisherguoliangchen, author Guoliang Chen), hold thevsce/ovsxtokens, supply an extension icon, and confirm the public repo URL. Commands are intools/RELEASING.md's appendix.
7. Deliberate non-goals (also a best practice)
- No preprocessor expansion in the formatter: like Verible, format unpreprocessed source and never expand macros into the output. (The LSP's define table in §6 records definitions for hover display — that is bookkeeping, not expansion, and doesn't weaken this rule.)
- No option explosion: Black/ruff's lesson — every knob halves the value of a canonical style. Alignment inference (§2) is the culturally necessary exception.
- No semantic claims in v1 lint rules: syntax-only rules first (Verible's
scope), semantic rules only after
vlog_semanticexists.
8. Refactoring — the rope port (owner request, 2026-08-24)
Port the ideas of python-rope/rope to Verilog/SV, server-first. The full
rope→Verilog mapping, feature checklist and milestone specs live in
docs/features/refactor/README.md — that file is the source of truth; this
section only tracks the milestones.
- M1
filelist— EDA.ffilelist defines the index scope (-fnesting,+incdir+/+define+recorded, env vars); fallback:workspace walk, then current file's directory when rootlessthe open files' own folders since 2026-08-27 (index-scope), with the workspace walk behindlucisv.index.scope: "workspace"; the filelist still outranks both. Seedocs/features/index-scope/README.md. Since 2026-08-28 a rescan no longer re-parses the buffers it already analyzed — an open buffer's index facts and completion words come from the analysis it holds — so a scope-wideningdidOpenwith a 1.4 MB buffer open costs ~23 ms rather than ~228 ms. And since 2026-08-28 a widen indexes only the folders it added rather than rescanning every folder reached so far, so the wait a jump puts in front of the next request stops growing with the session: over opentitan's 3 979 files, 120/132/137/169 ms per jump became 22/18/12/44 ms. - M2
refactor-rename— new cratevlog_refactor; LSPprepareRename/renamefor every symbol kindvlog_semanticresolves, cross-file, whole-edit-or-nothing verified by re-parse. - M3
refactor-ports— add/remove/propagate module ports across the declaration and every instantiation (named/ordered/.*). Amended 2026-08-28 (docs/features/refactor-ports/README.md): atextDocument/codeActionno longer reads the in-scope file set from disk per cursor move. The engine is handed the cursor's module's own fan-out through the index — definers, instantiation edges, reference postings, open buffers — by one builder both the code action and the three commands use, and the answer is asserted equal to the whole-workspace one. Over opentitan a code action went 4.56 s → 7.1 ms (2.93 s → 83 ms for a module instantiated in 36 files); it was the request every queued definition and hover had been waiting behind. - M4
refactor-instantiate— module hinting: instantiation skeleton completion from the definition, auto-connect, signature help. - M5
completion-core— keyword + project-wide identifier completion (token-harvested, comments/strings excluded), merged with M4's module snippets; version 0.3.0. - M6
completion-templates— context-gated statement/item snippet completion from the server (if/else, case, always, loops, declarations), reconciled with the static VS Code snippets; version 0.4.0. - M7
references-nav— cross-file find-all-references (reuse M2's collection machinery), document highlight, folding ranges from the rainbow's pair data. - M8
inlay-hints— port-name hints on ordered connections and parameter-name hints on ordered#(...)overrides, from the index. - M9
file-watching—workspace/didChangeWatchedFilesfor sources and the filelist; reindex on external changes (git pull, filelist edits outside the editor). - M10
include-nav— clickable`includelines resolved through the filelist's+incdir+s; cross-file`definelookup along the include graph. - M11
hierarchy— module hierarchy both directions (who instantiates X / what X instantiates) over LSP callHierarchy. - M12
semantic-lints— unused-signal, undriven-net, multiply-driven: the first semantic lint rules onvlog_semantic. - M13
cli-filelist—lucisv -f files.fon the command line, reusing M1's parser; format/lint exactly the project's files. - M14
macro-expansion— single-step macro expansion on hover (the define-table README's promised follow-up); version 0.5.0 with a CHANGELOG entry covering M7–M14. - Backlog (extract module, inline,
.*expansion, ANSI conversion, organize imports, …) — triaged in the umbrella README after M5.
9. LSP 3.18 protocol audit (2026-08-26)
Systematic comparison of lucisv_server against the LSP 3.18
specification. What we implement: hover, definition, references,
documentHighlight, documentLink, document/workspace symbols, folding,
semanticTokens/full, inlayHint, completion, inlineCompletion (3.18),
signatureHelp, codeAction + executeCommand, rename + prepare,
callHierarchy, formatting + rangeFormatting, push diagnostics, dynamic
file-watcher registration, configuration push. Below is everything
major that's missing, ordered by priority. The resolve endpoints
(completionItem, codeAction, inlayHint, documentLink, workspaceSymbol)
are deliberately unadvertised — every item is returned complete —
and are not gaps.
9a. Compliance and high-value (round 1)
executeCommandmust deliver its edit viaworkspace/applyEdit. Todayports::execute'sWorkspaceEditis returned as the request's result (server.rs,ports.rs:79), which the spec does not define and standard clients drop on the floor —vscode-languageclientdoes not apply executeCommand results andeditors/vscode/extension.jshas no custom handler, solucisv.addPort/removePort/propagateinvoked as commands currently do nothing in every stock client (the code-action path is unaffected: those carry the edit inline). Fix: push aworkspace/applyEditrequest, returnnullas the command result, and read theApplyWorkspaceEditResponse(the one client response we can no longer ignore wholesale). Gate on the client'sworkspace.applyEditcapability with the old return-the-edit behavior as the documented fallback. →docs/features/apply-edit/README.md; the edit is pushed with alucisv: <command>label, the result isnull, and a refusal is shown as an ERROR naming the command. Watcher-registration answers stay ignored;editors/vscode/extension.jsneeded no change.- Pull diagnostics (3.17):
textDocument/diagnostic+workspace/diagnostic. The modern model — client controls timing, prioritizes visible editors, caches viaresultId/unchanged. AdvertiseDiagnosticOptions(inter_file_dependencies: true— a save can change other files' diagnostics through the index;workspace_diagnostics), compute from the same parse+lint pass that feedspublish, answerUnchangedwhen the buffer version and index generation both stand. Keep push for clients that don't sendtext_document.diagnosticcapability; never run both models for the same client (double diagnostics). →docs/features/pull-diagnostics/README.md; one generation counter is the wholeresultId(bumped byset_documentandreindex), the push gate sits insend_diagnosticsso thedidCloseclear is suppressed too, andworkspace/diagnosticreports the open buffers — the honest limit, stated there. textDocument/selectionRange— expand-selection. Cheap for us: the scope-pair matcher (pairs.rs) and AST spans already give the nesting chain; walk offset → enclosing token → statement → item → scope → file, one linked chain per input position. →docs/features/selection-range/README.md(crates/lucisv_server/src/selection.rs); token, AST, scope-pair and file ranges are collected and filtered down to what strictly nests. No expression step — deliberate, and recorded there.
9b. High-value, next rounds
- Incremental text sync (
TextDocumentSyncKind::INCREMENTAL). Full-buffer sync on every keystroke scales poorly; apply range-scopedcontentChangesin order, with a full-text fallback on any malformed change. Touchesset_documentand the staleness model indocs/features/lucisv-server/README.md. →docs/features/incremental-sync/README.md(crates/lucisv_server/src/sync.rs); one pureapply_changes(text, changes) -> Stringoverconvert::Positions, a fresh line table per change so each range sees the previous one's result, rangeless changes still replacing the whole buffer, and every desynced position clamped (line past EOF, character past line end, surrogate half rounds forward,start > endbecomes an insertion). Still oneset_document— one reparse, one generation bump, one publish — per notification. Advertised asTextDocumentSyncOptionswith the open/close andsave.includeText: falsevalues a bareKindalready implied, so no client's save behavior moved. Amended 2026-08-28 (docs/features/change-debounce/README.md): adidChangenow only records the composed text; the reparse, the generation bump and the publish happen at the next flush — the next request, the next non-didChangenotification, or a 150 ms quiet period — so a typing burst costs one of each instead of one per keystroke. The buffer's text is still exactly current after every notification; only its analysis is deferred, and intermediate diagnostics states are no longer published. Measured 2026-08-28 (docs/features/interactive-latency/README.md): a burst of ten keystrokes over the wire produces exactly onepublishDiagnostics, and a keystroke a request follows — the shape a real editor sends — round-trips in 4.8 ms at 1 000 lines and 37 ms at 10 000. textDocument/willSaveWaitUntil— the protocol-native format-on-save hook (client-sideeditor.formatOnSavealready works; this serves the editors without it). →docs/features/will-save-wait-until/README.md; advertised aswillSaveWaitUntil: true(the plainwillSavenotification stays unadvertised — there is nothing for us in it), and gated on a newlucisv.formatOnSavesetting that is off by default, so a client with its own format-on-save never formats twice. On, it istextDocument/formattingwith a different trigger: same engine, same all-or-nothing edit, same[]for an already-formatted buffer, and the settings ladder minus itstabSizerung because the request carries noFormattingOptions. Every save reason formats; an unopened buffer and the off state both answernull.- Semantic tokens
range+full/delta— we setrange: Noneand no delta, so clients re-request whole-file token sets on every edit. Delta needsresultIdbookkeeping per buffer. →docs/features/semantic-tokens-delta/README.md;tokens.rssplit into classification → absolute form → filter → one pure encoder, so all three requests share a tokenizer.range: Some(true)answers the overlapping tokens whole, re-encoded from the start of the document (a range answer is self-contained, not a slice), carries noresultIdand is not what a later delta diffs against; an empty range answers nothing.full: Delta { delta: true }answers oneSemanticTokensEditreplacing everything between the common prefix and the common suffix — the suffix capped to what the prefix left, because identical lines of Verilog encode identically and an uncapped suffix claims the same tokens twice.resultIds are minted per answer, stored byfullandfull/deltaalike, dropped ondidClose; an id the server does not hold is answered in full. No token request bumps the diagnostics generation. Not done:workspace/semanticTokens/refresh. - Work-done progress —
reindex()is a synchronous full rescan on every save with nowindow/workDoneProgressreporting; on a big filelist the server just goes quiet. →docs/features/work-done-progress/README.md; every workspace rescan — the startup build, a save, a watched file, a changedlucisv.exclude/filelist— is wrapped in onewindow/workDoneProgress/createplus a$/progressbegin/end pair on a freshlucisv-index-Ntoken, gated on the client'swindow.workDoneProgress(a client that did not ask is sent nothing at all, as the spec requires).begingoes out without waiting for the create's answer, because the rescan blocks the loop the moment it returns; the create's answer is ignored on the same path the watcher registrations' is. No percentage and no intermediate report — the rescan is one opaque call — and theendnames the indexed file count, read off the index's own file list. The bar covers the scan, ending before the scope warnings and the republishes. → Superseded in part, 2026-08-27: the rescan is no longer opaque.docs/features/indexing-ux/README.mdaddsvlog_semantic::IndexBuilder/index_order, so the bar now carriesn/total file.svand a counted percentage (throttled to at most 1000 reports per rescan), a per-filewindow/logMessageunderlucisv.index.logFiles, and a 1 MiB default walk-file size cap underlucisv.index.maxFileSizewhose skips theendmessage counts. → Extended again, 2026-08-27 (docs/features/index-persistence/README.md): a file restored from the persistent index cache logscached:rather thanindexing:and is counted in theendmessage —860 files indexed, 860 from cache— so a rescan that flew past says why. → Extended once more, 2026-08-28 (docs/features/index-scope/README.md): a file that went into the index from an open buffer's own finished analysis — no parse, no store — logsanalyzed:and adds nothing to theendmessage, so "from cache" still means the persistent store alone. → The other half of the size story, 2026-08-27 (docs/features/large-file-mode/README.md): the walk cap covers files nobody opened, andlucisv.largeFile.threshold(4 MiB) now covers the file that is open. Over it, a buffer is line-indexed and nothing else — 41 ms for 100 MB — coloured a viewport at a time bysemanticTokens/range, answerednull/empty everywhere else, and left out of the index entirely (the one exception to "an open buffer is never capped"). It logslarge-file fast path: <path> (<bytes> bytes)once per buffer. Everything else above — the capability gate, the token scheme, the create's ignored answer, the ordering against the republish — is unchanged. $/cancelRequest— the loop handles requests sequentially and ignores cancellation; at minimum answer already-cancelled queued requests withRequestCancelled. →docs/features/cancel-request/README.md; completes §9b.run()now reads in bursts — one blocking receive, then everything already queued behind it — and handles the burst in arrival order, so adidChangeahead of a request is still applied before that request is answered. A request the same burst also carries a cancel for is answeredRequestCancelled(-32800) without being dispatched; the cancels themselves are consumed there and never reachnotification(). A cancel naming no request in its burst is dropped on the spot — it refers to a request already answered, or to one that never arrived — so the feature holds no state between bursts, and a double cancel is harmless.shutdownis honoured before the cancelled set is consulted and so is never cancellable. Numeric and string ids both read; malformed cancels dropped. The design's one correction:lsp-server0.10 wires its stdio transport withbounded(0)rendezvous channels, so a backlog never sits onconnection.receiverat all — the loop forwards messages onto an unboundedstd::sync::mpscqueue of its own on one small thread (std-only, no new dependency), which stops atshutdownsohandle_shutdownstill reads theexitthat follows. Nothing already running is cancelled; that needs the worker pool §6 defers.
9c. Moderate value, Verilog-shaped
- Goto type definition — from a net/variable use to its
typedef/struct/enum/interface declaration; real value once
vlog_semantictracks declared types of bindings. → delivered 2026-08-26 bydocs/features/type-definition/README.md:typeDefinitionProvider+crates/lucisv_server/src/type_def.rs.vlog_semanticwas not changed — a binding still carries no type, but the type name it was declared with is already aReference, so the answer isnav::definitionof that name's own offset, found from the parse tree. Covers typedefs (alias/enum/struct), interfaces, classes, module instances,pkg::t,import pkg::*, header parameters and task arguments; one hop per keypress on an alias chain; built-ins answer an empty list. Two requests recorded there:vlog_semanticshould report an unqualified lexical miss as an external candidate (stood in for by a fenced index lookup), andvlog_parsercannot parse an ANSI header whose first port has no direction. Both landed: the first on 2026-08-26 bydocs/features/overlay-promotion/README.md, the second the same day bydocs/features/ansi-first-port/README.md. - Linked editing range — edit
module mand itsendmodule : mlabel together (end : label,endfunction : name, etc.). A genuinely good fit for SV's closing labels. → delivered 2026-08-26 bydocs/features/linked-editing/README.md:linkedEditingRangeProvider+crates/lucisv_server/src/linked.rs. No engine change — the AST already records both name spans on one node (name_span+end_label_span), so the pair is a lookup and never a text match, which is what makesbegin : x begin : x ... end : x end : xanswer syntactically. Covers module/macromodule/ interface, package, class, function, task, clocking, namedbegin/fork, generate blocks and the prefix-labelledb : begin ... end : b. Two deliberatenulls: an absent closing label (there is nothing to co-edit and this never offers to create one) and a mismatched one (the spec requires identical text, and linking would silently rewrite broken code). Escaped identifiers are excluded and the SVwordPatternis sent.program ... endprogram : pand the verbatim blocks (property/sequence/covergroup) are the only labelled constructs left out, becausevlog_parserkeeps no name span for them — recorded in that README's Handshakes. - Code lens — "N instantiations" above each module header from
the hierarchy index;
codeLens/resolveunnecessary (counts are cheap),workspace/codeLens/refreshon reindex. → delivered 2026-08-26 bydocs/features/code-lens/README.md:codeLensProvider(resolveProvider: false) +crates/lucisv_server/src/lens.rs. One lens per module and interface declaration, on the declaration's own name span, reading "no instantiations" / "1 instantiation" / "N instantiations". The count is not a second census:hierarchy::incomingwas split intohierarchy::callers_of_each, a batched form of the same walk, so the lens counts exactly what the call hierarchy would list — asserted by an equality test, not by restating the arithmetic. The batch is the primitive becauseWorkspace::sources()re-reads the file set, so a three-module file is one walk (133 ms over the corpus) rather than three (93 ms each). Clicking runslucisv.showInstantiations, which answers every site as aLocationand pushes awindow/showDocumentfor the first when the client advertised it; a module with no instantiations gets a display-only lens instead of a click that leads nowhere.workspace/codeLens/refreshgoes out fromreindex()after the progress bar comes down, gated onworkspace.codeLens.refreshSupport. One request recorded there: an instantiation-edge table inWorkspaceIndexwould make both this andcallHierarchy/incomingCallsa lookup instead of a workspace walk — delivered 2026-08-27,docs/features/incremental-index/README.md:instantiations_ofis the table, the walk is gone, and a whole file's lenses went 92 ms → 0.26 ms over the corpus. - On-type formatting — conspicuous absence for a
formatter-first server; candidate trigger: newline (indent the new
line per block nesting),
;(reformat the finished statement). → delivered 2026-08-26 bydocs/features/on-type-formatting/README.md:documentOnTypeFormattingProvider("\n"+[";"]) +crates/lucisv_server/src/on_type.rs. Both candidate triggers, and only those two — not}, since SV closes its blocks with the wordend.;goes throughformat::range_formattingunchanged, over the;'s own line, so that half istextDocument/rangeFormattingwith a different trigger and no new formatting logic at all.\nis new logic outside the verified engine, so it is fenced two ways: the edit it builds can structurally only replace one line's leading whitespace with spaces (a wrong answer is a wrong indent, never a moved byte), and a corpus-wide agreement test formats every checked-in file with the real engine and forbids the model from disagreeing with the printer on any line of the output — 77 528 answered, 36 647 declined, 0 disagreements, with a coverage floor so it cannot pass vacuously. Nine of the ten rules the model needed were found by that test rather than predicted, including thatvlog_formattercuddles abeginonto its header but not afork. The path never speaks: a refusal is[]with no popup, and — a correction to the design — a brokenlucisv.tomlis not reported here either, becausewarn_about_config's dedup is re-armed by thedidChangeevery keystroke produces and would give one popup per character. One deviation recorded there: the;range is the;'s own line rather than its enclosing AST node's span, which is the same answer wherever both are defined and avoids asking for a whole-module reformat when the;is the one closing a module header.pairs.rsgained threepub(crate)accessors so the matcher and the indent model read one keyword table. - Type hierarchy (3.17) — arguably the semantically correct
home for the module hierarchy (and later interface/class extends
chains); keep callHierarchy as the compatibility surface.
→ delivered 2026-08-26 by
docs/features/type-hierarchy/README.md:typeHierarchyProvider+crates/lucisv_server/src/type_hierarchy.rs, all three requests. Classes, not modules — the lead's scope call: an instantiation is a containment edge andextendsis an inheritance edge, so the module hierarchy stays on callHierarchy exactly as this item's second clause asks, and typeHierarchy serves one node kind well.supertypesis not a new lookup:extends Baseis already avlog_semanticreference and overlay-promotion already made a bare cross-file class name reachable through it, so the answer isdefinition_ofasked at the last byte of the extends name span — which is the tail ofpkg::base, the whole of a barebase, and the bare name of a parameterizedbase #(8). A base the workspace does not index (every UVM chain top) yields no item rather than a guess.subtypesishierarchy::callers_of_each's census in another key —oneBoth tables shipped 2026-08-27 (sources()pass, substring prefilter, deterministic sort — at 55 ms over the 860-file corpus, 53 ms of it file I/O; the inheritance-edge table that would make it a lookup is filed beside the instantiation-edge table §9c's code-lens item already recorded.docs/features/incremental-index/README.md):subclasses_ofmakessubtypesa lookup, 55 ms → 0.71 ms. Two gaps recorded there:lsp-types0.97 has notypeHierarchyProviderfield, so the capability is inserted into the serializedinitializeresult by hand, andvlog_parserrejectsinterface class, soimplementscan never resolve and no item can carrySymbolKind::Interface. - File operations —
workspace/willRenameFiles: renaming a.sv/.svhrewrites`includelines that reference it (the include graph exists);didRename/didDeleteas cheaper index nudges than the watcher round-trip. → delivered 2026-08-27 bydocs/features/file-operations/README.md:workspace.fileOperations+crates/lucisv_server/src/file_ops.rs. An include is rewritten only when the graph says it resolves to the renamed file — never on a filename match, so twodefs.svhin one workspace stay two files. The new spelling preserves the form where the new location allows it (bare stays bare when a rung reaches it, angled resolves through+incdir+s only, absolute stays absolute), shortest resolving suffix first, with a../-relative spelling as the last resort — which is also what answers a renamed include directory, since lucisv does not edit filelists. An include no spelling can reach is left exactly as written and named in awindow/showMessagewarning ("log all, show the first", the filelist rule): the server never invents a path that would not resolve. Folders are handled, not declined — LSP sends only the folder's URI and a folder is a path prefix, which is the same operation a file rename already was. The rule shipped with a mirror half the brief did not ask for: an include written in a file that moves breaks the same way and is re-spelled too. Every edit covers the path token alone (never the backtick, the delimiters or a trailing comment) and is verified three ways before it is emitted — re-scanned, re-lexed, and re-resolved against the filesystem the rename will leave behind.didRename/didDeletereindex through the same scope predicate the watcher uses, not deduplicated against it (a double rebuild is a re-read, never a different answer). One sweep is 54 ms over the 860-file corpus.verify.rsuntouched.includes.rsgainedresolve_as_if(so there is still exactly one copy of the EDA search order) andnormalizebecame public; the standing request to extract onelucisv_core::path::normalizefor the three private copies is still open. workspace/didChangeWorkspaceFolders— roots are read once at initialize; adding/removing a folder mid-session is ignored. → delivered 2026-08-27 bydocs/features/folders-and-config/README.md:workspace.workspaceFolders { supported, changeNotifications }+Workspace::change_roots. One rescan per notification — the event carries both lists, and the progress bar, the code-lens refresh and the diagnostics generation all ride inside the existingreindex(). An event that leaves the root set where it was costs nothing: a folder already held, one never held, an empty event, params that do not parse, a non-file:folder. A removed folder's files leave the index while its open buffers stay open and keep being diagnosed — no code was needed for that, sincecollect_sourcesappends every open document after the scope ladder has spoken — and removing the last folder simply becomes rung 3 of that ladder, the rootless case. The watcher determination is recorded there: the source glob is a base-less string pattern and so is workspace-wide (no re-registration), while the filelist watcher is an absolute path anchored at the first root and is re-registered when a folder change moves it.state.rsgained exactly one 8-line method.workspace/configuration(server-pull) — we rely solely on pushdidChangeConfiguration; clients are moving to the pull model. → delivered 2026-08-27 bydocs/features/folders-and-config/README.md: oneworkspace/configurationfor thelucisvsection at startup and again on every emptydidChangeConfiguration(the 3.17 client's "something changed, ask me"), gated onworkspace.configuration. A push with a payload still applies directly, so the legacy path is untouched; a client without the capability keeps exactly today's behaviour, empty-payload semantics included. One parser — the answer's entry 0 is wrapped back into the push shape and read by the samesettings::from_payload— and one applier, soexclude/filelistcost the same rescan and the same watcher re-registration whichever door they came in. An error, anull, an empty array or junk all resolve to the defaults and none of them says anything to the user. The outstanding-request tracking was refactored fromapplying: HashMap<RequestId, String>topending: HashMap<RequestId, Pending>, one map and onematch, with the three-way interleave (applyEdit + progress create + configuration) under test. Known and stated, not fixed: a pulled setting can land after the first index build, exactly as a pushed one always could.- 3.18 additions:
textDocument/rangesFormatting(multi-range, feeds format-modified-lines), snippet edits inWorkspaceEdit(would improveaddPortcursor placement), andworkspace/textDocumentContent(could serve a read-only "expanded macro" document). → 2026-08-27 bydocs/features/lsp-318-extras/README.md: one shipped, two parked with evidence. Shipped —textDocument/rangesFormatting, served as then-range case ofrangeFormatting: the ranges become one sorted, mergedLineRanges(the constructor--lines 3-9,40already used, so unsorted, overlapping, adjacent and repeated ranges all normalize in the one place) and oneformat_rangecall, which keeps the all-or-nothing contract over the union rather than making it a per-range promise.range_formattingis now defined as the one-element call of it, so the reply shape, the refusal and the config warning are the same values and cannot drift; an emptyrangesarray is an ask for nothing, not an error. The capability is advertised by wideningdocumentRangeFormattingProviderfromtrueto{ "rangesSupport": true }— the spec's ownboolean | DocumentRangeFormattingOptionsunion — gated on the client having senttextDocument.rangeFormatting.rangesSupport, so every client that shipped before this round sees the identical byte and only a 3.18 client sees the object; the handler is registered unconditionally.lsp-types0.97 spells neither half, so the capability goes out through theinitialize_value()JSON insertion (the type-hierarchy precedent) and the client flag is read from the raw initialize params before the typed decode drops it. Parked — snippetWorkspaceEditedits:lsp-types0.97 has noSnippetTextEdit,WorkspaceEditClientCapabilitieshas nosnippetEditSupport, and the pinned[email protected]has neither string anywhere in it, so a server sending one would be writing a literal${1:name}into the user's buffer. Parked —workspace/textDocumentContent: absent fromlsp-types0.97 and from the pinned client, and serving a custom URI scheme in VS Code needs a content provider the deliberately thinextension.jsdoes not register; the expanded-macro view it would serve is also hover-sized today, not document-sized. Both have an exact re-check trigger recorded (onenode_modulesgrep each). This completes §9c.
9d. Deliberately skipped (no Verilog use case)
Notebook sync, moniker (LSIF), inline value (debugger), document color, goto implementation, goto declaration (Verilog has no declaration/definition split lucisv models). Recorded here so the audit doesn't repeat.
10. Performance wave (2026-08-28) — docs/performance.md findings
Source: docs/performance.md (benchmark of every LSP action against
opentitan, 3 976 files). Tracking for the two-worktree parallel round;
each lane's dev ticks only its own lines. Lane file ownership is the
merge contract — a lane touches no file outside its list.
Done before the wave (trunk)
textDocument/codeAction3.1–4.6 s per cursor move → 7.1 ms (83 ms at a 36-file fan-out):Workspace::module_sourcessubset instead ofws.sources()— refactor-ports README, 2026-08-28 work log + Review.
Lane A — rename family (worktree A; files: crates/vlog_refactor/*,
crates/lucisv_server/src/{rename.rs,file_ops.rs,state.rs,perf.rs}, docs/features/{refactor-rename,file-operations}/README.md, docs/perf/README.md)
prepareRename2.5–3.0 s (F2 blocks everything) → buffer+index answer, < 1 ms; refusal-by-refusal parity table in the README. 1.663 s → 139 ns on OpenTitan; parity table and six byte-by-byte parity suites in refactor-rename's README, plus 564 offsets of a realtb.svswept identical, zero deferrals.rename3.6–8.7 s → reference-postings fan-out subset with a written sufficiency argument; verifier integrity proven. 3.467 s → 105.5 ms on OpenTitan, edits byte-identical at every cursor checked (7 files ataes, 114 files atclk_rst_if), the capture refusal still firing on a real workspace. QA found one lost refusal (a dangling use of the new name); closed by a sixth rung,WorkspaceIndex::files_spelling— 852 µs worst case on OpenTitan. One accepted residue remains — macro-invocation-argument warnings in files outside the fan-out, costing no edit and no refusal.willRenameFilessamews.sources()shape (file_ops.rs:120) → include-graph/index-bounded subset. 249 ms ofsources()→ a 14.1 ms whole answer on OpenTitan (331 includers of 3 976).
Lane B — hot path + UX (worktree B; files:
crates/lucisv_server/src/{completion.rs,candidates.rs,nav.rs, settings.rs,perf.rs}, crates/lucisv_server/tests/e2e.rs, editors/vscode/package.json, docs/features/{completion-core, references-nav,index-scope}/README.md, docs/perf/README.md)
completion34–66 ms per keystroke (worst at 0–4 chars) → profile, then < 5 ms with item-identical answers pinned. Profiled: the whole cost was tier 0, the module skeletons — every other tier is 0.19 ms at every prefix. Tier 0 now parses the declaring file's header instead of all of it, and reads the module names off a table built with the index instead of sorting the workspace's whole symbol table per keystroke. 3.17 ms at the empty prefix on a 4 000-file generated corpus (was 53.2 ms); 13–15 ms worst case on opentitan (was 34–66), and typingaes_reg_top201 ms → 64.5 ms. Items pinned identical by a fifteen-shape plan-equality test and a module-table equality test.documentHighlightanswered 0 results at every opentitan position while references answered — root-cause and fix (or prove the benchmark request wrong and correct docs/performance.md). A real bug, not a benchmark mistake: the handler asked only single-fileSemantics, so a name this file uses but does not declare — an instantiated module, a.portconnection — had no symbol to find, whilereferencesread the workspace overlay. Fixed innav::external_occurrences, with a unit regression test and the two opentitan positions pinned over the wire.- Default
lucisv.index.scopeDepth0 → 2 (folder scope indexed exactly one file in opentitan's dv/tb layout; every cross-file answer empty until a jump widens) — behavior change, CHANGELOG callout at release. Also removed the rootless climb, which had no root to clamp against and would have walked an unnamed tree at the new default. Cost measured rung by rung: 1 / 1 / 21 / 252 files at depths 0 / 1 / 2 / 3.
Take 2 follow-up (2026-08-29) — the first RTL open at the default scope
Measured in performance_take2.md §5b: opening hw/ip/aes/rtl/aes.sv
at scopeDepth: 2 raises the scope to hw/ip and costs 1.4–1.7 s.
Files: crates/lucisv_server/src/{candidates.rs,state.rs,server.rs,perf.rs},
docs/features/index-scope/README.md, docs/perf/README.md.
- Diagnosis corrected against the running binary: the widen already
takes the cheap path for a subsuming scope and already diffs by
file against the index (the bar reads 1 685, not 1 807, when
the old block's 124 files are inside the new root), so nothing was
re-indexed. The chooser's
Wholearm is still unreachable. Pinned bystate::tests::a_widen_that_subsumes_the_old_scope_reads_only_the_files_it_addsand awiden_oftable row. - The real cost found and fixed: folding a widen's words into the
completion table inserted each new word into a sorted
Vecon its own, which is quadratic in the batch — 403 ms of the 935 ms on opentitan'shw/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
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 aFACTS_FORMATchange. - 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.
Deferred, filed
codeActioncosts 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.inlayHintreturns 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 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. - 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
verbatim under "The staleness premise, stated exactly" in
refactor-rename's README, with what it costs (a file whose disk
copy moved unseen is neither rewritten nor refused over) and the
one exemption (open buffers, always in the set). Both residues
ruled on: the dangling-use lost refusal was rejected and fixed
(rung 6,
files_spelling); the macro-invocation warning loss is accepted as documented, with theFileFactsmacro census filed as the real fix.
VS Code design-hierarchy sidebar (2026-08-29)
Feature by codex; this section is that round plus the lead's QA finding
and three owner items. See
docs/features/vscode-hierarchy-sidebar/README.md.
lucisv/moduleHierarchy+lucisv/moduleHierarchyChanged, gated oninitializationOptions.hierarchyView; Activity Bar container, webview view, navigation, context menu, bookmark.FACTS_FORMAT4 → 5:Def::decl_span, per-instanceInstanceOccurrences on the statement edge, and client positions on file-scope declarations and instance occurrences. Call hierarchy and code-lens counts unchanged.- Lead's HIGH finding — the snapshot read every module-declaring
file per request. Fixed by index-carried positions (zero file
I/O),
WorkspaceIndex::units_of, and a schema-2 wire (file table, four-number ranges, no ids, no per-instance definition copies). On opentitan, server-side handler 145–167 ms → 17–20 ms warm, response 11.6 MB → 2.3 MB, a definition pipelined behind a snapshot 263 ms → 41 ms. Store cost of the positions: +1.7 % on the corpus, +1.9 % on opentitan. completetightened to!scanning && !must_wait()and the window it has to be honest about written down and tested.- Owner: the five-line hover source preview removed — the feature's last consumer of file text.
- Owner: every tree level collapsed by default; expansion state survives a refresh on stable row ids.
- Owner: search freeze fixed. The model is flat and resident, tree levels are built lazily, and a query is one pass over a prebuilt 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::locationontoDeclPositionssotextDocument/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. - Manual extension-host acceptance (themes, keyboard-only, zoom, screen readers, an old server binary, both VSIX shapes).
11. Testbench-syntax wave (2026-08-29) — syntax_coverage.md findings
Source: syntax_coverage.md (opentitan sweep, 96.2% → the gap). The top
two buckets both edit vlog_parser/src/parser.rs, so per CLAUDE.md's
parallel-lane rule they run serially; the wave's first two lanes pair
the constraints round with the TOPO-independent formatter bugs instead.
Lane A — out-of-class constraints (worktree; files:
crates/vlog_parser/src/parser.rs, crates/vlog_parser/tests/*, crates/vlog_semantic if an arm is needed, docs/features/ out-of-class-constraints/README.md, TODO.md §11 Lane A lines)
constraint C::name { ... }at file/package/class-external scope — 45 files blocked, and the tolerant-mode cascade (300+ bogus diagnostics per file) is the real LSP damage. Expected shape: the classes feature's verbatim capture reused (justify if not). Done:parse_constraintreusesparse_method_name, no new AST variant. OpenTitan 151 → 107 failures; 44 of the 45 clean, the 45th advances to bucket 10. Tolerant diagnostics over the 45: 1 349 → 1.docs/features/out-of-class-constraints/README.md.
Lane B — formatter round-trip bugs (worktree; files:
crates/vlog_formatter/src/* EXCEPT verify.rs forgiveness, crates/vlog_formatter/tests/*, docs/features/formatter-bug-fixes/ README.md, TODO.md §11 Lane B lines)
- The 12 files the safety net refused (comment /
else ifmerging shapes in syntax_coverage.md §bucket 2): fix the formatter so its output verifies; verify.rs forgiveness may NOT be widened (any widening needs masked-corruption attack tests per invariant 4 — prefer no widening at all). 11 of 12 fixed;verify.rsuntouched. The 12th (keymgr_scoreboard.sv) had its bucket-2 bug fixed and a second, distinct, parser-side bug behind it —Parser::take_before_open(parser.rs:757) drains the whole pending-comment queue, so a comment written afterif (is swallowed by the condition's first call. Out of Lane B's file set; filed as a handshake indocs/features/formatter-bug-fixes/ README.md. - Owner/lead: the one-line parser fix above (Lane A's file), which closes the last of the 12.
Serial, after Lane A merges (parser.rs frees up)
- Directive-split for expressions/statements:
`ifdefsplitting an assign RHS / instantiation head (chip_if.sv:1192 anchor; blocks both top_* tb.sv testbenches). 5-file floor, high leverage. - Mop-up bundle (~26 files): enum member ranges, cast-base drive strengths, local typedef statement, gate delays, virtual+modport, rand-on-struct, foreach-skip-dim, hierarchical bind instance list.