Version bumped to 0.2.0 (workspace-inherited, one line + lockfiles; both binaries report it). Root MIT LICENSE plus the editors/vscode copy that lets vsce package run without --skip-license, closing the editor-packaging handshake. CHANGELOG.md is a user-facing first- release document: six area paragraphs linking the feature READMEs, stating the current corpus truth (476/820 formattable, zero verification errors, zero crashes). tools/release.sh builds checksummed host binaries + the sideloadable .vsix into gitignored dist/ (aborts before deleting prior artifacts on failure -- proven live); tools/RELEASING.md is the checklist, with marketplace/OpenVSX commands demoted to an explicitly optional appendix per the owner: publishing is fully deferred, sideloading via code --install-extension is the supported path, publisher stays REPLACE-ME. Dev: Opus agent (mid-flight scope trim handled cleanly); QA: Sonnet agent (artifacts, real sideload cycle, all 26 changelog links); review in docs/features/release-prep/README.md. Co-Authored-By: Claude Fable 5 <[email protected]>
105 lines
4.3 KiB
Markdown
105 lines
4.3 KiB
Markdown
# 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
|
|
|
|
```bash
|
|
cargo build --release # from the repo root; binary at target/release/vfmt-server
|
|
```
|
|
|
|
Put it on your `PATH`:
|
|
|
|
```bash
|
|
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.
|
|
|
|
```bash
|
|
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
|
|
|
|
```bash
|
|
npm ci # installs vscode-languageclient (the only dependency)
|
|
npx @vscode/vsce package
|
|
code --install-extension vfmt-0.2.0.vsix
|
|
```
|
|
|
|
Then reload VS Code and open a `.v`/`.sv`/`.vh`/`.svh` file.
|
|
|
|
`tools/release.sh` from the repo root does all of the above (plus the release
|
|
binaries and checksums) and drops the `.vsix` in `dist/`, so
|
|
`code --install-extension dist/vfmt-0.2.0.vsix` is the one-command path.
|
|
`editors/vscode/LICENSE` is a copy of the repo's MIT license and is what lets
|
|
`vsce package` run without `--skip-license`. If you are packaging a fork that
|
|
dropped `package.json`'s `repository` field, add `--allow-missing-repository`.
|
|
|
|
**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.
|
|
|
|
**Sideloading is the supported install.** Marketplace publishing is optional
|
|
and deferred: `publisher` is the literal placeholder `REPLACE-ME`, so
|
|
`vsce publish` would fail, while packaging a `.vsix` and installing it locally
|
|
works exactly as above. `tools/RELEASING.md` records what publishing would take
|
|
if it ever happens.
|
|
|
|
## 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:
|
|
|
|
```jsonc
|
|
// .vscode/settings.json
|
|
{
|
|
"[verilog]": { "editor.formatOnSave": true },
|
|
"[systemverilog]": { "editor.formatOnSave": true }
|
|
}
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
- **Nothing happens on a `.sv` file.** Check the language mode in the status
|
|
bar. Another Verilog extension may own the `.sv` extension with a different
|
|
language id; this one attaches to `verilog` and `systemverilog`.
|
|
- **"command not found" style failure on startup.** The server is not on
|
|
`PATH`. Set `vfmt.serverPath` to an absolute path, and confirm the binary
|
|
itself works with `node smoke.js <path>`.
|
|
- **See what the server is saying.** View → Output → the `vfmt` channel carries
|
|
the client/server log, including anything the server writes to stderr.
|