Architecture
lucisv follows the same separation of concerns that makes ruff fast and maintainable: syntax and source fidelity at the bottom, reusable analysis and transformations in the middle, and thin product surfaces at the top.
| Crate | Responsibility | Primary consumers |
|---|---|---|
vlog_parser |
Lexer, comment-preserving AST, spans, tolerant parsing, define table | every analysis and transformation |
vlog_formatter |
document IR, width-aware printer, formatting rules, fences, ranges, verification | CLI and language server |
vlog_linter |
rule registry, diagnostics, fixes, waiver engine | CLI and language server |
vlog_semantic |
scopes, symbols, references, workspace units, external resolution | linter, refactors, language server |
vlog_refactor |
rename/references, ports, imports, extract/inline module, instantiation planning | language server |
lucisv_core |
configuration, filelists, walking, exclusions, cache, atomic replacement | CLI, language server, linter waiver matching |
lucisv |
argument parsing, parallel per-file processing, reports, write orchestration | command-line users and CI |
lucisv_server |
LSP transport, overlays, indexing, capabilities, editor settings | all LSP clients |
Data flow
Section titled “Data flow”Execution paths and ownership
Section titled “Execution paths and ownership”- Format: strict parse → AST-to-document layout → width-aware printer → normalized token comparison → second parse/format and convergence check. Only a verified string is returned. Ranges splice whole items; format fences also protect statement scopes, and verification covers the complete output.
- Lint:
ParsedSourcebundles one tokenization and tolerant parse;LintContextsupplies source facts and lazy semantics. The registry selects 74 rules with severities and validated options. Inline and external waivers filter findings, and the front ends protect fenced bytes before applying fixes. - Refactor: parsed spans and resolved references produce an edit plan; the engine checks the whole candidate edit before returning it. Server source selectors bound the input set but must include every file the engine might edit or refuse over. The formatter is a test-only dependency of this engine.
- Editor: one ordered synchronous loop owns
Workspace; open documents overlay disk facts. Scans publish index/include/completion batches together. Closed-file facts persist under codec 19, including package re-exports and tagged connection/hierarchical surfaces; a bounded file-view cache serves queries that still need source text. Lazy port actions defer the edit until selection; recorded file-scope definition positions avoid a closed-file read.
vlog_parser and lucisv_core depend on no other crates. Formatting and
semantics each depend on the parser; linting and refactoring depend on parser
and semantics. Linting also consumes core’s exclusion matcher for waiver
locations. The CLI composes core, parser, formatter, and linter; the server
composes all six libraries. Both linter and refactor use the formatter only in tests.
External dependencies are confined to the CLI worker pool (rayon) and the
server’s synchronous LSP/JSON stack.
The main change-impact boundaries are the AST and all its walkers, formatter
verification, persisted semantic facts, server state/ordering, and matching
server/editor setting names. Source modules are split by grammar domain under
parser/, ast/, format/, bind/, workspace/, ports/, and server/.
Recent changes and release boundary
Section titled “Recent changes and release boundary”v0.42–0.44 added external waiver files, exclusive atomic temp files with
canonical CLI deduplication, shared project/editor lint configuration,
cycle-aware directory walks with recoverable warnings, and inline aggregate
overrides. The v0.44.0 undriven-net fix asks the workspace mention census only
after local guards, reducing editor open/flush latency without changing the
rule’s findings or the synchronous request-ordering contract.
v0.45.0 shipped exact type-name spans (scan.rs is retired), package
re-exports and hierarchical tails, with facts codec 19. Re-exporting a
name does not import it into the package’s local scope. Instance paths reach
internal nets, variables and nested instances through a separate surface;
existing connection queries keep their interface view. Generate-scoped
hierarchical paths and DPI-export name binding remain gaps.
v0.46–0.49 added wildcard expansion, ANSI conversion, organize-imports,
extract-module and inline-module. Import usage lives in semantic imports.rs,
shared by the refactor and unused-import lint rule. Refactor check/ledger.rs
tracks protected comment/attribute pieces across moves and copies;
RefactorEdit::created carries new-file operations to the server. The inline
source selector still has a known gap for hierarchical uses through
intermediate modules; see the refactoring limits.
The DUT hierarchy is client-only over the existing server snapshot.
v0.49.0 also adds real randsequence nodes and opt-in UVM indentation, whose
CLI cache limitation is documented under configuration.
This page reflects committed df4e714; Loop 2 is closed, with state.rs
decomposition deferred to Loop 3.
Design invariants
Section titled “Design invariants”- Source fidelity: comments and blank-line intent survive the parser.
- Determinism: worker scheduling never affects ordering, formatting, or exit codes.
- Fixed points: every successful formatting call requires the second pass to match the first.
- Conservative analysis: incomplete cross-file knowledge produces false negatives rather than noisy false positives.
- Shared answers: CLI and editor features call the same library APIs.
- Recoverable state: caches are disposable; open buffers remain authoritative while an editor session is active.
Release surface
Section titled “Release surface”The supported publication surface is seven VS Code .vsix packages plus checksums: five platform packages (Apple Silicon/Intel macOS, x86-64/ARM64 static-musl Linux, Windows), one all-platform package, and one universal package requiring binaries on PATH. Both lucisv and lucisv-server are bundled in platform packages. Standalone binaries are built by the tooling but are not published as release assets. The release tooling audits file type, dynamic linkage, and the glibc ceiling for cross-built artifacts.