lucioandClaude Fable 5 ce2f858e5e Class member access: in_item.user_id resolves, through the handle's type and up its extends chain
DV round 1 (TODO section 15). The tail of head.member gets a reference
when the head is a plain identifier whose declared type (Symbol::type_name,
new) is a class or module: the member is found in that scope, else up the
in-file extends chain, else the workspace's member table chases
WorkspaceIndex::base_of (a subclass-to-base map rebuilt from the existing
inheritance census, no new facts field) - cycle-guarded on both sides and
placed in follow_one so hover, cross-file references and rename cannot
disagree. this.x/super.x misses ride the same loop, delivering topo
2.9-9. An out-of-class method body (task c2::update) sees its class's
members through a stand-in Class scope. FACTS_FORMAT 5 -> 6: the layout is
unchanged but the reference census grew.

Honesty by construction, after QA's one REWORK: a head whose type is
declared in-file as anything without a member scope (typedef, alias,
enum, param) records nothing - a two-state Option had stood in for the
three-state TypeHere question, and a typedef named bus_t could have been
answered by an unrelated class bus_t elsewhere. The fix removed exactly
438 wrong postings from the corpus with unresolved unchanged at 1256.

Hover 7-143 us; opentitan tl_seq_item member 0.12 ms cold, 0.01 ms warm;
store +2.85 percent.

docs/features/class-member-access/README.md.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-09-01 20:17:18 -07:00

lucisv — Language Utility for Coding In SystemVerilog

A Verilog and SystemVerilog formatter, linter, and language server written in Rust.

An opinionated, fast formatter and linter for Verilog-2001 and SystemVerilog RTL, built in the image of ruff, with layout conventions and lint ergonomics borrowed from Verible.

# format files / directories in place (like `ruff format`)
lucisv rtl/ tb/top_tb.sv

# lint (like `ruff check`); `lucisv format ...` is the explicit spelling of the above
lucisv check rtl/

# check mode for CI (exit 1 if anything would change)
lucisv --check rtl/

# print a unified diff instead of rewriting (also exit 1 if anything would change)
lucisv --diff rtl/

# format exactly what an EDA `.f` filelist names (repeatable, adds to the rest)
lucisv -f project.f
lucisv check -f project.f -f tb/tb.f rtl/extra.sv

# skip generated files while walking directories (repeatable)
lucisv --exclude '*_gen.sv' --exclude build rtl/

# .gitignore is honored while walking; --no-gitignore turns that off
lucisv --no-gitignore rtl/

# files are formatted on all cores; pin the worker count for reproducible CI
lucisv --threads 1 rtl/

# repeat runs skip files that are already formatted; --no-cache turns that off
lucisv --check rtl/
lucisv --no-cache --check rtl/

# format only the lines you edited, leaving the rest of the file byte-for-byte
lucisv --lines 120-134 rtl/alu.sv
lucisv --lines 3-9,40 --check rtl/alu.sv

# ...or derive the ranges from git, so only your patch gets formatted
tools/lucisv-changed.sh            # everything not yet committed
tools/lucisv-changed.sh --check origin/main

# ignore any lucisv.toml found next to the input
lucisv --no-config rtl/

# pipe through stdin/stdout; --stdin-filename names the buffer in messages
cat foo.sv | lucisv -
cat foo.sv | lucisv --stdin-filename rtl/foo.sv -

Exit codes (frozen contract — CI may depend on it)

Code Meaning
0 Success: files were formatted, --check/--diff found nothing to change, or check found no violations
1 --check/--diff: at least one file would be reformatted (nothing written). check: at least one violation was reported
2 An error occurred (bad arguments, I/O, or a file that could not be formatted); every file involved in an error is left untouched

An error outranks "would reformat": a run with both exits 2.

Parallelism

Files are formatted on a worker pool, one thread per logical CPU by default. --threads N pins the worker count (--threads 1 is a single worker), which matters for reproducible CI timing and for bisecting; it never changes what is produced. The thread count does not affect output: results are collected and reported in input order, so stdout, stderr and the exit code are byte-identical at any N, and lucisv --diff stays one clean patch in input order. stdin mode is single-threaded.

Cache

lucisv remembers which files it has already verified are formatted, so a repeat run over an unchanged tree skips them: the summary says N files from cache, and on one core the corpus check goes from 396 ms to 51 ms (2.3× at the default thread count, where parallelism has already taken the easy win).

An entry is keyed on (content hash, line-length, indent, lucisv version) per file, and only ever records the already formatted verdict — a file that would be reformatted, or that failed, is re-checked on every run, so --check's exit codes and --diff's output never go stale. The store is one text file in .lucisv_cache/ (self-ignoring, like cargo's target/); deleting it, or a corrupted one, costs one slow run and nothing else. --no-cache neither reads nor writes it, and --cache-dir <PATH> puts it elsewhere (the default is relative to the current directory). Content hashing is 64-bit FNV-1a and a lookup never crosses files; docs/features/format-cache/README.md states the collision posture, the semantics table and the concurrency story.

Ignore files

While walking a directory, lucisv reads a .gitignore in every directory it enters and skips what those rules name. A deeper .gitignore is applied after (and so overrides) a shallower one, and within one file the last matching line wins — git's own precedence. --no-gitignore switches this off. A path named directly on the command line is never ignored, exactly as with --exclude.

Supported: # comments, blank lines, * inside one path component, a leading or embedded / (anchors the pattern to that .gitignore's own directory), a trailing / (matches directories only), and ! negation. Not supported: **, ?, character classes, \ escapes, the global/repo excludes files, and git's "already-tracked files are never ignored" rule. See docs/features/parallel-files/README.md for the exact subset.

Configuration

Settings live in a lucisv.toml (or .lucisv.toml) file, ruff-style. For each input, lucisv searches upward from that path's directory for one:

  1. lucisv.toml in the directory — used if present;
  2. else .lucisv.toml in the directory;
  3. else, if the directory contains .git, stop: no config (the .git check comes after 1–2, so a config file in the repo root is still found);
  4. else repeat in the parent directory, up to the filesystem root.

The first file found wins outright — configs are never merged. Files in different directories may therefore be formatted with different settings in one run. For stdin, the search starts at --stdin-filename's directory, or the current directory if that flag is absent. --no-config skips all of this.

# lucisv.toml — every key is optional
line-length = 100          # 40..400, same as --line-length
indent = 2                 # 1..8, same as --indent
exclude = [ "*_gen.sv", "build" ]   # added to --exclude patterns
filelist = "rtl/files.f"   # an EDA `.f` filelist, relative to this file

filelist names the project's sources the way the rest of the EDA world already does — one path per line, -f to nest another filelist, +incdir+, +define+, #/// comments, $VAR expansion, paths relative to the filelist that names them. This key is read by lucisv-server only, where it defines exactly which files are indexed (Editor setup): a lucisv rtl/ that quietly formatted a filelist's files instead of rtl/'s would be a surprise. On the command line a filelist is named explicitly, with -f:

lucisv -f project.f              # format exactly the files it names
lucisv check -f project.f rtl/   # ...added to whatever else is named

The listed paths are taken exactly as written — neither --exclude nor .gitignore filters them, just as neither filters a file named on the command line — and a file named twice over is processed once. A listed file that has gone missing, an option lucisv does not know and an unset $VAR are warnings on stderr that change no exit code; a filelist that cannot be read at all is an error (exit 2) and nothing is processed. Details: docs/features/filelist/README.md and docs/features/cli-filelist/README.md.

Precedence: CLI flag > config file > default, per setting (--indent 4 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, multi-line arrays, 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

lucisv check runs a set of lint rules over the same files lucisv would format — same walk, same --exclude, same .gitignore handling, same lucisv.toml discovery.

lucisv check rtl/                          # FILE:LINE:COL: message [rule-name]
lucisv check --output-format json rtl/     # one JSON array, for editors and CI
lucisv check --select no-tabs rtl/         # only these rules (comma-separated)
lucisv check --ignore module-filename rtl/ # everything but these
lucisv check --fix rtl/                    # apply the safe fixes, write files back

Exit codes are the frozen contract above: 0 clean (or everything fixed), 1 violations remain, 2 error. Unlike the formatter, check uses the error-tolerant parser, so a file lucisv cannot fully parse is still linted for what it can see.

Rule Fix What it wants
no-tabs safe spaces, not tabs (a tab inside a string is left alone)
no-trailing-whitespace safe nothing but code before the newline
case-missing-default — every case/casex/casez has a default
always-ff-non-blocking — <= inside always_ff
always-comb-blocking — = inside always_comb
explicit-parameter-storage-type — parameter int W = 8, not parameter W = 8
module-filename — a one-module file is named after its module
unused-waiver — waivers that suppress nothing
unused-signal † — no net or variable nothing uses
undriven-net † — everything read is driven by something
multiply-driven † — one driver per variable

† Off by default — --select them. These three read the file's symbol table, not just its syntax, which is what lets them tell one count from another; they are off because a single-file analysis cannot see a signal used from another file's hierarchy. See docs/features/semantic-lints/README.md. The table above is not the whole set — naming-style rules ship too, and cargo run -p vlog_linter --example rules_markdown prints the generated reference for every rule with its default.

Fixes follow ruff's applicability model: --fix applies safe fixes (those that cannot change what the code means), --unsafe-fixes widens that — no rule ships an unsafe fix yet. Violations inside a // verilog_format: off region are reported but never fixed: off means hands-off for the linter too, so --fix leaves every byte of a fenced region exactly as written.

Waivers

wire a;  // lucisv: waive no-tabs      suppresses that rule on this line
// lucisv: waive no-tabs               alone on a line: suppresses the next line
// lucisv: waive-start no-tabs         ... and everything through
// lucisv: waive-stop no-tabs          ... this line

verilog_lint: is accepted in place of lucisv:, so code annotated for Verible 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: 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:

This repo ruff equivalent Role
crates/vlog_parser ruff_python_parser + ruff_python_ast Hand-written lexer and recursive-descent parser producing a comment-preserving AST
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.rs ruff_python_formatter Per-node formatting rules
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

Key ideas carried over from ruff/prettier:

  • Trivia attachment. The lexer runs a second phase that folds comments into neighboring tokens as leading/trailing trivia and records blank lines; the parser then harvests them onto AST nodes (Meta). Comments are never dropped — anything not harvested at a precise location is folded into the next node's leading comments.
  • Fit-based layout. Every breakable construct (port lists, connection 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.

Style

Defaults follow Verible: 2-space indent, 100-column lines (both configurable via --indent / --line-length or a lucisv.toml, see Configuration).

  • One port / parameter / connection per line once a header doesn't fit
  • Cuddled begin/end (end else begin)
  • Tight dimension expressions: [WIDTH-1:0], [base+:8]
  • Blank lines between items preserved (collapsed to at most one)
  • `define/ `ifdef/ `include and (* attributes *) passed through verbatim

Alignment is inferred, not imposed

Hand-aligned columns are how RTL is read, so lucisv reads the spacing you already wrote and keeps your intent — Verible's rule, without the knobs. Within a run of adjacent ANSI port declarations, named connections (.clk (clk)) or parameter/localparam declarations, four or more spaces where one would do — or a run whose column is already lined up — means "aligned": every row is padded to the widest one, and the list stays one element per line. Anything else formats flush-left with a single separator, exactly as it always has, so a file written without alignment never grows any.

// written with aligned columns, so lucisv leaves them aligned — at the width
// the group actually needs, which is what makes two people's tables agree
module m (
  input wire             clk,
  input wire [WIDTH-1:0] data,
  output logic           valid
);
  localparam int A      = 1;
  localparam int LONGER = 22;
endmodule

Groups end at a blank line, a standalone comment, an (* attribute *) or a compiler directive, so two tables separated by a comment get their own columns. A group whose widest aligned line would pass the line limit falls back to flush-left as a whole — never half-aligned. Full rule, including why both layouts are fixed points of re-formatting: docs/features/alignment/README.md.

Turning the formatter off

Items between a // verilog_format: off and a // verilog_format: on comment are emitted as the exact source bytes they were written with, indentation included — the escape hatch for hand-aligned tables and the like. // lucisv: off / // lucisv: on is an accepted alias.

module m;
  // verilog_format: off
  localparam int A     = 1;   // hand-aligned, left alone
  localparam int LONGER = 22;
  // verilog_format: on
  localparam int B = 3;       // formatted normally
endmodule

The fence must be a line comment on its own line, and its text must match exactly — // lucisv: off for now is an ordinary comment, not a fence. An off with no matching on runs to the end of the enclosing item list (module body, package body, generate block, or the file). Fences select whole items; one written between two statements has no effect yet. Full rules: docs/features/format-fences/README.md.

Range formatting (--lines)

--lines M-N formats only the constructs meeting those 1-based, inclusive lines and emits every other byte exactly as it was written. This is the adoption path for a legacy tree: your patch comes out formatted and nothing else moves, so review sees the change rather than a reflow.

lucisv --lines 120-134 rtl/alu.sv          # one range
lucisv --lines 3-9,40 rtl/alu.sv           # several, comma-separated
lucisv --lines 3-9 --lines 40 rtl/alu.sv   # the same, repeated

The unit is one item. An item whose lines meet a range — a declaration, an always block, an instantiation — is laid out exactly as a whole-file run would lay it out; nothing smaller is, so selecting one statement lays out the always block around it. A module or package is descended into: its header and its endmodule stay as written unless they are themselves selected, and only the body items that are selected are laid out — a three-line edit in a two-thousand-line module reformats three lines. // verilog_format: off still wins over any range.

--lines needs explicit file arguments (or -), never a directory, and neither reads nor writes the cache: a partly-formatted file is not the "already formatted" verdict the cache stores. It combines with --check, --diff, --stdout and stdin. tools/lucisv-changed.sh turns git diff hunks into ranges. Full semantics, including what happens at a range boundary: docs/features/range-formatting/README.md.

Supported syntax

Basic Verilog-2001 and the common synthesizable SystemVerilog subset:

  • Modules (ANSI and non-ANSI headers), packages, parameter ports, import, timeunit
  • Net/variable declarations (wire/reg/logic/int/... , signing, packed/unpacked dimensions, net delays), parameter/localparam, genvar, defparam
  • assign (with delays), always/always_comb/always_ff/always_latch, initial/final
  • Full statement set: begin/end (labeled), if/else, all case kinds with unique/priority, for/while/do/repeat/forever/foreach, fork/join*, timing controls (#, @), wait, disable, force/ release, event triggers, immediate assertions, break/continue/ return
  • Module/gate instantiation: named and ordered connections, .*, parameter overrides, instance arrays
  • bind directives (IEEE 1800 §23.11): bind <target> [: <instances>] followed by an ordinary instantiation, at module scope, at top level and inside generate. The target may be a module, interface or instance name or a hierarchical path. See docs/features/bind/README.md
  • Interfaces (IEEE 1800 §25): interface [import pkg::*;] [#( ... )] [( ... )]; ... endinterface[: label] — the module header's grammar, the module body's items, plus modport a (input x, output y), b (...); and clocking cb @(posedge clk); ... endclocking (including default clocking, the anonymous and body-less spellings, and #skew/edge skews). virtual [interface] iface [#( ... )] stands in every type position — a typedef base type, a task/function argument, a declaration. See docs/features/interfaces/README.md
  • generate regions and module-level if/for/case
  • Functions and tasks (ANSI and old-style port declarations)
  • typedef (aliases, enum, packed struct/union, typedef class forward declarations), including an enum whose base type is a typedef'd name and a struct member whose own type is an inline aggregate
  • Anonymous enum/struct/union used as a type in place, wherever a type stands: enum logic [1:0] {IDLE, STOP} state, state_next;, struct packed { ... } s;, and as the default of a type parameter. parameter type / localparam type also stand as body items, not only in the #( ... ) list. A typedef'd type may carry packed dimensions before the declarator (payload_t [NumOut-1:0][NumInp-1:0] out_data;). See docs/features/types-decls/README.md
  • Classes: class/virtual class … endclass[: label], #( ... ) class parameters, extends Base[#( ... )], implements, and class-scope members — properties with rand/randc/local/protected/static/const, virtual interface handles, parameterized types (uvm_analysis_port #(bit [31:0]) p;), methods with virtual/static/local/protected/automatic, function new, extern and pure virtual prototypes and their out-of-body definitions, plus everything that already works at module scope (typedef, localparam, import, directives, macro items, nested classes). constraint c { ... } and covergroup … endgroup are passed through verbatim — two grammars with no layout convention worth inventing. See docs/features/classes/README.md
  • Concurrent assertions (IEEE 1800 §16): assert/assume/cover/restrict property ( ... ) with an optional label: prefix and an action block (else $error(...), $info(...); else ..., else begin ... end, and any statement that nests blocks: if (c) begin ... end else ..., fork ... join_none, case ... endcase), wherever a module item or a statement can appear — module and package bodies, generate regions, begin/end, and at file scope. Plus sequence ... endsequence and property ... endproperty declarations. All of it is passed through verbatim, for the same reason constraint is: the property/sequence expression language (|->, ##[1:3], throughout, disable iff, $rose) is a second grammar with no layout convention worth inventing. Only the first line is re-indented to the item's level; the relative layout the source wrote is what survives. See docs/features/assertions/README.md
  • Dynamic types: queues (string q[$], bounded [$:N]), dynamic arrays (int a[]), associative arrays ([*], [string], [key_t]) — in declarations, class properties, typedefs and function/task arguments; the empty literal (q = {};), new[expr], $-bound indexing (q[$], q[$-1]) and queue method calls. See docs/features/dynamic-types/README.md
  • DV statements (IEEE 1800 §7.12, §9.3.5, §11.12, §12.7.3, §13.4.2, §18.7, §18.16): randomize() with { ... } / std::randomize(x, y) with { ... } (the call is structural, the constraint block is passed through verbatim, exactly as constraint c { ... } is), the array-method iterator argument q.sum() with (item.w), foreach over a package-scoped or hierarchical array with selects on the way (foreach (pkg::isa[i]), foreach (h[id].sub[k]), foreach (a[i][j])), randcase ... endcase, wait fork;, import pkg::x; among a block's declarations, let name(ports) = expr;, an omitted positional call argument (create("x", , gfn)), and a statement label on any statement (chk: assert (a) x++; else y++;). A stray ; after a task/function footer label (endtask : t;) is reproduced where it was written. See docs/features/dv-statements/README.md`
  • DPI: import "DPI-C" [context|pure] [c_name =] function|task ...; — a function/task prototype with a linkage prefix, so the argument list breaks like any other; export "DPI-C" [c_name =] function|task name;; and package re-exports export pkg::*; / export pkg::a, pkg::b; / export *::*;. See docs/features/dpi-export/README.md
  • Named function/task call arguments (csr_wr(.ptr(p), .value(v)), .flag()), case (expr) inside with [lo:hi] range labels, and bare event controls (@ev;, @hier.name;)
  • Expressions: the full operator precedence table including the implication operators ->/<->, ternaries, concatenation/replication, slices (+:/-:), streaming concatenations ({<<8{v}}, {>>{a, b}}, also as an assignment target), casts over any constant primary (int'(x), (NumLevels)'(x), pkg::Width'(x)), assignment patterns ('{...}, including the replication form '{N{0}}), inside (with a {...} set or a macro standing in for one), hierarchical and package-scoped names, and the new forms — the constructor new(...), the dynamic-array resize new[N] and the shallow copy new obj (IEEE 1800 §8.12). See docs/features/expressions-2/README.md
  • Drive strengths on a continuous assignment (assign (weak0, pull1) x = y;), const ref task/function arguments, and (* attribute *) instances in front of a named port connection
  • Macro invocations (`NAME, `NAME(args), with or without a trailing ;) in expression position and wherever a module item or a statement can appear — module and package bodies, generate regions and blocks, begin/end and fork/join, case-item and if/else bodies, function and task bodies. The invocation is passed through verbatim (a multi-line argument list keeps its own line structure, re-indented); a trailing ; is reproduced only if the source wrote one. At item and statement position a space before the argument list is accepted too (`uvm_field_int (a, UVM_DEFAULT)) and is reproduced as written; in expression position `A (b) still parses as a call applied to (b). A macro that ends its line is a complete macro, so whatever opens the next line — a declaration, or a statement starting with @, #, -> or { — is its own item. See docs/features/item-misc/README.md and docs/features/mop-up-2/README.md
  • A based number whose digits come from a macro (32'h`DM_ADDR, 8'b`BITS). The backtick must touch the base; 32'h `X stays a lex error. See docs/features/mop-up-2/README.md
  • Elaboration system tasks where a module or generate item belongs: $fatal, $error, $warning, $info — at module scope and inside generate if/for/case and begin/end, including a generate-if whose whole body is one of them. The argument list is a breakable group, like any other call. `error/ `warning compiler directives are passed through verbatim, like `define
  • `ifdef/ `ifndef/ `else/ `elsif/ `endif, `define, `undef, `include and macro invocations written between the elements of a module header's port list, its parameter port list, an enum member list, an instantiation's #( ... ) parameter overrides or an instance's ( ... ) connection list. The condition is not evaluated: both arms' elements are entries of the one list, exactly as at item position. The directive must be the last thing on its line, and the comma placement the source wrote is reproduced — including a comma written inside an `ifdef arm. A list may be nothing but a directive (sub #(`include "config.vh") u (...)). See docs/features/directives-in-lists/README.md and docs/features/directives-in-instances/README.md

Not yet supported (parse errors). Roadmap ordered by measured impact on real RTL — see docs/features/corpus-check/README.md for the 820-file corpus baseline this ordering comes from:

  1. Macro invocation at module-item / statement position (`ASSERT_INIT(...) style) — done; see docs/features/macro-items/README.md. Unblocked 179 corpus files and moved the parse rate from 35.2% to 57.1%
  2. Classes/constraints (mostly blocks DV/UVM code, not RTL) — the top blocker at 142 files, all extends — done; see docs/features/classes/README.md. Unblocked 102 corpus files and moved the parse rate from 58.0% to 70.5%. 72 of the 142 extends files now format; the other 70 advanced to a second blocker, 34 of them to item 4 below, which is now the top blocker
  3. bind directives — done; see docs/features/bind/README.md. Unblocked 28 corpus files and moved the parse rate from 81.8% to 85.2%
  4. Dynamic arrays and queues — now the top blocker at 41 files (bit x[$], int q[]) — done; see docs/features/dynamic-types/README.md. Queues (x[$], q[$]/q[$-1] indexing, [$:N]), dynamic arrays (int q[]), wildcard associative arrays ([*]), = {} initializers, named call arguments (f(.a(x))) and case (expr) inside — unblocked 58 corpus files and moved the parse rate from 70.5% to 77.6%. All 7 inside-blocked files format; 28 of the 41 $-blocked and 17 of the 21 .-blocked do too, the rest advancing to named next blockers (interface at 25 files is now the top one — item 8 below)
  5. Declarations with identifier (typedef'd) types in some positions (my_t [N-1:0] x;) — done; see docs/features/types-decls/README.md. With the rest of the types-decls bucket (anonymous enum/struct as a type, struct packed as a parameter type default, a typedef'd enum base type, nested anonymous structs, localparam type as a body item, and a for init declaring several variables) it unblocked all 11 files of the bucket and moved the parse rate from 90.2% to 91.6% 5b. Macro invocation with a space before its argument list (`uvm_field_int (a, b)), a bare macro item followed by a declaration on the next line, `error/ `warning directives, and elaboration system tasks ($error(...)) at item position — done; see docs/features/item-misc/README.md. Unblocked 25 corpus files and moved the parse rate from 77.6% to 80.6%; the 2 remaining files of those two buckets advanced to blockers in other categories
  6. `ifdef/ `define/ `include inside a port, parameter or enum list — done; see docs/features/directives-in-lists/README.md. Two corpus files unblocked and six advanced to their next blocker (picorv32.v itself now parses 1986 lines further but still does not format — its next blocker is restrict property, item 7 below). The real payoff was the workspace index: picorv32, picorv32_axi and picorv32_wb now index (521 → 530 modules), taking cross-file external resolution from 87.0% to 93.6% on cleanly-parsed files. The instantiation half followed in docs/features/directives-in-instances/README.md: the same construct inside an instantiation's #( ... ) overrides or an instance's ( ... ) connections, which unblocked the remaining 6 files. No corpus file is blocked on a compiler directive any more
  7. DPI — done; see docs/features/dpi-export/README.md. DPI imports and exports plus package re-exports unblocked 10 corpus files and moved the parse rate from 80.6% to 81.8%; the 11th advanced to a foreach blocker in the dv-statements bucket. Still open in this item: non-simple casts 7b. Concurrent assertions (assert/assume/cover/restrict property), sequence/property declarations — done; see docs/features/assertions/README.md. Unblocked all 13 files of the assertions bucket and moved the parse rate from 85.2% to 86.8%. picorv32.v — 3000 lines of Verilog-2001, blocked on restrict property since item 6 — now formats end to end
  8. Interfaces/modports/clocking blocks — done; see docs/features/interfaces/README.md. interface … endinterface (header imports, ANSI ports, parameters), modport, clocking blocks and virtual interface types in every type position unblocked 28 corpus files and moved the parse rate from 86.8% to 90.2%; the other 3 advanced to blockers in the expressions and other buckets. Still open in this item: specify blocks, checker, program and interface class — all rare in the corpus RTL (let landed with item 10 below)
  9. Expressions: casts with a non-simple base, streaming concatenations, ->/<-> implication, drive strengths, attributes on port connections, the '{N{0}} assignment-pattern replication, inside a macro, and const ref arguments — done; see docs/features/expressions-2/README.md. Emptied the expressions bucket (21 files) plus one other file and moved the parse rate from 91.6% to 94.1%
  10. DV statements: with clauses, package-scoped/hierarchical foreach, randcase, wait fork, block-level import, let, omitted call arguments and statement labels — done; see docs/features/dv-statements/README.md. Emptied the dv-statements bucket (26 files) and moved the parse rate from 94.1% to 97.1%; 24 of the 26 files format, the other 2 advanced to a macro-items blocker and to the new obj shallow-copy expression. specify blocks, checker, program, interface class and randsequence remain unsupported
  11. A macro statement that ends its line followed by a symbol on the next one, the new obj shallow copy (IEEE 1800 §8.12), and a based number whose digits come from a macro (32'h`DM_ADDR) — done; see docs/features/mop-up-2/README.md. Unblocked the last 4 fixable corpus files and moved the parse rate from 97.1% to 97.6%. Every file still failing is in a deliberately unsupported category, except compare_helper.sv, whose `X_EACH_CSR 1 needs a macro body from another file — lucisv does not preprocess, so it stays a parse error
  12. Conditional-split constructs — an `ifdef/ `else region whose arms are each an incomplete fragment of one declaration (alternative heads sharing one body, alternative struct bodies sharing one closing) — done; see docs/features/directive-split/README.md. Recovered as a verbatim item (exact source bytes, first line re-indented), never reformatted inside — the constraint/covergroup/assertions precedent. The recovery fires only when the failed arm left a bracket open inside a conditional region that is genuinely open at item scope; ordinary syntax errors near directives still refuse. Unblocked 13 corpus files and moved the parse rate from 97.6% to 99.1%. Still failing (7): macro-bracketed covergroups and `X_EACH_CSR (need macro expansion, a deliberate non-goal) and 5 files that are not valid standalone Verilog

Like ruff, lucisv refuses to output anything for a file it cannot fully parse, so it can never corrupt code.

Editor setup

lucisv-server is a language server: one binary, LSP over stdio, the same answers in every editor. It ships formatting, diagnostics as you type, semantic highlighting, hover (including single-step `define expansion), go-to-definition, references and document/workspace symbols — the full list, and what is deliberately not advertised yet, is in docs/features/lucisv-server/README.md.

VS Code needs no separate binary: every release on the releases page carries a platform-specific .vsix with both binaries inside it — pick yours (darwin-arm64, darwin-x64, linux-x64, linux-arm64, win32-x64) and sideload it:

code --install-extension lucisv-<version>-darwin-arm64.vsix

— or take lucisv-<version>-all.vsix, which carries all five platforms' binaries in one file and picks the right pair at startup, when the machine is not known in advance (or is Alpine, which VS Code never offers a Linux package to).

Every other editor (and the universal lucisv-<version>.vsix, the fallback for platforms not listed) finds lucisv-server on PATH; the binary comes from the same build as the CLI:

cargo build --release            # target/release/lucisv-server (and target/release/lucisv)
cp target/release/lucisv-server ~/.local/bin/     # anywhere on PATH

Each editor also accepts an absolute path if you would rather leave the binary in target/.

VS Code — a thin extension in editors/vscode/ whose entire job is registering the file types and starting the server (bundled, from PATH, or from the lucisv.serverPath setting). To build the packages yourself:

tools/release.sh                 # dist/lucisv-<version>.vsix + the host platform package
code --install-extension dist/lucisv-<version>-darwin-arm64.vsix

Sideloading is the supported install; the extension is not on any marketplace.

Settings are listed in editors/vscode/README.md, along with the full steps, the F5 development flow and troubleshooting.

Neovim / Vim — no plugin, just configuration. Neovim 0.11+:

vim.filetype.add({ extension = { v = 'verilog', vh = 'verilog', sv = 'systemverilog', svh = 'systemverilog' } })
vim.lsp.config('lucisv', {
  cmd = { 'lucisv-server' },
  filetypes = { 'verilog', 'systemverilog' },
  root_markers = { 'lucisv.toml', '.lucisv.toml', '.git' },
})
vim.lsp.enable('lucisv')

nvim-lspconfig, Vim 9 (vim-lsp) and coc.nvim equivalents: editors/nvim/README.md.

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 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.

Checking the server without an editor. node editors/vscode/smoke.js <path-to-binary> spawns it exactly as the extension does and drives a whole initialize/didOpen/shutdown/exit session over stdio, exiting 0 only if the handshake and the advertised capabilities are intact — which tells you whether a failure is the server or your editor config. Its neighbour node editors/vscode/restart_test.js needs no binary at all: it drives the extension's server-restart chain (the one lucisv.verbose uses) against a scripted fake client, so a toggle can never be lost to a restart that was already in flight.

Formatting through an editor reads lucisv.toml too, discovered from the buffer's own path by the CLI's rule, so format-on-save agrees with what lucisv --check does in CI. Precedence, highest first: lucisv.toml, then the editor's lucisv.lineLength/lucisv.indent settings, then the editor's tab size (indent only — the protocol carries no line-length), then the defaults. A broken config never blocks formatting: the buffer is formatted with the next rung down and the error is surfaced in the editor.

Contributing / workflow

This is a solo project — committing directly to master is allowed and expected; no PRs or review required.

Building

cargo build --release        # binaries at target/release/{lucisv,lucisv-server}
cargo test                   # unit + snapshot + idempotency tests

Snapshot tests live in crates/vlog_formatter/tests/fixtures/; regenerate expected outputs with UPDATE_SNAPSHOTS=1 cargo test -p vlog_formatter.

Install and releases

Prebuilt downloads live on the releases page: every tagged version carries seven .vsix packages — platform-specific ones for Apple Silicon and Intel macOS, x86-64 and ARM64 Linux (static musl) and Windows, each with lucisv and lucisv-server embedded, an all-platforms one carrying every pair at once for unknown or mixed machines, plus the universal no-binary fallback — and a SHA256SUMS to verify them with (shasum -a 256 -c SHA256SUMS). Sideload the one for your machine with code --install-extension. Standalone binaries are not published; build them with cargo build --release (or tools/release.sh --cross for the full set — the release binaries are cut from the same scripts). The macOS binaries inside the packages are smoke-tested on the build machine; the Linux and Windows ones are cross-built and audited (file type, dynamic-linkage, glibc-version ceiling), not executed — there is no Linux or Windows machine in the loop.

To build the same artifact set yourself:

tools/release.sh             # host binaries + the .vsix + SHA256SUMS, into dist/
tools/release.sh --cross     # ...plus the four cross-built platforms and the all package

The script itself publishes nothing anywhere; publishing is CI's job — pushing a vX.Y.Z tag builds all of the above on Gitea Actions and attaches it to a release, with that version's CHANGELOG.md section as the notes.

Release notes are in CHANGELOG.md; the full checklist — where the version number lives, how the .vsix is packaged, and what marketplace publishing would take if it ever happens — is in tools/RELEASING.md. lucisv is MIT licensed (LICENSE).

S
Description
No description provided
Readme MIT
22 MiB
0 Stars 1 Watchers 0 Forks
v0.66.1
Latest
2026-11-19 23:28:50 -08:00
Languages
Rust 94.5%
JavaScript 3.3%
Python 1.5%
Shell 0.7%