VS Code
primate ships a VS Code extension that provides syntax highlighting
and connects to the primate lsp server. Source lives at
editors/vscode/
in the project repo.
Install
-
Install the
primatebinary so the extension can shell out toprimate lsp:cargo install primate --lockedThe binary lands at
~/.cargo/bin/primate. As long as that’s on yourPATH, you’re set. If you’d rather point the extension at a custom path, setprimate.server.pathin your VS Code settings. -
Install the extension from the Marketplace:
- https://marketplace.visualstudio.com/items?itemName=valtyr.primate-vscode
- Or in VS Code: Extensions sidebar → search “primate” → Install.
-
Open any
.primfile. Syntax highlighting and inline diagnostics should appear immediately.
What you get
- Syntax highlighting via a TextMate grammar
(
editors/vscode/primate.tmLanguage.json). - LSP-driven diagnostics, hover, go-to-definition, find-references, format-on-save, and contextual completion (enum variants, unit suffixes).
- Cross-target navigation: from a constant in a
.primfile, find references jumps to its callsites in generated TypeScript / Rust / Python; from a generated symbol, go-to-definition resolves back to the originating.primline via the sourcemap. - JSON schema validation for
primate.toml.
Settings
| Setting | Default | Description |
|---|---|---|
primate.server.path | "primate" | Path to the primate executable. Defaults to looking on PATH. |
Commands
- primate: Restart LSP Server — kill and re-launch the language server. Useful when you’ve upgraded the CLI binary.
Troubleshooting
If the extension activates but diagnostics never show, the language server probably failed to start. Check Output panel → primate LSP for the error message. Common causes:
primateisn’t onPATH. Runwhich primatefrom a terminal; if empty, eithercargo install primate --lockedor setprimate.server.pathto an absolute path.- The CLI version doesn’t match the extension. Run
primate --versionto confirm. Older CLIs may not implement some LSP requests the extension expects (e.g. cross-target navigation is added in v0.1+).
Install from source (development)
If you’re hacking on the extension itself rather than just using it:
cd editors/vscode
npm install
npm run compile
Then in VS Code, open editors/vscode/ and press F5 — that
launches an “Extension Development Host” window with the in-progress
extension loaded.
To package a .vsix locally without publishing:
npx --yes @vscode/vsce package
code --install-extension primate-vscode-*.vsix