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]>
vfmt for VS Code
A thin extension: it registers the Verilog/SystemVerilog file types and starts
vfmt-server. Every feature you see — formatting, diagnostics, semantic
highlighting, hover, go-to-definition, references, symbols — comes from the
server, so this directory contains no language logic and no editor-specific
commands. See docs/features/vfmt-server/README.md for the capability list and
docs/features/editor-packaging/README.md for why the extension looks like
this.
1. Build the server
cargo build --release # from the repo root; binary at target/release/vfmt-server
Put it on your PATH:
cp target/release/vfmt-server ~/.local/bin/ # or wherever your PATH points
Or leave it in target/release and point the extension at it with the
vfmt.serverPath setting (below).
2. Smoke-test the spawn contract (no editor needed)
smoke.js spawns the server exactly the way extension.js does — same
argument list (none), same cwd, same inherited environment — and drives a full
initialize / didOpen / shutdown / exit session over stdio with
hand-rolled Content-Length framing. Plain node, no dependencies.
node smoke.js # `vfmt-server` from PATH
node smoke.js ../../target/release/vfmt-server # an explicit binary
It prints smoke: OK — … and exits 0, or names the failure and exits 1. Run it
after every server change and before packaging: it is the only check that
catches "the binary moved" or "the handshake broke" without launching VS Code.
3. Install the extension
npm install # installs vscode-languageclient (the only dependency)
npx @vscode/vsce package --skip-license
code --install-extension vfmt-0.1.0.vsix
Then reload VS Code and open a .v/.sv/.vh/.svh file.
--skip-license is needed only because this repo ships no LICENSE file yet
(package.json declares MIT). Drop the flag once one exists. If you are
packaging a fork that dropped package.json's repository field, add
--allow-missing-repository too.
Running from source instead, for development: open this directory in VS Code and press F5. That starts an Extension Development Host with the extension loaded from disk, with no packaging step.
Publishing to the Marketplace is out of scope. publisher is the literal
placeholder REPLACE-ME; vsce publish will fail until it is a real publisher
id you own. Packaging a .vsix and installing it locally works with the
placeholder, which is what the steps above do.
Settings
| Setting | Default | What it does |
|---|---|---|
vfmt.serverPath |
"vfmt-server" |
Path to the executable. A bare name is looked up on PATH; an absolute path is used as given. |
That is the whole list, deliberately. Formatter options (line length, indent)
belong in a vfmt.toml, not in editor settings — one source of truth for the
CLI and the editor. The server discovers vfmt.toml for each file exactly as
the CLI does; when it names a setting, it wins over VS Code's tab size (an
editor default is not a deliberate override). Without a config, VS Code's tab
size governs the indent and the line length is the built-in 100.
Format on save
The extension registers no formatter of its own — the server advertises
documentFormattingProvider, so VS Code's normal machinery applies:
// .vscode/settings.json
{
"[verilog]": { "editor.formatOnSave": true },
"[systemverilog]": { "editor.formatOnSave": true }
}
Troubleshooting
- Nothing happens on a
.svfile. Check the language mode in the status bar. Another Verilog extension may own the.svextension with a different language id; this one attaches toverilogandsystemverilog. - "command not found" style failure on startup. The server is not on
PATH. Setvfmt.serverPathto an absolute path, and confirm the binary itself works withnode smoke.js <path>. - See what the server is saying. View → Output → the
vfmtchannel carries the client/server log, including anything the server writes to stderr.