This commit is contained in:
1 parent
69383eae7f
commit
6d1c68994c
38 files changed
+744
-443
No files matched your search
@@ -107,7 +107,7 @@ description. The agent sees the full description and input schema.
|
||||
| `find` | | Every declaration of `name` or unit.name (kind name file:line; macros too); `refs: true` adds each one's uses as file:line and the unresolved mentions (strings, comments, macro text). |
|
||||
| `outline` | | Exactly one of: `file`, its declarations as a tree with line ranges, parse errors first; `unit`, its file:line, parameters and ports in order (modports, package members). |
|
||||
| `read` | | One item's exact source after its file:first–last line. |
|
||||
| `check` | | Parse errors and lint findings of `file` or the whole design, one per line (file:line:col severity message [rule]), errors first; `ok` when clean. |
|
||||
| `check` | | Parse errors and lint findings of `file` (path, directory or glob) or the whole design, one per line (file:line:col severity message [rule]), errors first; `ok` when clean. |
|
||||
| `rename` | yes | Rename declaration `name` (or unit.name) to `new_name` with every resolved use (.name/.* written out); `file` and name@LINE pick among declarations. |
|
||||
| `port` | yes | On `module`, `add` an ANSI port declaration (after port `after`, else last) connected in every instantiation, or `remove` a port and its connections (refused while used). |
|
||||
| `edit_item` | yes | One item of `file` (selector as read): `op` replace it by `text` (same kind and names), insert `text` before/after it (item `end`/`end@UNIT`: a unit's end), or delete it if unused. |
|
||||
|
||||
@@ -15,9 +15,9 @@ Install the `.vsix` attached to a lucisv release:
|
||||
code --install-extension lucisv-<version>-darwin-arm64.vsix # or the linux/windows package for your machine
|
||||
```
|
||||
|
||||
The extension registers Verilog/SystemVerilog file types, syntax highlighting, snippets, color settings, configuration, and starts `lucisv-server` from `PATH` by default.
|
||||
The extension registers Verilog/SystemVerilog file types, syntax highlighting (including comment keyword highlighting and instantiation-aware semantic tokens), snippets, rainbow delimiters, `begin`→`end` auto-completion, sticky scroll (for blocks, `` `ifdef `` branches, and multi-line instantiations), and starts `lucisv-server` and `lucisv-mcp` (bundled in platform `.vsix` packages, or looked up on `PATH`). See [Agents (MCP)](/guides/agents/) for agent-mode setup.
|
||||
|
||||
**DUT-centred hierarchy.** Right-click a module in the Hierarchy pane and
|
||||
**DUT-centred hierarchy & current-path highlight.** Right-click a module in the Hierarchy pane and
|
||||
choose **Star as DUT**. The pane splits into sections: the DUT with its
|
||||
children, the DUT's parents (an upward tree through everything that
|
||||
instantiates it — usually the testbench), and all other modules, re-rooted
|
||||
@@ -25,7 +25,9 @@ where their only parents are the DUT's ancestors. Star a second DUT and you
|
||||
get five sections. Unstar from the same menu, or clear every DUT from the
|
||||
pane's title bar. Starred DUTs are remembered per workspace; a team can also
|
||||
check them in with `"lucisv.hierarchy.duts": ["aes", "hmac"]`, and DUTs that
|
||||
come from the setting are shown locked.
|
||||
come from the setting are shown locked. With `lucisv.hierarchy.highlightCurrent`
|
||||
enabled (default), the active editor's module and ancestor chain highlight in
|
||||
the Hierarchy pane.
|
||||
|
||||
## Neovim 0.11+
|
||||
|
||||
|
||||
@@ -16,6 +16,16 @@ lucisv uses a Wadler/Prettier-style document model. Breakable constructs render
|
||||
- At most one preserved blank line between adjacent items.
|
||||
- Compiler directives, attributes, and supported verbatim constructs keep their source text.
|
||||
|
||||
## Named styles
|
||||
|
||||
Choose a layout preset with `--style <NAME>`, `[format] style = "<NAME>"` in `lucisv.toml`, or `lucisv.format.style` in editors:
|
||||
|
||||
- `lucisv` (default): 2-space indent, 100 columns, one-per-line broken lists, cuddled `end else begin`.
|
||||
- `google`, `lowrisc`, `ansi`, `microsoft`, `nxp`: named presets in `vlog_formatter/src/style.rs` adjusting baseline indent/width and brace/port layout conventions.
|
||||
- `auto`: detects the preset a file already resembles most closely while preserving explicit `indent` / `line-length` settings.
|
||||
|
||||
An explicit `indent` or `line-length` always wins over the chosen style's baseline.
|
||||
|
||||
## UVM utilities indentation
|
||||
|
||||
To indent field macros inside UVM utilities blocks one additional level:
|
||||
@@ -25,14 +35,12 @@ To indent field macros inside UVM utilities blocks one additional level:
|
||||
uvm-utils-indent = true
|
||||
```
|
||||
|
||||
This v0.49.0 option is off by default. It applies to `uvm_field_*` macros
|
||||
This option is off by default. It applies to `uvm_field_*` macros
|
||||
between `uvm_*_utils_begin` and `uvm_*_utils_end`. In editors,
|
||||
`lucisv.format.uvmUtilsIndent` is the fallback; project configuration wins.
|
||||
Short, comment-free enum bodies already fit on one line without another key.
|
||||
|
||||
After toggling this option, run the CLI with `--no-cache` or remove its format
|
||||
cache: v0.49.0 does not include this option in the cache key. See
|
||||
[configuration](/start/configuration/#cache).
|
||||
Both `uvm-utils-indent` and `style` participate in the CLI format cache key (since
|
||||
v0.50.0 and v0.65.5); see [configuration](/start/configuration/#cache).
|
||||
|
||||
## Alignment is inferred
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ lucisv check --output-format json rtl/
|
||||
|
||||
`--select` replaces the default set with a comma-separated list. It can be repeated. `--ignore` then removes rules from the selected or default set. Both accept rule names and the severity classes `error`, `warning`, and `style` (for example, `--ignore style`). Both can also be written in `lucisv.toml` under a `[lint]` table (`select = [...]`, `ignore = [...]`), which a command-line flag overrides key by key, and in an editor as `lucisv.lint.select` / `lucisv.lint.ignore`.
|
||||
|
||||
The semantic rules — `unused-signal`, `undriven-net`, `multiply-driven` — run by default wherever lucisv can see the other files of your project (`lucisv check rtl/`, or the language server), because it can then tell that another file reads a signal through a hierarchical path. Over a **single file** or a stdin buffer there is nothing to ask, so they are off and must be `--select`ed.
|
||||
The semantic rules — `unused-signal`, `undriven-net`, `multiply-driven`, `undeclared-identifier`, `unknown-port`, and `unknown-parameter` — run by default wherever lucisv can see the other files of your project (`lucisv check rtl/`, or the language server), because it can then tell what another file declares or reads. Over a **single file** or a stdin buffer there is nothing to ask, so they are off and must be `--select`ed.
|
||||
|
||||
## Fixes
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ Some constructs are recognized structurally but emitted with their internal sour
|
||||
|
||||
## Not supported
|
||||
|
||||
Parser acceptance does not imply full elaboration or semantic navigation: generate-block-scoped hierarchical paths and DPI-export name binding remain gaps. lucisv also does not run a preprocessor, so a file that becomes valid only after cross-file macro expansion may not format as a standalone input.
|
||||
Parser acceptance does not imply full elaboration or semantic navigation: interface-port and virtual-interface hierarchical paths into generate blocks and DPI-export name binding remain gaps (top-rooted and module generate-block paths are supported). lucisv also does not run a preprocessor, so a file that becomes valid only after cross-file macro expansion may not format as a standalone input.
|
||||
|
||||
:::caution[Safe failure]
|
||||
Whole-file formatting returns an error and writes nothing when parsing is incomplete. lucisv never emits a partially understood file.
|
||||
|
||||
@@ -50,8 +50,8 @@ hero:
|
||||
|
||||
<div class="metric-row">
|
||||
<div class="metric"><strong>99.3%</strong><span>measured corpus parse rate</span></div>
|
||||
<div class="metric"><strong>17</strong><span>built-in lint rules</span></div>
|
||||
<div class="metric"><strong>2</strong><span>portable binaries</span></div>
|
||||
<div class="metric"><strong>74</strong><span>built-in lint rules</span></div>
|
||||
<div class="metric"><strong>3</strong><span>portable binaries</span></div>
|
||||
<div class="metric"><strong>0</strong><span>runtime dependencies</span></div>
|
||||
</div>
|
||||
|
||||
@@ -84,7 +84,7 @@ Formatting, diagnostics, and code intelligence share one parser and one semantic
|
||||
<a class="capability-card" href="/reference/rules/">
|
||||
<span class="capability-icon">△</span><span class="eyebrow">Diagnose</span>
|
||||
<h3>RTL-aware, project-aware lint</h3>
|
||||
<p>Seventeen focused rules, safe fixes, source waivers, and semantic checks that understand the whole workspace.</p>
|
||||
<p>74 rules, safe fixes, source waivers, and semantic checks that understand the whole workspace.</p>
|
||||
</a>
|
||||
<a class="capability-card wide" href="/reference/language-tools/#workspace-lifecycle">
|
||||
<span class="capability-icon">▱</span><span class="eyebrow">Workspace</span>
|
||||
|
||||
@@ -10,13 +10,14 @@ lucisv follows the same separation of concerns that makes ruff fast and maintain
|
||||
| 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 |
|
||||
| `vlog_formatter` | document IR, width-aware printer, formatting rules, fences, ranges, verification | CLI, language server, and MCP server |
|
||||
| `vlog_linter` | rule registry, diagnostics, fixes, waiver engine | CLI, language server, and MCP server |
|
||||
| `vlog_semantic` | scopes, symbols, references, workspace units, external resolution | linter, refactors, language server, and MCP server |
|
||||
| `vlog_refactor` | rename/references, ports, imports, extract/inline module, instantiation planning | language server and MCP server |
|
||||
| `lucisv_core` | configuration, filelists, walking, exclusions, cache, atomic replacement | CLI, language server, MCP server, and 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 |
|
||||
| `lucisv_mcp` | Model Context Protocol stdio server, verified edits, `--read-only` mode | coding agents (Claude Code, Cursor, VS Code) |
|
||||
|
||||
## Data flow
|
||||
|
||||
@@ -30,7 +31,7 @@ lucisv follows the same separation of concerns that makes ruff fast and maintain
|
||||
<div><b>formatter</b>Document IR, layout, fences, verification.</div>
|
||||
<div><b>linter</b>Rules, waivers, applicability, fixes.</div>
|
||||
<div><b>refactor</b>Plans and non-overlapping workspace edits.</div>
|
||||
<div><b>LSP</b>Queries, diagnostics, navigation, UI actions.</div>
|
||||
<div><b>LSP / MCP</b>Queries, diagnostics, navigation, UI and agent tools.</div>
|
||||
</div>
|
||||
|
||||
## Execution paths and ownership
|
||||
@@ -47,55 +48,55 @@ lucisv follows the same separation of concerns that makes ruff fast and maintain
|
||||
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.
|
||||
- **Editor & MCP:** one ordered synchronous loop (`lucisv_server`) owns `Workspace`; open documents
|
||||
overlay disk facts. Scans publish index/include/completion batches together,
|
||||
while `server/ahead.rs` answers eligible read-only buffer requests and viewport
|
||||
colours mid-scan when preconditions hold and `after_scan` stages workspace-wide
|
||||
mutators until `scanning` completes. Closed-file facts persist under codec **22**,
|
||||
including package re-exports, tagged connection/hierarchical surfaces, `bind`
|
||||
connections, generate blocks, and top-rooted paths; `WorkspaceIndex::remove_file`
|
||||
tombstones removed entries without shifting live `FileId`s. `lucisv_mcp` composes
|
||||
the six reusable libraries directly over stdio (never `lucisv_server`), tracks
|
||||
disk timestamps cleanly (`Stamp::first_mono`), and implements `KnownFacts` on
|
||||
`Project`.
|
||||
|
||||
`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.
|
||||
locations. The CLI composes core, parser, formatter, and linter; both
|
||||
`lucisv_server` and `lucisv_mcp` compose all six libraries independently. Both
|
||||
linter and refactor use the formatter only in tests.
|
||||
External dependencies are confined to the CLI worker pool (`rayon`), the
|
||||
server's synchronous LSP/JSON stack (`lsp-server`, `lsp-types`, `serde`,
|
||||
`serde_json`), and MCP JSON handling (`serde`, `serde_json`).
|
||||
|
||||
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/`.
|
||||
server/editor setting names. Source modules are split by grammar and runtime domain
|
||||
under `parser/`, `ast/`, `format/`, `bind/`, `workspace/`, `ports/`, `state/`,
|
||||
and `server/`.
|
||||
|
||||
## 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.50–0.60 retired the `uvm-utils-indent` format-cache omission (§2.9-34),
|
||||
closed `inline-module` transitive source selection (§2.9-33), moved `state.rs`
|
||||
into `state/` (TODO §55), added `bind` and hierarchical references, scoped
|
||||
rename warnings, generate-block label renames (codec 21), and shipped
|
||||
`lucisv-mcp` with a lean 9-tool catalogue and `--read-only` mode (5 tools).
|
||||
|
||||
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.61–0.66.2 delivered call hierarchy, References full-line views, top-rooted
|
||||
path resolution (codec **22**), selection/ranges formatting, 10-layer sticky
|
||||
scroll (blocks, `` `ifdef `` branches, and multi-line instantiations),
|
||||
`autoEnd` + instantiation highlighting, `tools/gates.sh` (`cross`), Linux CI,
|
||||
named formatter presets (`style`), localized incremental reindexing, ordered
|
||||
notifications, buffer-first `same_file` fast actions, and author stamps.
|
||||
|
||||
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](/reference/language-tools/#refactoring).
|
||||
|
||||
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](/start/configuration/#cache).
|
||||
This page reflects committed `df4e714`; Loop 2 is closed, with `state.rs`
|
||||
decomposition deferred to Loop 3.
|
||||
Rounds 1–3 (`69383ea`) further tightened UTF-8 / deterministic macro carrying and
|
||||
duplicate-unit rename guards (`refactor-correctness-r1`), versioned
|
||||
`DocumentChanges` edits and `after_scan` mutator staging (`server-ordering-r1`),
|
||||
tombstoned `didClose` removal and `(dev, ino)` symlink canonicalization
|
||||
(`index-lifecycle-r2`), and `KnownFacts`-cached `find_references_*` + future-mtime
|
||||
settlement + dir/glob `check` (`mcp-hardening-r3`).
|
||||
|
||||
## Design invariants
|
||||
|
||||
@@ -103,11 +104,11 @@ decomposition deferred to Loop 3.
|
||||
- **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.
|
||||
- **Shared answers:** CLI, editor, and MCP features call the same library APIs.
|
||||
- **Recoverable state:** caches are disposable; open buffers remain authoritative while an editor session is active.
|
||||
|
||||
## 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.
|
||||
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`. Platform packages bundle `lucisv`, `lucisv-server`, and `lucisv-mcp`. 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.
|
||||
|
||||
<!-- Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love, luciochen.com -->
|
||||
@@ -34,6 +34,7 @@ The subcommand is recognized only as the first argument. To format a file named
|
||||
| `--lines` | ranges | Format selected 1-based inclusive item ranges; repeatable |
|
||||
| `--line-length` | `40..400` | Override maximum line width |
|
||||
| `--indent` | `1..8` | Override indentation width |
|
||||
| `--style` | name | Layout preset (`lucisv`, `google`, `lowrisc`, `ansi`, `microsoft`, `nxp`, or `auto`) |
|
||||
| `--no-config` | — | Ignore `lucisv.toml` and `.lucisv.toml` |
|
||||
| `-h`, `--help` | — | Print help |
|
||||
| `-V`, `--version` | — | Print version |
|
||||
|
||||
@@ -14,11 +14,11 @@ The server speaks standard LSP over stdio. Features are derived from one in-memo
|
||||
| Tool | Protocol method | What it does |
|
||||
|---|---|---|
|
||||
| Document formatting | `textDocument/formatting` | Formats the full buffer with project/editor settings |
|
||||
| Range formatting | `textDocument/rangeFormatting` | Expands a selected range to formatter items |
|
||||
| Range formatting | `textDocument/rangeFormatting`, `textDocument/rangesFormatting` | Formats selected statement/item regions without touching the rest of the file |
|
||||
| On-type formatting | `textDocument/onTypeFormatting` | Formats after newline and semicolon triggers |
|
||||
| Format on save | `textDocument/willSaveWaitUntil` | Returns save-time edits when explicitly enabled |
|
||||
| Completion | `textDocument/completion` | Completes symbols and context-aware constructs |
|
||||
| Inline templates | `textDocument/inlineCompletion` | Offers structural ghost text for blocks and declarations |
|
||||
| Inline templates | `textDocument/inlineCompletion` | Offers structural ghost text for blocks, declarations, keywords (`end`), and indexed instantiations |
|
||||
| Signature help | `textDocument/signatureHelp` | Shows callable parameters at an argument position |
|
||||
| Linked editing | `textDocument/linkedEditingRange` | Keeps opening and closing labels synchronized |
|
||||
| Selection ranges | `textDocument/selectionRange` | Expands selection through syntax-tree boundaries |
|
||||
@@ -35,7 +35,7 @@ The server speaks standard LSP over stdio. Features are derived from one in-memo
|
||||
| Document symbols | `textDocument/documentSymbol` | Returns the hierarchical outline |
|
||||
| Workspace symbols | `workspace/symbol` | Searches indexed design units and members |
|
||||
| Document links | `textDocument/documentLink` | Makes resolvable `` `include`` paths clickable |
|
||||
| Folding ranges | `textDocument/foldingRange` | Folds modules, classes, blocks, lists, and regions |
|
||||
| Folding ranges | `textDocument/foldingRange` | Folds modules, classes, blocks, `` `ifdef ``/`` `else ``/`` `endif `` branches, multi-line instantiations, lists, and regions (sticky scroll) |
|
||||
| Inlay hints | `textDocument/inlayHint` | Annotates ordered connections and inferred context |
|
||||
| Code lens | `textDocument/codeLens` | Shows module instantiation counts and actions |
|
||||
| Call hierarchy prepare | `textDocument/prepareCallHierarchy` | Selects callable or instantiable hierarchy items |
|
||||
@@ -84,16 +84,23 @@ Inline-module accepts simple named connections to names or literals; it
|
||||
refuses `.*`, positional/expression or unconnected ports, output-to-literal
|
||||
connections, unsupported port types, generate, initial/final and
|
||||
macro/directive bodies. A hierarchical use found in its inputs also refuses
|
||||
the action. There is a known source-selection gap for uses through an
|
||||
intermediate module: a bench referencing `wrap.u_S.x` can be omitted when
|
||||
inlining `S`. Review those uses before applying the edit.
|
||||
the action (transitive uses through wrapper modules are included in source
|
||||
selection since v0.51.0).
|
||||
|
||||
The VS Code hierarchy also supports **Star as DUT**, **Unstar DUT** and
|
||||
**Clear DUTs**. Each DUT gets children and parents sections, followed by Other
|
||||
Modules. `lucisv.hierarchy.duts` unions team-configured names with workspace
|
||||
stars; configured names are locked in the menu. This view consumes the
|
||||
The VS Code hierarchy also supports **Star as DUT**, **Unstar DUT**,
|
||||
**Clear DUTs**, and current-file path highlighting (`lucisv.hierarchy.highlightCurrent`).
|
||||
Each DUT gets children and parents sections, followed by Other Modules.
|
||||
`lucisv.hierarchy.duts` unions team-configured names with workspace stars;
|
||||
configured names are locked in the menu. This view consumes the
|
||||
unchanged `lucisv/moduleHierarchy` snapshot; it adds no server protocol.
|
||||
|
||||
Buffer-local actions (`hover`, `definition`, `typeDefinition`, `documentHighlight`,
|
||||
`documentSymbol`, `foldingRange`, `selectionRange`, `linkedEditingRange`,
|
||||
`signatureHelp`, `prepareRename` for buffer-scoped names, and viewport
|
||||
semantic tokens) answer immediately during active background scans whenever
|
||||
buffer preconditions hold; cursor lookups immediately after an identifier's
|
||||
last character resolve the preceding name.
|
||||
|
||||
## Semantic presentation
|
||||
|
||||
| Tool | Protocol method | What it does |
|
||||
|
||||
@@ -9,10 +9,11 @@ description: Navigational index of the main public APIs in lucisv’s reusable R
|
||||
|
||||
This is a navigational API index, not source documentation. It summarizes the main public callable surface of the six reusable library crates in the workspace; command-line and language-server binaries are documented in their dedicated references.
|
||||
|
||||
This index reflects **v0.49.0**, reviewed at committed `df4e714`, including
|
||||
hierarchical member surfaces, import usage and module refactorings. For the complete signatures and fields,
|
||||
run `cargo doc --workspace --no-deps`; this hand-maintained index is not an
|
||||
exhaustive replacement for rustdoc. The parser's strict and tolerant entry
|
||||
This index reflects **v0.66.2** (through Round 3 at committed `69383ea`),
|
||||
including named formatter styles, selection formatting, codec-22 workspace facts,
|
||||
tombstone index removal, and cached `find_references_*` / home-set APIs. For the
|
||||
complete signatures and fields, run `cargo doc --workspace --no-deps`; this
|
||||
hand-maintained index is not an exhaustive replacement for rustdoc. The parser's strict and tolerant entry
|
||||
points share one grammar; tolerant errors do not imply formatter acceptance.
|
||||
Any thread calling parsing, analysis, or formatting on deeply nested input
|
||||
must provide at least `vlog_parser::PARSE_STACK_SIZE` (16 MiB) of stack.
|
||||
@@ -66,11 +67,13 @@ The CLI and server configure their worker threads accordingly.
|
||||
|---|---|
|
||||
| `format_source` | Format a complete source string |
|
||||
| `format_range` | Format only items selected by line ranges |
|
||||
| `format_selection` | Format minimal enclosing statements/items for editor range selections |
|
||||
| `format_auto`, `resolve_style` | Detect and format using the file's closest layout preset (`style = "auto"`) |
|
||||
| `verify_equivalence` | Re-lex and compare normalized tokens, including comments |
|
||||
| `verify_convergence` | Confirm a second formatting pass is identical |
|
||||
|
||||
`Config` exposes `max_width`, `indent_width`, and `uvm_utils_indent` (default
|
||||
`false`, new in v0.49.0). Exhaustive struct literals must include the new field;
|
||||
`Config` exposes `max_width`, `indent_width`, `uvm_utils_indent`, `style`
|
||||
(`Style`), and `auto_style`, along with `Config::styled` and `Config::named`.
|
||||
`Config { max_width: 120, ..Config::default() }` keeps the other defaults.
|
||||
|
||||
### Document model and printer
|
||||
@@ -145,9 +148,9 @@ The CLI and server configure their worker threads accordingly.
|
||||
|
||||
| Function or type | Public methods |
|
||||
|---|---|
|
||||
| `WorkspaceIndex` | `build`, `files`, `path`, `file_id`, `units`, `member`, `members_of`, `members_of_chain`, `member_unit`, `member_in`, `hierarchical_declarations`, `members_of_chain_in`, `member_unit_in`, `instantiations_of`, `subclasses_of`, `base_of`, `instantiations`, `subclasses`, `facts_for`, `defines`, `find_define`, `references_to`, `references_are_ambiguous`, `files_spelling`, `files_mentioning`, `files_naming_in_macros`, `mentioned_outside`, `workspace_symbols`, `units_of`, `instantiable_units`, `counts`, `update_file`, `update_facts`, `absorb`, `remove_file`, `fingerprint` |
|
||||
| `WorkspaceIndex` | `build`, `files`, `live_files`, `path`, `file_id`, `units`, `member`, `members_of`, `members_of_chain`, `member_unit`, `member_in`, `hierarchical_declarations`, `members_of_chain_in`, `member_unit_in`, `reexported_packages`, `path_units_to`, `instantiations_of`, `subclasses_of`, `base_of`, `instantiations`, `subclasses`, `facts_for`, `defines`, `find_define`, `references_to`, `references_are_ambiguous`, `files_spelling`, `files_mentioning`, `files_naming_in_macros`, `mentioned_outside`, `workspace_symbols`, `symbols_named`, `units_of`, `instantiable_units`, `counts`, `table_sizes`, `update_file`, `update_facts`, `absorb`, `remove_file`, `fingerprint` |
|
||||
| `IndexBuilder` | `new`, `add_file`, `add_facts`, `finish` |
|
||||
| `FileFacts` | `of`, `from_analysis`, `words`, `macro_words`, `path`, `encode`, `decode` |
|
||||
| `FileFacts` | `of`, `analyzed`, `from_analysis`, `words`, `macro_words`, `path`, `declares_the_same`, `declared_names`, `encode`, `decode` |
|
||||
| `DefinitionKey` | `of` |
|
||||
| `resolve_external` | Resolve unresolved file references against a workspace index |
|
||||
| `ExternalTarget` | `defs`, `best` |
|
||||
@@ -157,13 +160,17 @@ The CLI and server configure their worker threads accordingly.
|
||||
|
||||
`Surface::{Connection, Hierarchical}` selects the existing interface view or
|
||||
the wider instance-tail view. Hierarchical reads add nets, variables and nested
|
||||
instances without making them legal named port connections.
|
||||
instances without making them legal named port connections. `remove_file`
|
||||
tombstones slots without shifting live `FileId`s (use `live_files()` rather than
|
||||
indexing `0..files().len()`); `absorb` compacts tombstones and `fingerprint`
|
||||
remaps dense IDs cleanly.
|
||||
|
||||
`FACTS_FORMAT` is **19** in this snapshot. Cached facts include
|
||||
normal/macro identifier censuses, package re-export edges (the `RX` group),
|
||||
and declaration/reference surface tags; `Def::lines.positions` can carry `DeclPositions` with UTF-16 ranges
|
||||
for file-scope declarations. Any persisted shape or fact-census change needs
|
||||
a codec-version decision so stale caches cannot silently omit answers.
|
||||
`FACTS_FORMAT` is **22** in this snapshot. Cached facts include
|
||||
normal/macro identifier censuses, package re-export edges (`RX`), declaration/reference
|
||||
surface tags, `bind` target connections (`20`), generate-block scopes (`21`),
|
||||
and top-rooted paths (`22`); `Def::lines.positions` can carry `DeclPositions` with
|
||||
UTF-16 ranges for file-scope declarations. Any persisted shape or fact-census
|
||||
change needs a codec-version decision so stale caches cannot silently omit answers.
|
||||
|
||||
### Import usage
|
||||
|
||||
@@ -185,9 +192,11 @@ conservative.
|
||||
|---|---|
|
||||
| `prepare_rename` | Validate a cursor target and return its editable identity |
|
||||
| `prepare_rename_here` | Validate a target from one parsed file before workspace fan-out |
|
||||
| `rename_preflight` | Pure single-buffer refusal preflight |
|
||||
| `rename_name_at` | Return the spelling used to bound workspace rename inputs |
|
||||
| `rename` | Plan local or workspace-aware rename edits |
|
||||
| `find_references` | Collect local and cross-file reference locations |
|
||||
| `rename`, `rename_traced`, `rename_traced_with` | Plan local or workspace-aware rename edits, optionally with traces and `&dyn KnownFacts` |
|
||||
| `find_references`, `find_references_with`, `find_references_batch`, `find_references_batch_with` | Collect local and cross-file reference locations (single or batched, optionally reusing `&dyn KnownFacts`) |
|
||||
| `home_set`, `home_set_for`, `home_sets_for`, `after_dot` | Scope home-set membership (with includes and `bind`) and dotted-spelling checks |
|
||||
|
||||
### Ports and instantiation
|
||||
|
||||
@@ -198,9 +207,9 @@ conservative.
|
||||
| `add_port` | Add a port to a module interface |
|
||||
| `remove_port` | Remove a port from a module interface |
|
||||
| `propagate_ports` | Carry interface changes through instantiations |
|
||||
| `port_actions` | Discover valid port refactors at a cursor |
|
||||
| `port_actions`, `port_offers`, `port_offers_in` | Discover valid port refactors and parsed-buffer offers at a cursor |
|
||||
| `may_have_port_action` | Cheaply preflight whether port actions are possible |
|
||||
| `port_action_modules` | Return module names that bound a port action's workspace inputs |
|
||||
| `port_action_modules`, `port_action_modules_in` | Return module names that bound a port action's workspace inputs |
|
||||
| `enclosing_module` | Return the module containing a cursor position |
|
||||
| `module_definition` | Find a unique indexed module definition |
|
||||
| `module_names` | Search indexed module names |
|
||||
@@ -215,17 +224,17 @@ conservative.
|
||||
| Function or type | Purpose |
|
||||
|---|---|
|
||||
| `organize_imports` | Remove unused imports, merge duplicates and sort a scope’s initial import run |
|
||||
| `organize_counts`, `organize_title`, `imported_packages`, `unused_imports` | Action preflight, labels, package source selection and unused-import ranges |
|
||||
| `extract_site`, `extract_title`, `extract_module` | Preflight selected module items, label the action and plan extraction |
|
||||
| `organize_counts`, `organize_title`, `organize_offer`, `organize_offer_in`, `imported_packages`, `imported_packages_in`, `unused_imports` | Action preflight, labels, offers, package source selection and unused-import ranges |
|
||||
| `extract_site`, `extract_site_in`, `extract_title`, `extract_module` | Preflight selected module items, label the action and plan extraction |
|
||||
| `ExtractSite`, `Home` | Extraction source requirements and destination choice |
|
||||
| `inline_site`, `inline_title`, `inline_module` | Preflight an instance, label the action and plan body substitution |
|
||||
| `inline_site`, `inline_site_in`, `inline_title`, `inline_module` | Preflight an instance, label the action and plan body substitution |
|
||||
| `InlineSite` | Instance/module identities used to gather inline inputs |
|
||||
|
||||
Apply a `RefactorEdit` as one complete operation. Each path in `created` also
|
||||
has one offset-zero insertion in `edits`; create those files before applying
|
||||
text edits. Engines do no I/O. Callers must supply every file needed for edits
|
||||
and refusal checks; current inline source-selection and verifier limits are
|
||||
recorded in the repository topology, handshakes 32–33.
|
||||
and refusal checks; the remaining refactor verifier gap is recorded in the
|
||||
repository topology, handshake 32 (handshake 33 closed in v0.51.0).
|
||||
|
||||
## `lucisv_core`
|
||||
|
||||
@@ -233,17 +242,18 @@ recorded in the repository topology, handshakes 32–33.
|
||||
|
||||
| Function or type | Public methods |
|
||||
|---|---|
|
||||
| `config::parse` | Parse strict lucisv configuration text |
|
||||
| `config::parse`, `STYLE_NAMES` | Parse strict lucisv configuration text and validate `[format] style` names |
|
||||
| `Discovery` | `new`, `for_input`, `for_file`, `for_dir` |
|
||||
| `filelist::read` | Resolve a nested EDA filelist |
|
||||
| `walk::collect_files` | Walk inputs with ignores, exclusions and directory-cycle detection; accepts a `FnMut(Warning)` sink for recoverable failures |
|
||||
| `walk::collect_files`, `collect_files_with`, `collect_files_tracked`, `collect_files_below`, `collect_files_below_tracked` | Walk inputs with ignores, exclusions, sizes, and `DirectoryTracker` cycle/identity dedup (`DirId`, `dir_id`); accepts a `FnMut(Warning)` sink for recoverable failures |
|
||||
| `walk::is_excluded` | Test a path against exclusion patterns |
|
||||
|
||||
### Atomic writes and cache
|
||||
### Atomic writes, diffs, and cache
|
||||
|
||||
| Function or type | Public methods |
|
||||
|---|---|
|
||||
| `atomic::write_atomic` | Replace contents using an exclusively created per-operation temp file; concurrent replacements publish one whole buffer, last writer wins |
|
||||
| `diff::unified` | Render a unified diff between original and updated source text |
|
||||
| `content_hash` | Compute the cache’s FNV-1a content fingerprint |
|
||||
| `Cache` | `load`, `disabled`, `is_clean`, `record`, `store` |
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ exclude = ["*_gen.sv", "build"]
|
||||
filelist = "rtl/files.f"
|
||||
|
||||
[format]
|
||||
style = "lucisv"
|
||||
uvm-utils-indent = false
|
||||
|
||||
[lint]
|
||||
@@ -32,6 +33,7 @@ style_regex = "[a-z_0-9]+"
|
||||
| Key | Type | Default | Valid values | Used by |
|
||||
|---|---|---:|---|---|
|
||||
| `line-length` | integer | `100` | `40..400` | CLI and server |
|
||||
| `[format].style` | string | `"lucisv"` | `lucisv`, `google`, `lowrisc`, `ansi`, `microsoft`, `nxp`, or `auto` | CLI, MCP, and server |
|
||||
| `[format].uvm-utils-indent` | boolean | `false` | indent the `` `uvm_field_* `` macros between `` `uvm_*_utils_begin `` and `` `uvm_*_utils_end `` one level | CLI and server |
|
||||
| `indent` | integer | `2` | `1..8` | CLI and server |
|
||||
| `exclude` | string array | `[]` | path patterns | CLI walk and server index |
|
||||
@@ -67,16 +69,27 @@ Unknown keys, out-of-range numbers, invalid values, tables other than `[format]`
|
||||
| Setting | Default | Purpose |
|
||||
|---|---:|---|
|
||||
| `lucisv.serverPath` | `lucisv-server` | Executable name or absolute path |
|
||||
| `lucisv.mcp.enabled` | `true` | Register `lucisv-mcp` with VS Code agent mode |
|
||||
| `lucisv.mcp.path` | `""` | Override the `lucisv-mcp` executable path |
|
||||
| `lucisv.mcp.mode` | `"full"` | MCP tool mode (`"full"` or `"read-only"`) |
|
||||
| `lucisv.verbose` | `false` | Log request and lifecycle timing; changing it restarts the server |
|
||||
| `lucisv.references.fullLineView` | `true` | Show full trimmed source lines in the Lucisv References tree view |
|
||||
| `lucisv.rainbowBeginEnd` | `true` | Color matching block delimiters by depth |
|
||||
| `lucisv.commentKeywords.builtIn` | `true` | Highlight built-in keywords (`TODO`, `FIXME`, `FIX_ME`, `TBD`) in comments |
|
||||
| `lucisv.commentKeywords.custom` | `[]` | Additional comment keywords to highlight |
|
||||
| `lucisv.commentKeywords.caseSensitive` | `true` | Match comment keywords case-sensitively |
|
||||
| `lucisv.inlineTemplates` | `true` | Offer structural ghost-text completions |
|
||||
| `lucisv.inlineInstantiation` | `true` | Offer indexed module instantiation ghost text |
|
||||
| `lucisv.inlineKeywords` | `true` | Offer structural keyword ghost text (for example `end`) |
|
||||
| `lucisv.autoEnd` | `true` | Automatically insert the closing `end` when pressing Enter after `begin` |
|
||||
| `lucisv.formatOnSave` | `false` | Server-driven save formatting for clients that need it |
|
||||
| `lucisv.format.style` | `"lucisv"` | Named formatter layout (`lucisv`, `google`, `lowrisc`, `ansi`, `microsoft`, `nxp`, or `auto`); `lucisv.toml` outranks it |
|
||||
| `lucisv.format.uvmUtilsIndent` | `false` | The editor's spelling of `[format] uvm-utils-indent`; a checked-in `lucisv.toml` outranks it |
|
||||
| `lucisv.lineLength` | `null` | Editor fallback for maximum width |
|
||||
| `lucisv.indent` | `null` | Editor fallback for indentation |
|
||||
| `lucisv.exclude` | `[]` | Extra workspace index exclusions |
|
||||
| `lucisv.hierarchy.duts` | `[]` | DUT module names in the VS Code hierarchy; union with saved workspace stars, locked in the menu |
|
||||
| `lucisv.hierarchy.highlightCurrent` | `true` | Highlight the open file's module and ancestor path in the Hierarchy view |
|
||||
| `lucisv.filelist` | `""` | Filelist that defines the workspace index |
|
||||
| `lucisv.index.scope` | `folder` | Index the configured folder or widen to the workspace |
|
||||
| `lucisv.index.scopeDepth` | `2` | Parent-directory depth used by folder-scope indexing |
|
||||
@@ -116,12 +129,8 @@ the fallback sentinel, so it does not clear a non-empty project selection.
|
||||
|
||||
## Cache
|
||||
|
||||
Successful “already formatted” verdicts are cached under `.lucisv_cache/`. Entries are keyed by file, content hash, line length, indentation, and lucisv version. Files that would change or fail are never cached. Use `--no-cache` to disable reads and writes or `--cache-dir` to relocate the store.
|
||||
Successful “already formatted” verdicts are cached under `.lucisv_cache/`. Entries are keyed by file, content hash, line length, indentation, `uvm-utils-indent`, named `style`, and lucisv version. Files that would change or fail are never cached. Use `--no-cache` to disable reads and writes or `--cache-dir` to relocate the store.
|
||||
|
||||
In **v0.49.0**, the cache key omits `uvm-utils-indent`. Changing that option
|
||||
alone can reuse an incorrect clean verdict, including in `--check` mode.
|
||||
After toggling it, use `--no-cache` or delete `.lucisv_cache/` (or your custom
|
||||
cache directory) before formatting or checking again. Editor formatting does
|
||||
not use this CLI format cache.
|
||||
`uvm-utils-indent` joined the cache key in v0.50.0 and `style` joined in v0.65.5; stores from older versions are safely ignored and rebuilt automatically. Editor formatting does not use this CLI format cache.
|
||||
|
||||
<!-- Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love, luciochen.com -->
|
||||
@@ -5,16 +5,17 @@ description: Install lucisv, format your first SystemVerilog file, add linting t
|
||||
|
||||
<!-- Author: Guoliang Chen, a Senior Digital Design Engineer -->
|
||||
|
||||
lucisv ships as two executables: `lucisv` for the command line and `lucisv-server` for editors. Both are built from the same release and use the same parser, configuration, and formatting rules.
|
||||
lucisv ships as three executables: `lucisv` for the command line, `lucisv-server` for editors, and `lucisv-mcp` for coding agents. All three are built from the same release and use the same parser, semantic index, configuration, and formatting rules.
|
||||
|
||||
## Install
|
||||
|
||||
Download the release archive for macOS, Linux, or Windows, verify it against `SHA256SUMS`, and place both binaries on your `PATH`. To build from source instead:
|
||||
Download the release archive for macOS, Linux, or Windows, verify it against `SHA256SUMS`, and place the binaries on your `PATH`. To build from source instead:
|
||||
|
||||
```bash
|
||||
cargo build --release
|
||||
cp target/release/lucisv ~/.local/bin/
|
||||
cp target/release/lucisv-server ~/.local/bin/
|
||||
cp target/release/lucisv-mcp ~/.local/bin/
|
||||
```
|
||||
|
||||
Confirm the installation:
|
||||
@@ -68,6 +69,6 @@ An exit code of `1` means formatting changes or lint findings are present. `2` m
|
||||
- **Neovim 0.11+:** configure `lucisv-server` with filetypes `verilog` and `systemverilog`.
|
||||
- **Other LSP clients:** launch `lucisv-server` over standard input/output.
|
||||
|
||||
Continue with [Editors & LSP](/guides/editors/) for settings and the complete capability index.
|
||||
Continue with [Editors & LSP](/guides/editors/) for settings and the complete capability index, or [Agents (MCP)](/guides/agents/) to connect `lucisv-mcp` to Claude Code, Cursor, or VS Code agent mode.
|
||||
|
||||
<!-- Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love, luciochen.com -->
|
||||
Reference in new issue
Block a user