Skip to content

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, port propagation, instantiation planning language server
lucisv_core configuration, filelists, walking, exclusions, cache, atomic replacement CLI and language server
lucisv argument parsing, parallel per-file processing, reports, write orchestration command-line users and CI
lucisv_server LSP transport, overlays, indexing, capabilities, editor settings all LSP clients
sourceFiles, stdin, buffers, filelists, and includes.
→
syntaxTokens, trivia, AST, spans, and recoverable diagnostics.
→
semanticsScopes, symbols, references, defines, and cross-file units.
formatterDocument IR, layout, fences, verification.
linterRules, waivers, applicability, fixes.
refactorPlans and non-overlapping workspace edits.
LSPQueries, diagnostics, navigation, UI actions.
  • Format: strict parse → AST-to-document layout → width-aware printer → normalized token comparison → second parse/format and convergence check. Only a verified string is returned. Ranges splice whole items; format fences also protect statement scopes, and verification covers the complete output.
  • Lint: ParsedSource bundles one tokenization and tolerant parse; LintContext supplies source facts and lazy semantics. The registry selects 73 rules with severities and validated options. Inline waivers filter findings, and the front ends protect fenced bytes before applying fixes.
  • Refactor: parsed spans and resolved references produce an edit plan; the engine checks the whole candidate edit before returning it. Server source selectors bound the input set but must include every file the engine might edit or refuse over. No formatter dependency is involved.
  • Editor: one ordered synchronous loop owns Workspace; open documents overlay disk facts. Scans publish index/include/completion batches together. Closed-file facts persist under codec 17; a bounded file-view cache serves queries that still need source text. Lazy port actions defer the edit until selection; recorded file-scope definition positions avoid a closed-file read.

vlog_parser and lucisv_core depend on no other crates. Formatting and semantics each depend on the parser; linting and refactoring depend on parser and semantics. The CLI composes core, parser, formatter, and linter; the server composes all six libraries. The linter’s formatter dependency is test-only. External dependencies are confined to the CLI worker pool (rayon) and the server’s synchronous LSP/JSON stack.

The main change-impact boundaries are the AST and all its walkers, formatter verification, persisted semantic facts, server state/ordering, and matching server/editor setting names. Source modules are split by grammar domain under parser/, ast/, format/, bind/, workspace/, ports/, and server/.

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

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.