The VS Code extension
The Gantry extension puts a project’s design ledger in the editor. It lints
the records as you type, answers @ruling: and defect references in any
file, marks the tests that records name, and files, amends and closes
records from the Command Palette. It runs the same core as the CLI, compiled
to WebAssembly in the extension, so what it reports is what gantry lint
reports, and what it writes is what the CLI writes. Nothing leaves your
machine: there is no account, no server and no telemetry.
Install
Section titled “Install”The extension is not on the Visual Studio Marketplace. Install it from the
GitHub release, which carries one .vsix per version, named
gantry-vscode-<version>.vsix, and its checksum, gantry-vscode.sha256:
gh release download v0.9.2 --repo c65llc/gantry --pattern 'gantry-vscode*'sha256sum -c gantry-vscode.sha256 # shasum -a 256 -c on macOScode --install-extension gantry-vscode-0.6.0.vsixOr, in VS Code, open the Extensions view, choose Views and More Actions
(the ... menu), then Install from VSIX… and pick the file. It needs
VS Code 1.105 or newer. Update by installing the next release’s .vsix
over it.
The extension activates in a workspace that holds a gantry.yaml.
What it does
Section titled “What it does”Lint as you type
Section titled “Lint as you type”Every finding gantry lint reports shows in the Problems panel, on the
lines it names. A finding’s code is the rule’s ID and links to the rule’s
page. The extension follows the editor, not the disk: an unsaved change is
linted when you pause typing (300 ms by default), and closing a file without
saving puts the findings back to what is on disk.
The history rules compare against git, which the core does not have, so
they are reported as skipped, as the web app does. Run gantry lint --base
for them.
References
Section titled “References”In any file (a record, a test, a source file or a comment, in any language), a reference to a record does three things:
- Hover shows a card: a ruling’s answer, its cells and its open defects, a defect’s status and what it owes, a pass or an evidence frame’s details. The card links to open the record, and to amend a ruling or close a defect.
- Go to Definition opens the record’s file, at the heading a fragment names.
- Completion offers the IDs after
@ruling:,@defect:,@pass:and@evidence:, and after your project’s defect prefix.
A reference that names nothing gets no diagnostic in a code file: lint owns the records, and code is not linted.
Tests that records name
Section titled “Tests that records name”In a file that matches a platform’s test globs in gantry.yaml, a CodeLens
over each test that a record names says why: guards @ruling:<id> over a
test a ruling asserts, and closes <D-id> over a test a defect owes.
Clicking a lens opens that record. The lenses follow the buffer, so
renaming a test removes its lens.
Commands
Section titled “Commands”In the Command Palette, in the Gantry category:
| Command | What it does |
|---|---|
| New Defect | Files a defect: title, class, severity, rulings, platforms, apps and evidence frames. |
| Amend Ruling | Amends a ruling: the summary, what it replaces, the kind of change, who ruled, the pass, the assertions that now hold it and the evidence frames. It is dated today, by your clock. |
| Close Defect | Closes a defect, starting from the owes it has. It refuses while they do not pay what the defect’s class owes, and says what is still owed. |
| Add Evidence | Records an image as an evidence frame. See Add Evidence. |
Amend and Close are also on a record file’s context menu, as a lens over its first line, and in a reference’s hover card. Add Evidence is also on an image’s context menu in the Explorer.
Before anything is written, each command shows the change as a diff, with
lint’s findings in the changed files, and asks to apply it. Applying edits
the open buffers and then saves them: an unsaved change of yours is kept,
never overwritten, and nothing is written behind it. A new file is written
with LF line ends, as the CLI writes it, whatever files.eol says.
The Ruling and Pass panel
Section titled “The Ruling and Pass panel”Open in Gantry, in a reference’s hover card and on a test’s lens, opens a ruling or a pass in a panel of its own, titled with its ID: the web app’s Ruling and Pass views, with the lint summary in the header. The panel reads the project as the editor holds it, unsaved buffers included, so it never disagrees with the Problems panel. An amendment, a defect or a pass filed in it is written as the commands write. If you have typed in a buffer since the panel read it, the panel reads the project again instead of writing over your change. The panel runs only its own bundle and one short script that hands the bundle the record to show, both carrying a fresh nonce its Content Security Policy requires: no network and no other script.
Add Evidence
Section titled “Add Evidence”Add Evidence records an image inside the project as an evidence frame,
by running gantry evidence add in the project’s root. It asks for the
platform, the appearance and, optionally, the pass. It needs the
gantry CLI, on your PATH or named by
gantry.cliPath. The CLI is run directly, never through a shell. An image
reached through a symbolic link that leads outside the project is refused.
Add Evidence needs a trusted workspace as well, because it runs a program. See Restricted Mode.
Settings
Section titled “Settings”| Setting | Default | What it does |
|---|---|---|
gantry.lint.debounceMs |
300 |
How long, in milliseconds, to wait after the last keystroke before linting the project again, and before the test lenses refresh. |
gantry.cliPath |
gantry |
The gantry CLI that Add Evidence runs: a name on your PATH, or the program’s full path. |
Restricted Mode
Section titled “Restricted Mode”In a workspace you have not trusted, the extension runs with these limits:
- Lint, hover, go to definition, completion, the lenses, the panel and the New Defect, Amend Ruling and Close Defect commands all work. They run the core inside the extension and edit the files you have open.
- Add Evidence is off, because it runs the
gantryCLI, and a workspace you have not trusted must not choose which program that is. gantry.cliPathis read only from your user settings. A value in the workspace’s.vscode/settings.jsonis ignored until you trust the workspace.
Several projects in one workspace
Section titled “Several projects in one workspace”Every gantry.yaml in the workspace, outside node_modules, is a project,
with its own copy of the core. A file belongs to the nearest project above
it, so a workspace can hold several projects, in several roots or in
subfolders of one. A file under no project gets no findings, no hovers and
no lenses. Commands that need a project ask which one when the active file
does not say.
The extension reads a project as the web app does: the files gantry.yaml
names (the content directory and the test globs), skipping .git and
node_modules. A test glob that reaches into node_modules finds nothing
here, though the CLI would find those files.
Messages and the output channel
Section titled “Messages and the output channel”A message that quotes a record, the CLI or an error shows that text as text: a Markdown link in it is not made live. Each message is also written whole to the Gantry output channel, and an error offers Show output.
Building it yourself
Section titled “Building it yourself”The extension lives in web/vscode/, in the web/ pnpm
workspace, and needs Node 24 and Go:
make vscode-test # the integration tests, in VS Code 1.105.0make vscode-package # web/vscode/gantry-vscode-0.0.0-dev.vsix and its checksummake vscode-package VERSION=0.6.0Each release’s .vsix is built by the release workflow and attached to the
release before it is published. docs/releasing.md has
the procedure. Publishing to the Marketplace is not set up.