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,21 +2,21 @@
|
||||
|
||||
## Goal
|
||||
|
||||
Expose the three keys `vfmt.toml` supports — `line-length`, `indent`,
|
||||
`exclude` — as VS Code settings (`vfmt.lineLength`, `vfmt.indent`,
|
||||
`vfmt.exclude`), for the users who asked for them: people with no config file
|
||||
Expose the three keys `lucisv.toml` supports — `line-length`, `indent`,
|
||||
`exclude` — as VS Code settings (`lucisv.lineLength`, `lucisv.indent`,
|
||||
`lucisv.exclude`), for the users who asked for them: people with no config file
|
||||
checked into the tree, who until now could set the indent only by accident
|
||||
(VS Code's `tabSize` leaked in through `FormattingOptions`) and could not set
|
||||
a line length **at all**, because LSP carries no line-length option. The
|
||||
settings are transported by `workspace/didChangeConfiguration`, validated at
|
||||
the server, and folded in one rung below a `vfmt.toml` — which stays
|
||||
the server, and folded in one rung below a `lucisv.toml` — which stays
|
||||
authoritative, so a project that checks one in keeps exactly one source of
|
||||
truth and format-on-save cannot drift from CI's `vfmt --check`.
|
||||
truth and format-on-save cannot drift from CI's `lucisv --check`.
|
||||
|
||||
## Assumptions
|
||||
|
||||
- **`vfmt.toml` has exactly three keys, and that is the whole surface.**
|
||||
`vfmt_core::config::parse_entry` accepts `line-length`, `indent` and
|
||||
- **`lucisv.toml` has exactly three keys, and that is the whole surface.**
|
||||
`lucisv_core::config::parse_entry` accepts `line-length`, `indent` and
|
||||
`exclude` and rejects everything else by name. Rule selection
|
||||
(`--select`/`--ignore`) has no config key yet, so there is nothing to expose
|
||||
for the linter; when it grows one, it grows a setting here in the same shape.
|
||||
@@ -31,13 +31,13 @@ truth and format-on-save cannot drift from CI's `vfmt --check`.
|
||||
all dropped, leaving that rung silent. Same philosophy as the existing
|
||||
`tabSize` guard: honouring half of a nonsensical request is worse than
|
||||
ignoring it.
|
||||
- **The accepted ranges must match `vfmt.toml`'s.** A value has to be exactly
|
||||
- **The accepted ranges must match `lucisv.toml`'s.** A value has to be exactly
|
||||
as acceptable from the settings UI as it is in a config file, or the two
|
||||
front ends would disagree about what is valid. `vfmt_core` exports no
|
||||
front ends would disagree about what is valid. `lucisv_core` exports no
|
||||
constant for its bounds, so `settings.rs` copies them **and**
|
||||
`the_accepted_ranges_are_the_ones_vfmt_toml_accepts` checks the copy against
|
||||
the real parser (`vfmt_core::config::parse`) rather than against another
|
||||
hard-coded number. If a range ever widens in `vfmt_core`, that test fails.
|
||||
`the_accepted_ranges_are_the_ones_lucisv_toml_accepts` checks the copy against
|
||||
the real parser (`lucisv_core::config::parse`) rather than against another
|
||||
hard-coded number. If a range ever widens in `lucisv_core`, that test fails.
|
||||
- **Only `exclude` can invalidate anything.** `lineLength` and `indent` are
|
||||
read afresh by every formatting request, so a change to them needs no cache
|
||||
work at all. `exclude` changes which files exist as far as the workspace
|
||||
@@ -45,9 +45,9 @@ truth and format-on-save cannot drift from CI's `vfmt --check`.
|
||||
- **A non-integral number cannot arrive from VS Code.** JavaScript serializes
|
||||
`4.0` as `4`, so `serde_json`'s `as_u64` rejecting fractions costs nothing
|
||||
real; there is no "close enough" case worth forgiving.
|
||||
- **The `vfmt.exclude` patterns are matched by the same engine as the
|
||||
- **The `lucisv.exclude` patterns are matched by the same engine as the
|
||||
config's.** They are appended to the same `Vec<String>` that reaches
|
||||
`vfmt_core::walk::collect_files`, so the glob syntax, the trailing-component
|
||||
`lucisv_core::walk::collect_files`, so the glob syntax, the trailing-component
|
||||
matching and the `.gitignore` interaction are whatever the CLI already does.
|
||||
An empty-string pattern is harmless (`walk::matches` returns false for one),
|
||||
so it is not filtered out.
|
||||
@@ -57,13 +57,13 @@ truth and format-on-save cannot drift from CI's `vfmt --check`.
|
||||
### The precedence ladder (the contract this feature is)
|
||||
|
||||
Highest first. Each rung applies only where every rung above it is silent, and
|
||||
**each key climbs independently** — a `vfmt.toml` naming only `indent` leaves
|
||||
`vfmt.lineLength` in charge of the width.
|
||||
**each key climbs independently** — a `lucisv.toml` naming only `indent` leaves
|
||||
`lucisv.lineLength` in charge of the width.
|
||||
|
||||
| # | Source | Why here |
|
||||
|---|---|---|
|
||||
| 1 | `vfmt.toml` | The project speaking. Must stay authoritative or format-on-save disagrees with `vfmt --check` in CI — the divergence that lifting the config into `vfmt_core` exists to remove. |
|
||||
| 2 | `vfmt.lineLength` / `vfmt.indent` | Typed on purpose into a settings UI, so more deliberate than a tab size — but it is one user's editor, and the repository outranks it. |
|
||||
| 1 | `lucisv.toml` | The project speaking. Must stay authoritative or format-on-save disagrees with `lucisv --check` in CI — the divergence that lifting the config into `lucisv_core` exists to remove. |
|
||||
| 2 | `lucisv.lineLength` / `lucisv.indent` | Typed on purpose into a settings UI, so more deliberate than a tab size — but it is one user's editor, and the repository outranks it. |
|
||||
| 3 | `FormattingOptions::tab_size` | Sent on every request whether or not the user ever chose it (it is the editor's default, or its guess from the file). The weakest thing that is still a signal. |
|
||||
| 4 | Built-in defaults | indent 2, width 100. |
|
||||
|
||||
@@ -75,7 +75,7 @@ Two paths use a shortened ladder, and both are unchanged in spirit:
|
||||
discover a config from. Such a buffer therefore honours rung 2 now, where
|
||||
before it had only the tab size.
|
||||
|
||||
A **broken** `vfmt.toml` contributes nothing at all (as before), so rung 2 is
|
||||
A **broken** `lucisv.toml` contributes nothing at all (as before), so rung 2 is
|
||||
what answers under it — the user still gets the warning, and still gets their
|
||||
settings.
|
||||
|
||||
@@ -84,10 +84,10 @@ settings.
|
||||
Consumed: `workspace/didChangeConfiguration`, whose `settings` field carries
|
||||
|
||||
```json
|
||||
{ "settings": { "vfmt": { "lineLength": 120, "indent": 4, "exclude": ["vendor"] } } }
|
||||
{ "settings": { "lucisv": { "lineLength": 120, "indent": 4, "exclude": ["vendor"] } } }
|
||||
```
|
||||
|
||||
`settings.rs::from_payload` reads `settings.vfmt` and nothing else. A payload
|
||||
`settings.rs::from_payload` reads `settings.lucisv` and nothing else. A payload
|
||||
without that section — including the `{"settings": null}` form — means "no
|
||||
opinion about anything" and resets every key. Keys may be absent, `null`, or
|
||||
garbage; each is dropped independently.
|
||||
@@ -101,18 +101,18 @@ with an unconditional `this.onDidChangeConfiguration(section, undefined)` —
|
||||
with `event === undefined` the `affectsConfiguration` filter is skipped, so
|
||||
**the notification is sent immediately at startup** as well as on every later
|
||||
change. No `initializationOptions` fallback is needed, and none was added.
|
||||
`extractSettingsInformation(['vfmt'])` calls
|
||||
`workspace.getConfiguration(undefined).get('vfmt')`, which returns the whole
|
||||
`extractSettingsInformation(['lucisv'])` calls
|
||||
`workspace.getConfiguration(undefined).get('lucisv')`, which returns the whole
|
||||
section with every key at its effective value — so the server sees
|
||||
`serverPath` and `rainbowBeginEnd` in the payload too, and ignores them.
|
||||
|
||||
Other editors: anything that can send `workspace/didChangeConfiguration` with
|
||||
that `settings` shape works. Neovim's `vim.lsp.config` sends its `settings`
|
||||
table verbatim, so `settings = { vfmt = { indent = 4 } }` is the whole setup.
|
||||
table verbatim, so `settings = { lucisv = { indent = 4 } }` is the whole setup.
|
||||
|
||||
### Within the server
|
||||
|
||||
- **Consumed from `vfmt_core`:** `config::parse` (in a test, to pin the
|
||||
- **Consumed from `lucisv_core`:** `config::parse` (in a test, to pin the
|
||||
ranges), `config::FileConfig`, `walk::collect_files`'s `exclude` parameter.
|
||||
- **Promised to `state.rs`:** `Workspace::client_settings()` and
|
||||
`set_client_settings()`, the latter returning `true` exactly when the caller
|
||||
@@ -125,12 +125,12 @@ table verbatim, so `settings = { vfmt = { indent = 4 } }` is the whole setup.
|
||||
`format::config_from(file, client, options)`.
|
||||
|
||||
**Request to the lead (outside this feature's scope, unchanged from M2/M3):**
|
||||
`docs/features/vfmt-server/README.md` and `TODO.md` §6 still understate the
|
||||
server (`documentHighlight`, the missing-closer diagnostics, `vfmt/scopePairs`,
|
||||
`docs/features/lucisv-server/README.md` and `TODO.md` §6 still understate the
|
||||
server (`documentHighlight`, the missing-closer diagnostics, `lucisv/scopePairs`,
|
||||
and now these settings). Separately,
|
||||
`docs/features/editor-packaging/README.md`'s *What was deliberately left out*
|
||||
table has a row reading "Settings beyond `serverPath` — formatter options
|
||||
belong in `vfmt.toml`, one source of truth", which this feature supersedes: the
|
||||
belong in `lucisv.toml`, one source of truth", which this feature supersedes: the
|
||||
one-source-of-truth rule is now enforced by *precedence* rather than by absence.
|
||||
`editors/vscode/README.md` said the same thing and was updated here, because
|
||||
this feature owns that file's settings table.
|
||||
@@ -143,7 +143,7 @@ this feature owns that file's settings table.
|
||||
- [x] Folded into `settings_for` / `config_from` / `indent_width`.
|
||||
- [x] `exclude` appended to the workspace scan's excludes; a change rebuilds
|
||||
the index and republishes.
|
||||
- [x] `extension.js` `synchronize.configurationSection: 'vfmt'`; initial-push
|
||||
- [x] `extension.js` `synchronize.configurationSection: 'lucisv'`; initial-push
|
||||
behaviour verified against the library source.
|
||||
- [x] Three settings in `package.json` with schema bounds.
|
||||
- [x] `editors/vscode/README.md` settings table and precedence ladder.
|
||||
@@ -151,18 +151,18 @@ this feature owns that file's settings table.
|
||||
change (e2e), untitled buffers, `smoke.js`.
|
||||
- [ ] Not done, deliberately: no per-language or per-folder override
|
||||
(`[verilog]`-scoped settings). VS Code resolves those per resource, and
|
||||
the server holds one workspace-wide `ClientSettings`; a `vfmt.toml` is
|
||||
the server holds one workspace-wide `ClientSettings`; a `lucisv.toml` is
|
||||
the per-directory mechanism and it already works.
|
||||
- [ ] Not done, deliberately: no `workspace/configuration` *pull*. The push
|
||||
arrives at startup and on every change, which is all that is needed;
|
||||
pulling would add a request per document to answer the same question.
|
||||
- [ ] Not done, deliberately: no setting for lint rule selection — there is no
|
||||
`vfmt.toml` key for it yet, and inventing one here would put the editor
|
||||
`lucisv.toml` key for it yet, and inventing one here would put the editor
|
||||
ahead of the CLI.
|
||||
|
||||
## Work log
|
||||
|
||||
### 2026-08-24 — M4: `vfmt.toml`'s three keys as VS Code settings
|
||||
### 2026-08-24 — M4: `lucisv.toml`'s three keys as VS Code settings
|
||||
|
||||
**The thing that had to be checked first.** The plan said to verify, not
|
||||
assume, whether `[email protected]`'s `synchronize` emits an initial
|
||||
@@ -189,18 +189,18 @@ left to rot.
|
||||
|
||||
**Two decisions worth recording.**
|
||||
|
||||
1. *Settings sit below `vfmt.toml`, not above.* This is the opposite of the
|
||||
1. *Settings sit below `lucisv.toml`, not above.* This is the opposite of the
|
||||
CLI's flag-beats-config order, and it is the same call `settings_for`
|
||||
already made for `tabSize`, for the same reason: a CLI flag is typed for one
|
||||
run, while an editor setting persists silently and belongs to one machine.
|
||||
If a `vfmt.lineLength` of 80 could override a project's `line-length = 120`,
|
||||
If a `lucisv.lineLength` of 80 could override a project's `line-length = 120`,
|
||||
every save would reflow files that CI then rejects. Pinned by
|
||||
`rung_1_a_config_file_beats_a_pushed_setting`.
|
||||
2. *Ranges are checked against the real config parser.* Copying `40..=400` and
|
||||
`1..=8` into `settings.rs` is a duplication hazard —`vfmt_core` exports no
|
||||
`1..=8` into `settings.rs` is a duplication hazard —`lucisv_core` exports no
|
||||
constant, and CLAUDE.md says not to reach into another module for this
|
||||
feature's convenience. Rather than leave the copy unguarded, the test asks
|
||||
`vfmt_core::config::parse` whether each edge is accepted. That is strictly
|
||||
`lucisv_core::config::parse` whether each edge is accepted. That is strictly
|
||||
better than a shared constant would have been: it tests the behaviour, not
|
||||
the number.
|
||||
|
||||
@@ -213,7 +213,7 @@ left to rot.
|
||||
asserts the text actually reflows, not just that a number was stored.
|
||||
- `settings.rs` — the exact VS Code payload shape at its defaults (must be "no
|
||||
opinion"), out-of-range numbers, wrong types, a non-array `exclude`, a mixed
|
||||
array, a payload with no `vfmt` section, `settings: null`, and the range
|
||||
array, a payload with no `lucisv` section, `settings: null`, and the range
|
||||
cross-check above.
|
||||
- `state.rs` — a pushed `exclude` hiding a file from the index; **appended, not
|
||||
substituted**, so a user's setting cannot put the project's vendored code
|
||||
@@ -242,7 +242,7 @@ it was conditioned on came back negative-for-need (the library does push).
|
||||
|
||||
**Verification.** `cargo fmt --all` clean, `cargo clippy --all-targets` clean,
|
||||
`cargo test --workspace` green, `node smoke.js` against a freshly built
|
||||
`target/debug/vfmt-server` OK, `npx @vscode/vsce ls` still accepts the
|
||||
`target/debug/lucisv-server` OK, `npx @vscode/vsce ls` still accepts the
|
||||
manifest, `node --check` on both JS files.
|
||||
|
||||
## QA log
|
||||
@@ -261,16 +261,16 @@ everything through `aa26e5e` already QA'd). Verified `settings.rs`,
|
||||
named is present and passes: toml-names-indent-only + settings-names-lineLength-
|
||||
only (`each_key_climbs_the_ladder_independently`); settings-indent vs. differing
|
||||
tabSize (`rung_2_a_pushed_setting_beats_the_editors_tab_size`); a broken
|
||||
`vfmt.toml` falls through to the pushed settings (rung 2), not straight to
|
||||
`lucisv.toml` falls through to the pushed settings (rung 2), not straight to
|
||||
default — pinned by `format.rs:499` and **documented**, not just tested: the
|
||||
Handshakes section states it explicitly ("A broken `vfmt.toml` contributes
|
||||
Handshakes section states it explicitly ("A broken `lucisv.toml` contributes
|
||||
nothing at all... so rung 2 is what answers under it"). No undocumented hole
|
||||
found.
|
||||
|
||||
**2. Validation hostility.** Every value the charter listed (indent 0, 9, -1,
|
||||
400.5-equivalent via 4.5, "4" string; lineLength 39, 401, 39.9-equivalent;
|
||||
exclude as a string, exclude with non-string entries; `settings: null`; missing
|
||||
`vfmt` section; extra unknown keys) is covered in `settings.rs`'s unit tests.
|
||||
`lucisv` section; extra unknown keys) is covered in `settings.rs`'s unit tests.
|
||||
Went further and hand-drove the **built binary** (not just unit tests) with a
|
||||
script sending all of the above plus `indent: 400.5`, `lineLength: 39.9`,
|
||||
`exclude: [1,2,3]`, a `params` with no `settings` key at all, and a payload
|
||||
@@ -287,7 +287,7 @@ not just `from_payload`).
|
||||
and the "only exclude triggers rescan" contract.
|
||||
|
||||
**Finding (non-blocking, test-coverage gap):**
|
||||
`crates/vfmt_server/tests/e2e.rs:690-746`
|
||||
`crates/lucisv_server/tests/e2e.rs:690-746`
|
||||
(`a_pushed_exclude_rebuilds_the_index_mid_session`) opens **no document** — it
|
||||
only drives `workspace/symbol` queries before/after the exclude push. That
|
||||
proves the *scan* half of `reindex()` (`server.rs:319-324`) ran, but nothing in
|
||||
@@ -327,17 +327,17 @@ languageclient/package.json`). `SyncConfigurationFeature.initialize()` (line
|
||||
`this.onDidChangeConfiguration(data.registerOptions.section, undefined)` —
|
||||
the `event === undefined` case skips the `affectsConfiguration` filter, so the
|
||||
notification is sent immediately. Confirmed: the dev's claim is accurate, and
|
||||
so is the wire shape claim — `extractSettingsInformation(['vfmt'])`
|
||||
(line 174-207) calls `workspace.getConfiguration(undefined).get('vfmt')` and
|
||||
wraps it under `result.vfmt`, i.e. exactly `{settings: {vfmt: {...every
|
||||
so is the wire shape claim — `extractSettingsInformation(['lucisv'])`
|
||||
(line 174-207) calls `workspace.getConfiguration(undefined).get('lucisv')` and
|
||||
wraps it under `result.lucisv`, i.e. exactly `{settings: {lucisv: {...every
|
||||
declared key at its effective value...}}}`, matching `settings.rs`'s
|
||||
`vscode_payload()` test helper and the README's documented shape.
|
||||
`extension.js`'s `synchronize: { configurationSection: 'vfmt' }` and
|
||||
`package.json`'s three new properties are all spelled `vfmt.lineLength` /
|
||||
`vfmt.indent` / `vfmt.exclude` — the prefix matches. No mismatch found.
|
||||
`extension.js`'s `synchronize: { configurationSection: 'lucisv' }` and
|
||||
`package.json`'s three new properties are all spelled `lucisv.lineLength` /
|
||||
`lucisv.indent` / `lucisv.exclude` — the prefix matches. No mismatch found.
|
||||
|
||||
**5. smoke.js.** Built fresh with `cargo build -p vfmt_server`, ran
|
||||
`node smoke.js ../../target/debug/vfmt-server` — OK. Mutation-checked the
|
||||
**5. smoke.js.** Built fresh with `cargo build -p lucisv_server`, ran
|
||||
`node smoke.js ../../target/debug/lucisv-server` — OK. Mutation-checked the
|
||||
pushed-indent assertion: changed `indent: 4` to `indent: 2` in the
|
||||
`didChangeConfiguration` push, reran — got a clean `FAIL` reporting the
|
||||
2-space (tabSize) output instead of 4-space, confirming the assertion is live;
|
||||
@@ -345,11 +345,11 @@ restored the edit and reran — `OK` again, and `md5sum` before/after the
|
||||
round-trip matched byte-for-byte (`a33792c93538b89b8d64debe117f2ab1`).
|
||||
|
||||
**6. Untitled buffers.** `format.rs`'s
|
||||
`an_untitled_buffer_honours_pushed_settings` pins both `vfmt.indent` and
|
||||
`vfmt.lineLength` applying with no path and no toml. Confirmed.
|
||||
`an_untitled_buffer_honours_pushed_settings` pins both `lucisv.indent` and
|
||||
`lucisv.lineLength` applying with no path and no toml. Confirmed.
|
||||
|
||||
**7. Invariants.**
|
||||
- `cargo test --workspace`: all green, including `vfmt_server`'s 190 unit + 9
|
||||
- `cargo test --workspace`: all green, including `lucisv_server`'s 190 unit + 9
|
||||
e2e (matches the work log's claimed counts).
|
||||
- `cargo fmt --all -- --check`: clean.
|
||||
- `cargo clippy --all-targets`: clean (touched `settings.rs` to force a
|
||||
@@ -363,10 +363,10 @@ round-trip matched byte-for-byte (`a33792c93538b89b8d64debe117f2ab1`).
|
||||
`#[cfg(test)]` marker).
|
||||
- package.json schema bounds (`minimum`/`maximum` 40/400 and 1/8) cross-checked
|
||||
against `settings.rs`'s `LINE_LENGTH_RANGE`/`INDENT_RANGE` and against
|
||||
`vfmt_core::config::parse_entry` (`crates/vfmt_core/src/config.rs:56-57`,
|
||||
`lucisv_core::config::parse_entry` (`crates/lucisv_core/src/config.rs:56-57`,
|
||||
which is the real source of truth) — all three agree.
|
||||
- Cross-checked the "exclude append mirrors the CLI" claim in Assumptions
|
||||
against `crates/vfmt/src/args.rs:103-107` (`exclude_with`) — the CLI does
|
||||
against `crates/lucisv/src/args.rs:103-107` (`exclude_with`) — the CLI does
|
||||
extend its own `--exclude` with the config's, same append-not-replace
|
||||
pattern. Accurate.
|
||||
|
||||
@@ -383,14 +383,14 @@ to close a documented required test, not a functional defect.
|
||||
Read `settings.rs` in full plus the `format.rs`, `server.rs`, `state.rs`
|
||||
and `extension.js` diffs. Approved and committed. Notes:
|
||||
|
||||
- Settings-below-`vfmt.toml` is the right call and the rewritten
|
||||
- Settings-below-`lucisv.toml` is the right call and the rewritten
|
||||
`settings_for` ladder doc states it well; the
|
||||
`the_accepted_ranges_are_the_ones_vfmt_toml_accepts` test (asking the
|
||||
`the_accepted_ranges_are_the_ones_lucisv_toml_accepts` test (asking the
|
||||
real parser about the copied bounds) is a pattern worth reusing.
|
||||
- QA's non-blocking finding stands: the exclude e2e proves the rescan but
|
||||
not the republish half of `reindex()`. Functionally moot today (nothing
|
||||
in `diagnostics::all` reads the index), so accepted as-is; the next
|
||||
round touching `e2e.rs` should close it per QA's suggested fix.
|
||||
- `extractSettingsInformation` sending the whole `vfmt` section (so the
|
||||
- `extractSettingsInformation` sending the whole `lucisv` section (so the
|
||||
server sees and ignores `serverPath`/`rainbowBeginEnd`) is correctly
|
||||
mirrored in the tests' payload shape rather than an idealized one.
|
||||
Reference in new issue
Block a user