editor-packaging: a minimal VS Code extension (41-line plain JS on
vscode-languageclient =9.0.1, one setting vfmt.serverPath, languages
verilog/systemverilog) with a zero-dependency smoke.js that validates
the extension's exact spawn contract against the real binary, plus
Neovim/Vim/coc setup docs (including the load-bearing
vim.filetype.add — Vim maps *.v by content heuristic and *.vh not at
all). Everything headless-validatable was validated: the .vsix
builds, smoke passes with negative controls, npm ci reproduces.
vfmt-core-lift: config.rs and walk.rs moved to a new std-only
vfmt_core crate as byte-identical 100% renames (CLI suite untouched,
corpus TSV md5 equal from HEAD and lifted builds). The LSP server
now discovers vfmt.toml per document with precedence config > client
tabSize > built-in default (an editor default is not a deliberate
override), warns once per document change on a broken config while
formatting with defaults, and scans the workspace with the lifted
gitignore-aware walk. QA drove every claim live over stdio.
With these, every TODO §6 item is delivered: spans, tolerant
parsing, define table, single-file semantics, workspace index, the
server, and both editors. Lead trued up the caveats this round made
stale across five documents.
Dev: 2 Opus agents; QA: 2 Sonnet agents; reviews in
docs/features/{editor-packaging,vfmt-core-lift}/README.md.
Co-Authored-By: Claude Fable 5 <[email protected]>
483 lines
30 KiB
Markdown
483 lines
30 KiB
Markdown
# editor-packaging
|
|
|
|
## Goal
|
|
|
|
`vfmt-server` has been a running binary since round 11, but a binary nobody can
|
|
launch from an editor is a demo. This round closes TODO.md §6's last
|
|
non-deferred item: a **minimal VS Code extension** that registers the
|
|
Verilog/SystemVerilog file types and starts the server, and **documented
|
|
Vim/Neovim configuration** that does the same with no plugin at all. The
|
|
governing constraint is TODO.md §6's own sentence — *"no editor-specific logic
|
|
below the protocol layer"* — read in the other direction: no *language* logic
|
|
above it either. Every feature a user sees comes from the server, so this
|
|
feature ships one 41-line JavaScript file, one setting, two markdown guides,
|
|
and a dependency-free smoke test that proves the extension's spawn contract
|
|
matches the binary's reality without opening an editor.
|
|
|
|
## Assumptions
|
|
|
|
- **VS Code has no built-in generic LSP client.** `vscode.lsp` does not exist;
|
|
the editor's own extensions (and ruff's, and rust-analyzer's) all use
|
|
`vscode-languageclient`. Writing a client by hand means re-implementing
|
|
`Content-Length` framing, document sync, capability negotiation and edit
|
|
application inside a JavaScript file — strictly more code and strictly more
|
|
bugs than the dependency. Justification for the dependency is its own section
|
|
below, per CLAUDE.md.
|
|
- **JavaScript, not TypeScript**, so there is no build step: what is in
|
|
`editors/vscode/` is what runs. At 41 lines the type checking buys nothing
|
|
that reading the file does not.
|
|
- **The server takes no arguments and no environment.** `main.rs` parses no
|
|
argv; the entire contract is "spawn it, speak LSP on stdin/stdout". If that
|
|
ever changes, `smoke.js` and `extension.js` must change together — that is
|
|
exactly the pairing `smoke.js` exists to police.
|
|
- **`.v`/`.vh` are `verilog`, `.sv`/`.svh` are `systemverilog`.** These are the
|
|
language ids the Verilog ecosystem already uses (and the ones the server's
|
|
own e2e test sends). Files whose extension VS Code has given to another
|
|
extension keep that extension's language id; the setup note in
|
|
`editors/vscode/README.md` covers the collision.
|
|
- **The user builds the binary.** No download, no bundled executable, no
|
|
version check between extension and server. `cargo build --release` and a
|
|
`PATH` entry, or an absolute `vfmt.serverPath`. A version handshake would be
|
|
worth adding the day a released extension can meet an older server; today
|
|
they come out of the same working tree.
|
|
- **Marketplace publishing is out of scope**, as is CI packaging. `publisher`
|
|
is the literal string `REPLACE-ME`: packaging a `.vsix` and installing it
|
|
locally works with a placeholder, `vsce publish` does not, and inventing a
|
|
publisher id nobody owns would be worse than an obvious placeholder.
|
|
|
|
## What was deliberately left out
|
|
|
|
Each of these is a thing a VS Code extension usually has. Each was considered
|
|
and dropped, because the brief and CLAUDE.md's "simplicity first" both point
|
|
the same way:
|
|
|
|
| Not shipped | Why |
|
|
|---|---|
|
|
| TextMate grammar | The server ships `semanticTokens` (14 types, `docs/features/vfmt-server/README.md`). A grammar would be a second, worse highlighter to keep in sync. |
|
|
| `language-configuration.json` | Comment/bracket rules are the smallest useful thing here, and still a judgement call about Verilog syntax living in the editor layer. The brief says "declare the language only"; if `Ctrl+/` proves painful, this is the first thing to add back — 12 lines, no dependency. |
|
|
| Commands (restart server, show logs) | The language client already contributes a restart command and an output channel. |
|
|
| Status bar item | State the user can already see in the Output panel. |
|
|
| Settings beyond `serverPath` | Formatter options belong in `vfmt.toml`, one source of truth for the CLI and the editor. (The caveat that once lived here — "the server does not read it yet" — was closed by vfmt-core-lift; lead trued up all three doc locations at review.) |
|
|
| Bundling (esbuild/webpack) | `vsce` warns about the 166 JavaScript files in the dependency; bundling would add a build step to a repo whose extension has none. 460 KB is not a problem worth a toolchain. |
|
|
| A Neovim plugin | The configuration *is* the integration. A plugin would only wrap `vim.lsp.config`. |
|
|
|
|
## The one dependency, and the justification CLAUDE.md asks for
|
|
|
|
| package | version | why not std, why not hand-rolled |
|
|
|---|---|---|
|
|
| `vscode-languageclient` | `9.0.1` (exact, no `^`) | Microsoft's own client library, maintained alongside the protocol spec and used by essentially every language extension including ruff's. It is the exact analog of `lsp-server`/`lsp-types` on the Rust side, and the reasoning is the same one `docs/features/vfmt-server/README.md` records for those: the alternative is hand-writing the wire format. Requires VS Code `^1.82.0`, which is `package.json`'s `engines.vscode`. |
|
|
|
|
Transitive cost, measured on this machine (`npm ls --all`): **8 packages
|
|
total** — `vscode-languageclient` plus `vscode-languageserver-protocol`,
|
|
`vscode-languageserver-types`, `vscode-jsonrpc` (the protocol proper, all four
|
|
from Microsoft), and `semver`, `minimatch`, `brace-expansion`,
|
|
`balanced-match`. No native modules, no install scripts. Packaged `.vsix`: 320
|
|
files, 462 KB.
|
|
|
|
Pinned exactly rather than with `^`, matching the workspace's Rust
|
|
dependencies: an extension that silently picks up a new client minor on the
|
|
next `npm install` is an extension whose bug reports cannot be reproduced.
|
|
|
|
## `smoke.js` — the validation that does not need an editor
|
|
|
|
The highest-value automated check here is not "does the extension render", it
|
|
is **does the extension's spawn contract match the binary's reality**. That
|
|
question is answerable in plain node:
|
|
|
|
`editors/vscode/smoke.js` spawns the server the way `extension.js` does — same
|
|
program, empty argument list, inherited `env`, the working directory as `cwd`,
|
|
stdio pipes — then writes a whole `initialize` → `initialized` → `didOpen` →
|
|
`shutdown` → `exit` session with hand-rolled `Content-Length` framing, reads
|
|
stdout, and asserts: the process exits 0, `initialize` returned capabilities,
|
|
four named capabilities are present, diagnostics were pushed for the opened
|
|
document, and `shutdown` was acknowledged without an error.
|
|
|
|
Three deliberate choices, all inherited from `crates/vfmt_server/tests/e2e.rs`:
|
|
|
|
- **The framing is hand-rolled.** A check that reused `vscode-jsonrpc` could
|
|
not catch a framing bug, and could not run before `npm install`.
|
|
- **The whole session is written before a byte is read.** The rationale is the
|
|
one in `tests/e2e.rs`'s own header, reinforced by the vfmt-server QA log's
|
|
hang investigation: interleaving reads and writes against a subprocess is how
|
|
a smoke test becomes an intermittent hang. The session is under 4 KB, well
|
|
inside a pipe buffer, and the server closes stdout on `exit`, so the read
|
|
terminates on its own. No timeouts, no reader thread, no deadlock.
|
|
- **`rootUri: null`, no `workspaceFolders`.** That is the single-file mode the
|
|
Neovim `single_file_support = true` claim depends on, so the smoke test
|
|
proves that claim as a side effect.
|
|
|
|
It is not a duplicate of `tests/e2e.rs`. That test proves the *server* works
|
|
and runs under `cargo test`; this one proves the *extension's launch
|
|
configuration* works, runs with zero dependencies at any point in the install
|
|
sequence, and is the thing to run when a user reports "nothing happens".
|
|
|
|
## Handshakes
|
|
|
|
**Consumed from `vfmt_server`** — and this is the whole interface, exactly as
|
|
that feature's README promised ("the editor packaging round will consume the
|
|
binary's name and its stdio contract, nothing else"):
|
|
|
|
1. Binary name `vfmt-server`, resolved on `PATH` by default.
|
|
2. No command-line arguments, no required environment.
|
|
3. LSP over stdin/stdout, `Content-Length` framing.
|
|
4. `initialize` succeeds with neither `workspaceFolders` nor `rootUri`
|
|
(single-file mode) — relied on by `single_file_support` in the Neovim config
|
|
and asserted by `smoke.js`.
|
|
5. The advertised capability set, which both editor guides describe and neither
|
|
editor extends: nothing is advertised client-side that the server does not
|
|
implement.
|
|
|
|
**Promised to `vfmt_server`:** the spawn contract above. If the server ever
|
|
grows a required flag, a subcommand, or a stdio mode switch, `extension.js` and
|
|
`smoke.js` change in the same round.
|
|
|
|
**Requested of other modules** — none blocking, none done here:
|
|
|
|
1. **`crates/vfmt`: lift `config.rs` into a library** (already filed by
|
|
`docs/features/vfmt-server/README.md`). Restated because it is now
|
|
*user-visible*: formatting from an editor ignores `vfmt.toml`, so a project
|
|
that sets `line-length = 120` gets 100-column formatting on save and
|
|
120-column formatting from the CLI — the two disagreeing on the same file.
|
|
Both editor guides state this caveat out loud rather than hide it, but the
|
|
fix is that lift.
|
|
2. **Repo root: no `LICENSE` file exists.** The root `Cargo.toml` and the
|
|
extension's `package.json` both declare MIT, but `vsce package` wants the
|
|
file and needs `--skip-license` without it. Adding one is a one-line repo
|
|
decision that is not this feature's to make; the flag is documented, with a
|
|
note to drop it once the file lands.
|
|
|
|
## Status / TODO
|
|
|
|
- [x] `editors/vscode/package.json` — language declarations, activation,
|
|
`vfmt.serverPath`, pinned `vscode-languageclient`.
|
|
- [x] `editors/vscode/extension.js` — 41 lines, plain JS, no build step.
|
|
- [x] `editors/vscode/smoke.js` — zero-dependency spawn-contract check.
|
|
- [x] `editors/vscode/README.md` — build, smoke, package, install,
|
|
troubleshooting.
|
|
- [x] `editors/vscode/.vscodeignore` / `.gitignore` — keep `smoke.js` out of
|
|
the `.vsix`, keep `node_modules/` and `*.vsix` out of git.
|
|
- [x] `editors/nvim/README.md` — `vim.lsp.config` (0.11+), `nvim-lspconfig`
|
|
(0.9/0.10), Vim 9 `vim-lsp` one-liner, coc.nvim.
|
|
- [x] Top-level `README.md` "Editor setup" section.
|
|
- [x] TODO.md §6 editor-packaging checkbox.
|
|
- [x] `smoke.js` run green against a release build.
|
|
- [x] `npm install` and `vsce package` run green on this machine.
|
|
- [ ] **Not done, and honestly untestable here:** the extension has never run
|
|
inside VS Code. `require('vscode')` resolves only in the extension host,
|
|
so the `activate` path cannot be exercised outside the editor and was not
|
|
claimed to be. See the Work log for exactly what *was* proven instead.
|
|
- [ ] **Not done:** the Neovim/Vim snippets were not executed — no `nvim` on
|
|
this machine (`vim` 9.1 is present but without `vim-lsp`). The server-side
|
|
assumptions they rest on were verified independently; see the Work log.
|
|
- [ ] **Not done, out of scope:** CI packaging, Marketplace publishing, a
|
|
version handshake between extension and server, bundling.
|
|
- [ ] **Follow-up, blocked on a concurrent round:** a `crates/vfmt_core` lift
|
|
(config + walk out of the `vfmt` binary) landed in the tree *while this
|
|
round was being written*, and `crates/vfmt_server` already depends on it.
|
|
If that closes the "the server does not read `vfmt.toml`" gap, the caveat
|
|
must be deleted from **three** places: `README.md`'s Editor setup
|
|
section, `editors/vscode/README.md` (Settings), and
|
|
`editors/nvim/README.md` ("What you get"). Left in place here because it
|
|
was true of the binary this round tested and I do not claim behavior I
|
|
have not run.
|
|
|
|
## Work log
|
|
|
|
### 2026-08-19 — dev agent
|
|
|
|
- Read `CLAUDE.md`, `README.md`, TODO.md §6 and
|
|
`docs/features/vfmt-server/README.md` (all of it, including the QA log) before
|
|
writing anything. Two things from that reading changed the work: the server's
|
|
**staleness model** and its **`vfmt.toml` blindness** are user-visible
|
|
behaviors, so both editor guides state them plainly instead of letting a user
|
|
discover them as bugs; and the QA log's hang investigation settled `smoke.js`'s
|
|
I/O shape before I wrote a line of it.
|
|
- **Did not touch `crates/`.** The one thing this feature wanted from another
|
|
module — config discovery — was already an open Handshake from the
|
|
vfmt-server round, so it is restated here with its now-visible user
|
|
consequence rather than fixed.
|
|
- **`vscode-languageclient` was taken, and the reasoning is written down.** The
|
|
brief floated a zero-dependency client; VS Code has no built-in generic LSP
|
|
API, so that would mean hand-writing framing, sync and capability handling in
|
|
JavaScript — the thing CLAUDE.md's `lsp-server` justification already
|
|
rejected on the Rust side. Pinned exactly (`9.0.1`, not `^9.0.1`) to match
|
|
the workspace's `=`-pinned Rust deps. Cost measured, not assumed: 8 packages,
|
|
no native modules, no install scripts.
|
|
- **Cut everything that was not "launch the server and register the file
|
|
types"**: no grammar, no `language-configuration.json`, no commands, no
|
|
status bar, no bundler, one setting. The table above records each cut and its
|
|
reason so the next person does not re-litigate them silently. The
|
|
`language-configuration.json` cut is the one I'd expect to be revisited — it
|
|
costs `Ctrl+/` comment toggling — and it is flagged as such rather than
|
|
hidden.
|
|
- **`smoke.js` is the round's real deliverable.** Everything else here is
|
|
configuration that can only be proven inside an editor; the spawn contract
|
|
can be proven in a shell, so it is. It mirrors `tests/e2e.rs` deliberately —
|
|
same write-everything-then-read shape, same hand-rolled framing, same reason
|
|
— but it is not a copy: it asserts what the *extension* depends on
|
|
(`rootUri: null` works, the four capabilities the guides promise are present,
|
|
the process exits 0), not what the server's internals do.
|
|
- **Verified `smoke.js` actually fails when it should**, which is the part
|
|
people skip. Two negative controls: a nonexistent binary → `FAIL … ENOENT`,
|
|
exit 1; `/bin/cat` as the "server" (echoes the frames straight back, so the
|
|
parse succeeds and the *content* is wrong) → `FAIL — initialize response
|
|
carries no capabilities`, exit 1. A smoke test that only ever passes is a
|
|
smoke test nobody has tested.
|
|
- **The Neovim guide's `vim.filetype.add` line was going to be boilerplate
|
|
until I checked.** In vim 9.1's `filetype.vim` (the tables Neovim's descend
|
|
from) `*.sv`/`*.svh` map to `systemverilog` outright, but `*.v` runs a
|
|
*content heuristic*, `dist#ft#FTv()`, that chooses between Verilog, Coq and
|
|
V, and **`*.vh` is not mapped at all**. So the line is load-bearing for
|
|
`.vh` headers and for short `.v` files, and the guide now says why, with the
|
|
Coq/V caveat.
|
|
- **Did not install the extension into the user's VS Code.** `code` is on this
|
|
machine and `code --install-extension` would have worked, but installing into
|
|
someone's editor is a change to their environment, not a validation step I
|
|
was asked for. The `.vsix` was built, inspected and deleted; the install
|
|
command is documented, unrun.
|
|
- **Concurrency note.** Midway through this round another agent's `vfmt_core`
|
|
round landed in the same tree — `crates/vfmt/src/{config,walk}.rs` moved to a
|
|
new `crates/vfmt_core`, and `crates/vfmt_server/Cargo.toml` gained a
|
|
dependency on it. That is exactly the Handshake `docs/features/vfmt-server`
|
|
filed and this feature restated, so the `vfmt.toml` caveat in the three
|
|
editor docs is likely to become false very soon. I left it as written: it was
|
|
true of the binary I built and smoke-tested, and the follow-up is recorded in
|
|
Status/TODO with the exact three places to edit. Nothing under `crates/` was
|
|
touched by me.
|
|
- Did not run `git commit` / `git push`. Did not modify any file under
|
|
`crates/`.
|
|
|
|
**What was actually validated on this machine, precisely:**
|
|
|
|
| Check | Result |
|
|
|---|---|
|
|
| `cargo build --release -p vfmt_server` | exit 0, `target/release/vfmt-server` |
|
|
| `node smoke.js target/release/vfmt-server` | **`smoke: OK` — 3 messages, exit 0** |
|
|
| `smoke.js` negative control: missing binary | FAIL, exit 1 (as designed) |
|
|
| `smoke.js` negative control: `/bin/cat` | FAIL on capabilities, exit 1 (as designed) |
|
|
| `package.json` parses as JSON | yes (`JSON.parse`) |
|
|
| `node --check extension.js` / `smoke.js` | both parse |
|
|
| `npm install` | 8 packages, `[email protected]` resolved exactly, `engines.vscode ^1.82.0` matches ours |
|
|
| `npx @vscode/vsce package --skip-license` | **`.vsix` built** — 320 files, 462 KB, `smoke.js` correctly excluded by `.vscodeignore` |
|
|
|
|
**Authored but not run here, and why:**
|
|
|
|
- **The extension inside VS Code.** `require('vscode')` resolves only in the
|
|
extension host — confirmed by trying: requiring `vscode-languageclient/node`
|
|
outside VS Code throws `Cannot find module 'vscode'`. So `activate()` is
|
|
unexercised. What *is* proven: the file parses, the dependency resolves and
|
|
matches the declared engine, the package builds into an installable `.vsix`,
|
|
and the spawn contract the `activate` path uses works against the real
|
|
binary.
|
|
- **Every Vim/Neovim snippet.** No `nvim` on this machine (`command -v nvim`:
|
|
nothing; `vim` 9.1 exists, without `vim-lsp`). Expected behavior on a machine
|
|
that has it: `:checkhealth vim.lsp` shows one client `vfmt` attached to the
|
|
buffer with `documentFormattingProvider`, `hoverProvider`,
|
|
`definitionProvider`, `referencesProvider`, `documentSymbolProvider`,
|
|
`workspaceSymbolProvider` and `semanticTokensProvider` set and
|
|
`positionEncoding` `utf-16`; `K` on a `` `MACRO `` shows its definition; `gd`
|
|
on a signal jumps to its declaration. The two server-side facts those
|
|
snippets rest on were checked independently rather than assumed: the
|
|
no-root/single-file `initialize` (asserted by `smoke.js`) and the filetype
|
|
mapping (read out of vim 9.1's `filetype.vim`, above).
|
|
- **`code --install-extension`** — deliberate, see above.
|
|
|
|
## QA log
|
|
|
|
### 2026-08-19 — QA agent
|
|
|
|
**Build tested:** `HEAD` at `c8b936a7` plus the working tree exactly as it
|
|
stood (20 changed/untracked paths, `git status --short`), rebuilt twice
|
|
(`cargo build --release -p vfmt_server`, both times "Finished ... in 0.02s" —
|
|
already up to date, so one stable binary throughout this pass:
|
|
`target/release/vfmt-server`, 1,996,608 bytes, md5 `ed84f61d8c414e34d840571`
|
|
`f8696191e`, mtime 09:26). This build **includes the concurrent
|
|
`vfmt_core` config/walk lift** (`crates/vfmt_core/src/{config,walk}.rs`,
|
|
`crates/vfmt_server` depends on it) — see the Finding below. Did not touch
|
|
anything under `crates/`; rebuilt only to confirm the binary was settled
|
|
before each spawn-based check, per the lead's note that the vfmt_core-lift
|
|
agent was doing its own final gate runs concurrently.
|
|
|
|
**Validation matrix — all green, re-run to completion:**
|
|
|
|
| Check | Result |
|
|
|---|---|
|
|
| `cargo build --release -p vfmt_server` (x2, bracketing the session) | exit 0 both times, binary unchanged between runs |
|
|
| `node smoke.js ../../target/release/vfmt-server` | `smoke: OK` — 3 messages, exit 0 (re-run at session end too) |
|
|
| Negative control: `node smoke.js /nonexistent/vfmt-server` | `FAIL — could not spawn ... ENOENT`, exit 1 |
|
|
| Negative control: `node smoke.js /bin/cat` | `FAIL — initialize response carries no capabilities`, exit 1 |
|
|
| `node --check extension.js` / `smoke.js` | both parse clean |
|
|
| `python3 -c json.load` on `package.json` | valid JSON |
|
|
| `wc -l extension.js` / `smoke.js` | 41 / 93 — both claims exact |
|
|
| `npm ci` in a scratch copy (not `node_modules`, the real one untouched) | 8 packages, `vscode-languageclient@9.0.1` resolved exactly (`npm ls --all` tree matches the README's dependency table verbatim) |
|
|
| `npx @vscode/vsce package --skip-license` | **see Finding 2 below — required relocating the copy out of the scratchpad path** |
|
|
| `.vsix` contents (`unzip -l`) | 320 files, 462.22 KB (dev's numbers exact); `smoke.js`, `.gitignore`, `.vscodeignore` all absent, `extension.js`/`package.json`/`readme.md`/`node_modules/*` present |
|
|
|
|
**Finding 1 (confirmed, significant, not blocking function) — the
|
|
`vfmt.toml`-blindness caveat is now false against the tested binary.**
|
|
The `vfmt_core` lift landed in the working tree (uncommitted) and
|
|
`crates/vfmt_server` already consumes it: `cargo test -p vfmt_server --release
|
|
format::` passes `a_config_file_beats_the_editors_tab_size` and
|
|
`a_vfmt_toml_governs_the_buffer_it_sits_above`, both asserting `vfmt.toml`
|
|
wins over the client's tab size. I additionally drove a live LSP round-trip
|
|
against the built binary (scratch dir with `vfmt.toml` containing
|
|
`indent = 4`, `.git` marker, `rootUri` pointing at it) and requested
|
|
`textDocument/formatting` with `tabSize: 2`: the response's `newText` used
|
|
4-space indent, i.e. the config file won over the client, over the wire, on
|
|
this exact binary. This means the caveat "the server does **not** read
|
|
`vfmt.toml` yet" is no longer true of the binary these docs describe. It
|
|
appears verbatim in all three places `docs/features/editor-packaging/README.md`'s
|
|
own Status/TODO already flagged: top-level `README.md` (Editor setup
|
|
section), `editors/vscode/README.md` (Settings section), and
|
|
`editors/nvim/README.md` ("What you get, and what you don't" section) — plus
|
|
it's echoed in this feature's own Assumptions/Handshakes/Status-TODO/Work-log
|
|
prose. Per the lead's instruction this cleanup belongs to the lead / the
|
|
vfmt-server docs owner, not to this QA pass, so I have not edited any of
|
|
those five locations — reporting precisely instead, as asked. Locations,
|
|
for the fix: `README.md` (top-level, "Editor setup"), `editors/vscode/README.md`
|
|
(Settings), `editors/nvim/README.md` ("What you get"), plus (not previously
|
|
flagged by the dev, since it's this feature's own doc) this file's Assumptions,
|
|
Handshakes and Status/TODO sections restate the same now-false claim and
|
|
should get the same pass when the caveat is retired.
|
|
|
|
**Finding 2 (environment artifact, not a defect in the feature) — `vsce
|
|
package` fails inside the assigned scratchpad path.** Copying
|
|
`editors/vscode` (minus `node_modules`) into
|
|
`.../9ecac3b9-8a0e-4065-85de-23cc2a396bad/scratchpad/vscode_copy` and running
|
|
`npm ci` + `npx @vscode/vsce package --skip-license` there fails every time
|
|
with `ERROR Extension entrypoint(s) missing ... extension/extension.js`, and
|
|
`vsce ls` silently lists zero files. Reproduced with a *minimal* two-file
|
|
extension (bare `package.json` + `extension.js`, no `.vscodeignore`) in the
|
|
same scratchpad tree — same failure — and confirmed it packages fine when
|
|
the identical minimal extension sits in a plain path (`/tmp/vsce_plain_test`,
|
|
no UUID segment). Root cause traced into `@vscode/vsce`'s `collectAllFiles`
|
|
(`out/package.js`): it shells out to `npm list --production --parseable
|
|
--depth=99999` to get the directories to glob, and on this machine
|
|
(`node v26.7.0`, `npm 11.19.0`) that command's own captured output for a
|
|
cwd under the scratchpad's UUID-bearing path came back with the UUID
|
|
segment replaced by `***` when written to a file — i.e. something in this
|
|
sandbox rewrites that specific path shape somewhere in the child-process
|
|
output pipeline, and `vsce` then globs a path that doesn't exist, silently
|
|
getting zero files. This is **not** a defect in `editors/vscode` — it
|
|
reproduces identically for a trivial unrelated extension — so I re-ran the
|
|
`npm ci` + `vsce package` step in a copy under plain `/tmp` (deleted
|
|
immediately after, along with the scratchpad copy) to get a real result; see
|
|
the validation matrix above. Flagging so nobody mistakes "vsce fails" for a
|
|
packaging regression if they hit this same scratchpad-path issue later.
|
|
|
|
**Claims verified, no issues found:**
|
|
|
|
1. **`package.json`** — languages `verilog` (`.v`/`.vh`) and `systemverilog`
|
|
(`.sv`/`.svh`) exactly as claimed; `activationEvents` is
|
|
`["onLanguage:verilog", "onLanguage:systemverilog"]`, matching the
|
|
language ids character-for-character (no typo — this was checked
|
|
specifically, since a mismatch here is the "silently never activates"
|
|
failure mode); one setting `vfmt.serverPath` default `"vfmt-server"`;
|
|
`vscode-languageclient` pinned `"9.0.1"` (no `^`), confirmed both in
|
|
`package.json` and resolved exactly in `package-lock.json`
|
|
(`lockfileVersion: 3`) and in a fresh `npm ci`; `engines.vscode` is
|
|
`^1.82.0` on both `package.json` and matches the feature README's prose;
|
|
`publisher` is the literal string `REPLACE-ME`; `.vscodeignore` excludes
|
|
`smoke.js` (plus `.vscode/**`, `.gitignore`) — confirmed absent from the
|
|
built `.vsix`.
|
|
2. **`extension.js`** — read every line, 41 total (`wc -l` exact). Spawns
|
|
`serverPath` read from `vfmt.getConfiguration('vfmt').get('serverPath')`
|
|
with fallback `'vfmt-server'`; `serverOptions = {command, args: [],
|
|
transport: TransportKind.stdio}` matches `vscode-languageclient@9.0.1`'s
|
|
`Executable` interface (`lib/node/main.d.ts`: `command`, `transport?`,
|
|
`args?`, `options?`) exactly; `documentSelector: [{language: 'verilog'},
|
|
{language: 'systemverilog'}]` matches the contributed language ids
|
|
exactly; `new LanguageClient('vfmt', 'vfmt', serverOptions,
|
|
clientOptions)` matches the 4-arg `(id, name, serverOptions,
|
|
clientOptions, forceDebug?)` overload in `main.d.ts`; `deactivate()`
|
|
returns `client.stop()` so VS Code awaits shutdown. No other features
|
|
present. **Spawn-failure behavior traced through the library source**
|
|
(`lib/common/client.js`, `lib/node/main.js`): on ENOENT, `cp.spawn`
|
|
yields no pid, `handleChildProcessStartError` rejects, the client's own
|
|
`createConnection` catch calls `this.error(..., 'force')`, which *always*
|
|
shows a `window.showErrorMessage` popup (with a "Go to output" button)
|
|
and appends to the `vfmt` output channel regardless of
|
|
`revealOutputChannelOn` — `extension.js` itself doesn't need a `.catch()`
|
|
on `client.start()` because the library never lets a spawn failure go
|
|
unsurfaced. This matches the README's troubleshooting text ("See what the
|
|
server is saying... View → Output → the vfmt channel"); the README could
|
|
additionally mention the error popup explicitly but doesn't claim silence,
|
|
so nothing here is inaccurate, just slightly less complete than it could be.
|
|
3. **`smoke.js`** — zero-dep (`require('child_process')` only), 93 lines
|
|
exact. Ran clean against the release binary and both negative controls
|
|
(missing binary, `/bin/cat`) exactly as claimed — see validation matrix.
|
|
4. **`editors/nvim/README.md`** — all four client variants present
|
|
(`vim.lsp.config` 0.11+, `nvim-lspconfig` 0.9/0.10, Vim 9 `vim-lsp`
|
|
one-liner, coc.nvim `coc-settings.json`); root markers
|
|
`vfmt.toml`/`.vfmt.toml`/`.git` consistent across all four; the
|
|
`vim.filetype.add` line's load-bearing claim was checked directly against
|
|
`/usr/share/vim/vim91/filetype.vim` on this machine (vim 9.1, matches
|
|
what the dev cited): `*.sv,*.svh` map straight to `systemverilog`
|
|
(line 2828), `*.v` runs through `dist#ft#FTv()` (line 2822, defined in
|
|
`/usr/share/vim/vim91/autoload/dist/ft.vim:1523`, which sniffs buffer
|
|
content), and `grep '\.vh\b' filetype.vim` finds nothing — `.vh` is
|
|
genuinely unmapped. The doc's description of all three is accurate.
|
|
Single-file-mode claim (`single_file_support = true`) is backed by the
|
|
server accepting `initialize` with `rootUri: null` — confirmed live both
|
|
by `smoke.js` and by my own `probe.js` round trip.
|
|
5. **Honesty of the authored-vs-validated split** — confirmed on this
|
|
machine: `command -v nvim` → not found; `vim --version` → 9.1 present;
|
|
searched `~`, `~/.vim`, `~/.vimrc`, `~/.config/nvim`, and
|
|
`find / -maxdepth 6 -iname '*vim-lsp*'` → nothing, so "vim without
|
|
vim-lsp" is accurate and unchanged from the dev's own check. The "extension
|
|
never run inside VS Code" claim is consistent with reality: `require`ing
|
|
`vscode-languageclient/node` outside the extension host throws
|
|
(`Cannot find module 'vscode'`), so `activate()` genuinely cannot be
|
|
exercised from a shell. TODO.md §6's "Editor packaging" item is `[x]`
|
|
and its one-line summary (extension shape, dependency, filetype mapping,
|
|
manual-install scope) matches what's actually in `editors/`. All seven
|
|
required feature-README sections (Goal, Assumptions, Handshakes,
|
|
Status/TODO, Work log, QA log, Review) are present in this file.
|
|
|
|
**Overall: PASS**, with Finding 1 (stale `vfmt.toml` caveat, now confirmed
|
|
false, not this feature's docs to fix) as the one substantive issue,
|
|
recorded for the lead. No language-id/activation mismatch, no smoke
|
|
failure against the current binary — the two conditions the brief called
|
|
BLOCKING did not occur. Finding 2 is an environment note, not a shipped-code
|
|
defect. No files under `editors/` or `crates/` were modified by this QA pass;
|
|
this entry is the only edit made.
|
|
|
|
## Review
|
|
|
|
**2026-08-19 — lead. Verdict: accepted; commits with round 12. TODO §6 —
|
|
the owner's editor requirement — closes with this feature.**
|
|
|
|
Points reviewed and accepted:
|
|
|
|
1. **The authored-vs-validated split is the feature's backbone** and it
|
|
was kept honest on both sides: everything validatable headless was
|
|
actually run (the .vsix built and inspected, smoke passed with
|
|
negative controls proving it can fail, npm ci reproducibility), and
|
|
what can't run here (the extension host, the editor snippets) is
|
|
labeled as such with the exact expected behavior stated. QA then
|
|
re-ran the whole matrix independently and cross-checked the client
|
|
API shapes against the library's own type definitions — the
|
|
language-id consistency check (the silent-killer class for VS Code
|
|
extensions) came back clean.
|
|
2. **`vscode-languageclient` taken, not avoided**: VS Code has no
|
|
built-in generic LSP client; hand-rolling one is the same trade
|
|
CLAUDE.md already rejected for `lsp-server`. Justified, pinned,
|
|
cost-measured (8 packages, no native modules).
|
|
3. **The `vim.filetype.add` discovery** — `*.v` goes through Vim's
|
|
content heuristic and `*.vh` is unmapped natively, so the snippet
|
|
line is load-bearing — is exactly the kind of verified-against-
|
|
runtime fact these READMEs exist to hold; QA confirmed it
|
|
byte-for-byte against this machine's filetype.vim.
|
|
4. QA's Finding 1 (the "server doesn't read vfmt.toml" caveat went
|
|
stale mid-round when vfmt-core-lift landed under it) was the lead's
|
|
to fix and is now fixed in all flagged locations, including the
|
|
vfmt-server README's superseded Assumptions. Finding 2 (vsce's path
|
|
resolution breaking inside the session scratchpad) is an
|
|
environment artifact, correctly diagnosed by reproducing it on an
|
|
unrelated minimal extension.
|
|
|
|
Remaining editor work is deliberately out of scope and stays visible:
|
|
publishing (a real publisher id, marketplace/OpenVSX), extension-host
|
|
integration testing, and lint diagnostics reaching the editor once the
|
|
server wires vlog_linter in.
|