Rename the tool to lucisv (Language Utility for Coding In SystemVerilog)
This commit is contained in:
1 parent
a284e33110
commit
eeaffafd56
188 files changed
+2825
-2802
No files matched your search
@@ -2,22 +2,22 @@
|
||||
|
||||
## Goal
|
||||
|
||||
Teach vfmt the EDA world's own project file. A `.f` filelist — one source
|
||||
Teach lucisv the EDA world's own project file. A `.f` filelist — one source
|
||||
path per line, `-f` nesting, `+incdir+`, `+define+`, comments and `$VAR`
|
||||
expansion — is what every Verilog build already has, so it is the honest
|
||||
answer to rope's `.ropeproject`: when a project has one, it defines
|
||||
*exactly* the set of files the server indexes, and the guesswork of walking
|
||||
a workspace folder disappears. This is M1 of
|
||||
`docs/features/refactor/README.md`: the parser lives in `vfmt_core` (next
|
||||
`docs/features/refactor/README.md`: the parser lives in `lucisv_core` (next
|
||||
to config and walk, so a future CLI `-f` reuses it unchanged), the scope
|
||||
precedence lives in `vfmt_server`, and the two front doors that name a
|
||||
filelist are a `filelist` key in `vfmt.toml` and the VS Code setting
|
||||
`vfmt.filelist`.
|
||||
precedence lives in `lucisv_server`, and the two front doors that name a
|
||||
filelist are a `filelist` key in `lucisv.toml` and the VS Code setting
|
||||
`lucisv.filelist`.
|
||||
|
||||
## Assumptions
|
||||
|
||||
- **The filelist is a *scope*, not a build description.** M1 recorded
|
||||
`+incdir+` and `+define+` and used neither: vfmt does not preprocess, so
|
||||
`+incdir+` and `+define+` and used neither: lucisv does not preprocess, so
|
||||
an include path and a macro value change nothing about what the index
|
||||
contains. They were parsed anyway because a filelist that silently dropped
|
||||
them would have to be re-parsed later, and because "unknown flag" warnings
|
||||
@@ -38,7 +38,7 @@ filelist are a `filelist` key in `vfmt.toml` and the VS Code setting
|
||||
itself was named relatively) so the index sees one spelling per file.
|
||||
Symlinks are deliberately **not** resolved, matching
|
||||
`config-discovery`'s "lexical, not symlink-aware" rule.
|
||||
- **An unknown flag is skipped alone, not with its argument.** vfmt has no
|
||||
- **An unknown flag is skipped alone, not with its argument.** lucisv has no
|
||||
table of which EDA flags take a value, and inventing one would be a
|
||||
guess. So `-y lib/` warns about `-y` and then reports `lib/` as a missing
|
||||
source file (a directory is not a file). Two warnings for one line is
|
||||
@@ -69,13 +69,13 @@ filelist are a `filelist` key in `vfmt.toml` and the VS Code setting
|
||||
- **Reading a filelist is I/O the server does on every index rebuild.** No
|
||||
caching, no watching: `rebuild_index` already re-reads the whole workspace
|
||||
on save, and one extra small file is nothing next to that.
|
||||
- **`vfmt.toml`'s `filelist` value is a path, not a glob.** It is resolved
|
||||
- **`lucisv.toml`'s `filelist` value is a path, not a glob.** It is resolved
|
||||
against the config file's own directory when the config is loaded, so the
|
||||
`FileConfig` a caller receives already carries a usable path.
|
||||
|
||||
## Handshakes
|
||||
|
||||
### `vfmt_core::filelist` (new module)
|
||||
### `lucisv_core::filelist` (new module)
|
||||
|
||||
```rust
|
||||
pub const MAX_NESTING_DEPTH: usize = 256; // how deep `-f` may nest
|
||||
@@ -97,18 +97,18 @@ variable, a repeated filelist, a chain nested past `MAX_NESTING_DEPTH`) is a
|
||||
warning on an otherwise usable result. `read` neither panics nor aborts: on
|
||||
any input, including an adversarial one, it returns.
|
||||
|
||||
### `vfmt_core::config`
|
||||
### `lucisv_core::config`
|
||||
|
||||
`FileConfig` gains `filelist: Option<PathBuf>`, from the new `vfmt.toml` key
|
||||
`FileConfig` gains `filelist: Option<PathBuf>`, from the new `lucisv.toml` key
|
||||
`filelist = "path"`. `parse` records the path **as written** (it has no idea
|
||||
where the file lives); `Discovery` resolves it against the config file's
|
||||
directory, so every `FileConfig` handed out by `Discovery` carries a
|
||||
resolved path. Same strictness as the other keys: a non-string value, a
|
||||
duplicate, or any unknown key is still a hard error naming file and line.
|
||||
|
||||
### `vfmt_server`
|
||||
### `lucisv_server`
|
||||
|
||||
- `ClientSettings` gains `filelist: Option<String>` from `vfmt.filelist`.
|
||||
- `ClientSettings` gains `filelist: Option<String>` from `lucisv.filelist`.
|
||||
An empty string means "unset", which is what the VS Code default is.
|
||||
- `Workspace::set_client_settings` now returns `true` for a `filelist`
|
||||
change as well as an `exclude` change — both change *which files exist*.
|
||||
@@ -126,7 +126,7 @@ Highest first, resolved on every index rebuild:
|
||||
|
||||
| # | Scope | When |
|
||||
|---|---|---|
|
||||
| 1 | The files a **filelist** names | `vfmt.filelist` is set (absolute, or relative to the first workspace root), else the workspace root's `vfmt.toml` has a `filelist` key |
|
||||
| 1 | The files a **filelist** names | `lucisv.filelist` is set (absolute, or relative to the first workspace root), else the workspace root's `lucisv.toml` has a `filelist` key |
|
||||
| 2 | The **workspace-folder walk** | there is a workspace root — unchanged from before this feature |
|
||||
| 3 | Each **open file's own directory**, non-recursive | there is no workspace root at all (a single file opened) |
|
||||
|
||||
@@ -138,41 +138,41 @@ index.
|
||||
|
||||
### `editors/vscode`
|
||||
|
||||
New setting `vfmt.filelist` (string, default `""`), forwarded by the
|
||||
existing `synchronize.configurationSection: 'vfmt'` machinery — no
|
||||
New setting `lucisv.filelist` (string, default `""`), forwarded by the
|
||||
existing `synchronize.configurationSection: 'lucisv'` machinery — no
|
||||
extension code change.
|
||||
|
||||
## Status / TODO
|
||||
|
||||
- [x] `crates/vfmt_core/src/filelist.rs`: parser + `Filelist` + `read`
|
||||
- [x] `crates/lucisv_core/src/filelist.rs`: parser + `Filelist` + `read`
|
||||
- [x] comments (`//`, `#`), blank lines, `-f` nesting with cycle/repeat
|
||||
detection and a 256-level depth limit, `+incdir+` (multi-`+`),
|
||||
`+define+NAME[=VAL]` (multi-`+`),
|
||||
`$VAR`/`${VAR}` expansion, unknown `+arg`/`-flag` warnings, missing
|
||||
files warned and skipped, relative resolution against the naming
|
||||
filelist
|
||||
- [x] `vfmt.toml` key `filelist`, resolved against the config's directory
|
||||
- [x] `vfmt.filelist` client setting, and the rescan it forces
|
||||
- [x] `lucisv.toml` key `filelist`, resolved against the config's directory
|
||||
- [x] `lucisv.filelist` client setting, and the rescan it forces
|
||||
- [x] Server scope ladder (filelist ⊃ workspace walk ⊃ open-file directory)
|
||||
with warnings surfaced once per rebuild
|
||||
- [x] `vfmt.filelist` in `editors/vscode/package.json` + README; root
|
||||
- [x] `lucisv.filelist` in `editors/vscode/package.json` + README; root
|
||||
README config and editor sections
|
||||
- [x] Unit tests in `vfmt_core` and `vfmt_server`; `cargo fmt`, `cargo
|
||||
- [x] Unit tests in `lucisv_core` and `lucisv_server`; `cargo fmt`, `cargo
|
||||
clippy --all-targets`, `cargo test` all clean
|
||||
- [x] ~~Not done, deliberately: the CLI does not consume `filelist` yet
|
||||
(M1 is config-level plumbing plus the server; a `vfmt -f` flag is its
|
||||
(M1 is config-level plumbing plus the server; a `lucisv -f` flag is its
|
||||
own change with its own exit-code questions).~~ **M13** is that change:
|
||||
`vfmt -f project.f` reuses `read` unchanged and answers the exit-code
|
||||
`lucisv -f project.f` reuses `read` unchanged and answers the exit-code
|
||||
questions this line predicted (warnings never move the exit code, an
|
||||
unreadable root filelist is exit 2) —
|
||||
`docs/features/cli-filelist/README.md`. The `vfmt.toml` **key** is still
|
||||
`docs/features/cli-filelist/README.md`. The `lucisv.toml` **key** is still
|
||||
read by the server only, now on purpose rather than for want of a flag.
|
||||
- [x] ~~Not done, deliberately: `+incdir+`/`+define+` feed nothing.~~
|
||||
`` `include`` resolution arrived in M10 and consumes `Filelist::incdirs`
|
||||
unchanged, exactly as this line predicted — resolved, in filelist order,
|
||||
nested `-f` incdirs flattened in place
|
||||
(`docs/features/include-nav/README.md`). `+define+` still feeds
|
||||
nothing: vfmt does not preprocess.
|
||||
nothing: lucisv does not preprocess.
|
||||
- [ ] Not done, deliberately: no file watching. The filelist is re-read on
|
||||
every index rebuild (save, settings change, open with no root).
|
||||
|
||||
@@ -218,13 +218,13 @@ editor setting. Decisions worth recording:
|
||||
**Files touched outside the brief's scope**, all forced by the new field and
|
||||
kept to the minimum:
|
||||
|
||||
- `crates/vfmt/src/args.rs` — two `FileConfig`/help edits. Adding a public
|
||||
- `crates/lucisv/src/args.rs` — two `FileConfig`/help edits. Adding a public
|
||||
field breaks every struct literal, so the two test literals became
|
||||
`..Default::default()`; and `--help`'s CONFIGURATION paragraph lists the
|
||||
recognized keys by name, which would have been a lie the moment the parser
|
||||
accepted a fourth. The new line says `filelist` is read by `vfmt-server`
|
||||
accepted a fourth. The new line says `filelist` is read by `lucisv-server`
|
||||
only, so nobody expects the CLI to act on it.
|
||||
- `crates/vfmt_server/src/format.rs` — the same struct-literal fix in two
|
||||
- `crates/lucisv_server/src/format.rs` — the same struct-literal fix in two
|
||||
tests. No behavior in that module changed.
|
||||
|
||||
**Deviations from the brief.** Two, both narrowing:
|
||||
@@ -241,19 +241,19 @@ kept to the minimum:
|
||||
|
||||
Also noted and **not** touched, being outside this feature's scope: the
|
||||
root `README.md`'s editor section still says "the server does **not** read
|
||||
`vfmt.toml` yet", which the `editor-settings` feature already made false.
|
||||
`lucisv.toml` yet", which the `editor-settings` feature already made false.
|
||||
Flagged for the lead rather than fixed here. (The neighbouring sentence
|
||||
"One setting, `vfmt.serverPath`" *was* rewritten, because this feature adds
|
||||
"One setting, `lucisv.serverPath`" *was* rewritten, because this feature adds
|
||||
a setting and leaving a count that is now wrong by three would have been
|
||||
worse than the one-line edit.)
|
||||
|
||||
**Verification.** `cargo fmt --all -- --check` clean; `cargo clippy
|
||||
--all-targets` silent; `cargo test --workspace` green — 1007 tests, of
|
||||
which 34 are new: 23 in `vfmt_core` (20 `filelist` + 3 `config`), 9 in
|
||||
`vfmt_server` (2 `settings`, 7 `state`) and 2 e2e sessions against the real
|
||||
which 34 are new: 23 in `lucisv_core` (20 `filelist` + 3 `config`), 9 in
|
||||
`lucisv_server` (2 `settings`, 7 `state`) and 2 e2e sessions against the real
|
||||
binary (a filelist pushed, narrowed and broken mid-session; a file opened
|
||||
with no workspace folder). `node editors/vscode/smoke.js
|
||||
target/debug/vfmt-server` OK, `node --check` on both JS files, and
|
||||
target/debug/lucisv-server` OK, `node --check` on both JS files, and
|
||||
`package.json` parses.
|
||||
|
||||
### 2026-08-24 — dev agent, QA round 1 fixes
|
||||
@@ -295,7 +295,7 @@ exactly QA's reproduction. Restored the constant and the file; the probe
|
||||
test is not in the tree.
|
||||
|
||||
**Re-verified on the real binary, as QA asked.** Built
|
||||
`target/release/vfmt-server`, gave it a scratch workspace whose `vfmt.toml`
|
||||
`target/release/lucisv-server`, gave it a scratch workspace whose `lucisv.toml`
|
||||
names a 20 000-level chain, and drove a raw stdio LSP session
|
||||
(`initialize` + `workspace/symbol` + `shutdown`/`exit`): exit code 0, both
|
||||
requests answered, the package declared in the chain found in the index, and
|
||||
@@ -314,7 +314,7 @@ work log above.
|
||||
|
||||
**Gates after the fix.** `cargo fmt --all -- --check` clean, `cargo clippy
|
||||
--all-targets` silent, `cargo test --workspace` green — 1008 tests (one new
|
||||
regression test), `vfmt_core` at 69 unit tests.
|
||||
regression test), `lucisv_core` at 69 unit tests.
|
||||
|
||||
## QA log
|
||||
|
||||
@@ -323,8 +323,8 @@ regression test), `vfmt_core` at 69 unit tests.
|
||||
**Verification of the dev's claims.** `cargo fmt --all -- --check` clean,
|
||||
`cargo clippy --all-targets --workspace` silent, `cargo test --workspace`
|
||||
green — 1007 tests, matching the Work log's count exactly. Built
|
||||
`target/debug/vfmt-server` and `target/release/vfmt-server` and ran `node
|
||||
editors/vscode/smoke.js target/debug/vfmt-server` — OK. `node --check` on
|
||||
`target/debug/lucisv-server` and `target/release/lucisv-server` and ran `node
|
||||
editors/vscode/smoke.js target/debug/lucisv-server` — OK. `node --check` on
|
||||
`editors/vscode/extension.js` and `smoke.js`, and `package.json` parses as
|
||||
JSON. Read `filelist.rs`, the `config.rs` diff, `state.rs`, `server.rs` and
|
||||
`settings.rs` in full; every claim in the Handshakes/Status sections checks
|
||||
@@ -336,11 +336,11 @@ in any changed file (`grep` over the diffs and over `filelist.rs`), no
|
||||
comments (`Filelist`, `read`, the new `FileConfig::filelist`,
|
||||
`ClientSettings::filelist`, `Workspace::has_roots`, etc.).
|
||||
|
||||
**Adversarial testing.** Built a throwaway `vfmt_core` example (`cargo run -p
|
||||
vfmt_core --example <probe>`, deleted afterwards — not committed) to drive
|
||||
**Adversarial testing.** Built a throwaway `lucisv_core` example (`cargo run -p
|
||||
lucisv_core --example <probe>`, deleted afterwards — not committed) to drive
|
||||
`filelist::read` directly, plus a small Node script driving the real
|
||||
`vfmt-server` binary over stdio the way `smoke.js` does, against a
|
||||
`vfmt.toml`-configured filelist. Tried: a filelist that `-f`s itself, two
|
||||
`lucisv-server` binary over stdio the way `smoke.js` does, against a
|
||||
`lucisv.toml`-configured filelist. Tried: a filelist that `-f`s itself, two
|
||||
filelists that `-f` each other, `-f` with no argument, a bare `+define+`
|
||||
line, `+define+N=a=b`, an unterminated `${VAR`, CRLF line endings, a path
|
||||
naming a directory, an empty filelist, a path containing a space, a `$` alone
|
||||
@@ -376,8 +376,8 @@ ones. A straight chain of uniquely-named filelists, each `-f`-ing the next
|
||||
aborting` (SIGABRT) once it's deep enough:
|
||||
- `filelist::read` alone: overflows around 1500–3000 levels in a debug
|
||||
build, and somewhere between 10 000 and 30 000 in `--release`.
|
||||
- The **real `target/release/vfmt-server` binary**, given a workspace
|
||||
whose `vfmt.toml` names such a filelist, crashes the same way on
|
||||
- The **real `target/release/lucisv-server` binary**, given a workspace
|
||||
whose `lucisv.toml` names such a filelist, crashes the same way on
|
||||
`initialize` (confirmed via a raw stdio LSP session): `closed: code=null
|
||||
signal=SIGABRT`. This takes down the whole language-server process for
|
||||
every open file, not just a diagnostic on one buffer.
|
||||
@@ -404,7 +404,7 @@ aborting` (SIGABRT) once it's deep enough:
|
||||
|
||||
**Finding 2 (Low) — no quoting, so a path containing a space cannot be
|
||||
listed.** The tokenizer is `raw.split_whitespace()`
|
||||
(`crates/vfmt_core/src/filelist.rs:76`); a filelist line like `sp ace/file.sv`
|
||||
(`crates/lucisv_core/src/filelist.rs:76`); a filelist line like `sp ace/file.sv`
|
||||
splits into two tokens and neither resolves, producing two spurious
|
||||
"no such file" warnings instead of one correct entry. Real EDA tools vary
|
||||
here (some support `"quoted paths"`, some don't support spaces at all), so
|
||||
@@ -441,7 +441,7 @@ worklist) to `Reader::nested`/`Reader::filelist` before this ships, with a
|
||||
masked-corruption-style regression test pinning that a filelist nested
|
||||
past the guard still returns a usable `Filelist` with a warning rather than
|
||||
aborting — and re-run the same deep-chain probe against the real
|
||||
`vfmt-server` binary as part of that fix's verification, since that's where
|
||||
`lucisv-server` binary as part of that fix's verification, since that's where
|
||||
the failure is actually user-visible.
|
||||
|
||||
## Review
|
||||
|
||||
Reference in new issue
Block a user