VS Code
The Airframe extension for VS Code (airframe-vscode) brings the design
system to the line you are writing. In a consumer file it shows what a
token reference is, offers only the tokens the file may read, lints the
project as you type, and offers to replace a literal with the token it
equals.
It answers exactly as the CLI does. The extension runs Airframe’s own Go core, compiled to WebAssembly, in a worker thread beside the editor: the references, values, swatch colours, readability, findings and literal matches are all the core’s, never a second implementation in TypeScript. It never runs a program, never writes a file itself, and sends nothing anywhere.
The extension ships with v0.12.0, attached to it as
airframe-vscode-<version>.vsix.
Install
Section titled “Install”The extension is not on the Marketplace yet. From the
latest release,
download airframe-vscode-<version>.vsix and airframe-vscode.sha256,
check one against the other, and install the extension:
sha256sum -c airframe-vscode.sha256 # macOS: shasum -a 256 -c airframe-vscode.sha256code --install-extension airframe-vscode-<version>.vsixOr, in VS Code, run Extensions: Install from VSIX… and choose the file. It needs VS Code 1.105 or newer.
Projects
Section titled “Projects”The extension activates in a workspace that holds an airframe.yaml.
Every airframe.yaml in the workspace (outside node_modules) is a
project, with its own copy of the core, so a multi-root workspace or a
repository with several design systems works; a file belongs to the
nearest project above it. The extension reads each project as the web app
does: the core says which files the project reaches (airframe.yaml, the
content root, each platform’s consumer files, the build outputs, the
Gantry rulings), and only those are read, never .git or
node_modules.
It follows the editor, not the disk: a file you have changed and not saved is read as it is in the editor, by lint and by every feature below.
Hover on a token reference in a consumer file, on any platform:
var(--surface) in CSS or a web component, DesignTokens.surface in Swift
or Kotlin, {ThemeResource DesignSurface} in XAML, Resources["DesignSurface"]
in C#, or a read through a declared wrapper root such as
theme.space.small. The card shows:
- the token’s name, tier and type;
- its value per appearance, one row each, and per density, one column
each, when it varies on density; a colour has a swatch beside its value.
The values are the ones
airframe show <token> --jsonresolves, in the same layout as the web app’s token table; - the component that owns it, with the component’s ruling and that ruling’s status;
- its description;
- the rule page of each finding on the reference;
- a Usages link, which runs Airframe: Show Token Usages.
An undeclared reference has no card: its reference-undeclared finding
says what is wrong.
Colours
Section titled “Colours”Every reference to a colour token has a swatch beside it, the token’s value in the first appearance, at every other axis’s base. The swatches are read-only: the colour picker they open changes nothing. To change a colour, edit the token (or use the web app).
Completion
Section titled “Completion”Completion opens inside a reference: after var(-- in CSS, after
DesignTokens. (the naming template’s type) in Swift or Kotlin, after
{ThemeResource or {StaticResource in XAML, after Resources[" in C#,
and after a wrapper root’s .. It offers only the tokens this file may
read, as airframe find --file and the airframe_can_read tool decide:
a component’s tokens only in the files its owners name (or everywhere, for
a shared component), never a primitive, never a retired token. Each item
is written as the file’s platform spells it (a XAML colour as a
ThemeResource, any other resource as a StaticResource), and its detail
line shows the tier and the value.
Lint as you type
Section titled “Lint as you type”The findings airframe lint reports appear in the Problems panel and on
the lines they name, as you type, each with its rule as the code and the
rule’s page (https://airframe.uijig.com/rules/<rule>/) as its link. Lint
runs again once you pause typing (see airframe.lint.debounceMs), and
when a file of the project changes on disk. Rename a token in its token
file and, before you save, every reference to the old name shows
reference-undeclared.
Quick fix
Section titled “Quick fix”On a fallback-literal finding (var(--x, #fff)), or on a literal you
select in a consumer file, the light bulb offers Replace with token …
for each token whose base value equals the literal, by the same comparison
fallback-literal makes (#fff and #ffffff are the same colour; 8px and
0.5rem are not the same length). Only tokens the
file may read are offered. The fix edits the open document; nothing is
saved until you save it.
Go to definition
Section titled “Go to definition”Go to Definition (F12) on a reference opens the token’s base declaration in its token file.
Commands
Section titled “Commands”| Command | ID | What it does |
|---|---|---|
| Airframe: Show Token Usages | airframe.usages |
Lists every read of a token on every platform, as airframe usages does; choose one to open it. It asks about the reference under the cursor, or asks you to choose a token. |
| Airframe: Show Token | airframe.showToken |
Opens the token as airframe show <token> --json prints it, in a read-only document. |
| Airframe: Open the Airframe App | airframe.openApp |
Opens the web app, https://airframe.uijig.com/app/, in your browser. |
Settings
Section titled “Settings”| Setting | Default | What it does |
|---|---|---|
airframe.lint.debounceMs |
300 |
How long, in milliseconds, the extension waits after your last keystroke before it lints the project again. |
Restricted Mode and privacy
Section titled “Restricted Mode and privacy”The extension supports
Restricted Mode
fully: in a workspace you have not trusted, hover, colours, completion,
lint, the quick fix and the commands work exactly as in a trusted one,
because none of them needs trust. The extension never runs a program
(not even the airframe CLI), never writes a file itself (a quick fix is
an edit to the open document, which you save or discard), and has no
setting that names a program or a path.
A token’s description and a component’s ruling come from the project, so the hover card treats them as untrusted: it is rendered as untrusted Markdown with HTML off, and every piece of project text is escaped, so a description cannot add a link, a command or an image. The one command link, Usages, is the extension’s own.
Nothing leaves your machine: the core runs inside VS Code’s extension host, and the extension makes no network request. Airframe: Open the Airframe App opens a web page in your browser only when you run it.