Sova for VS Code
Language support for Sova - a multi-tier language whose backend transpiles to Go and whose frontend transpiles to JavaScript.
Features
This extension is a thin client for sova lsp (the language server built into the sova binary). All the actual analysis lives there; this extension wires it up to VS Code.
- Diagnostics - syntax errors of the edited file instantly, the full workspace check after a short debounce (pull diagnostics for open files when the editor supports them). Follow-up errors caused by an earlier error are suppressed, and the initial workspace load shows progress.
- Hover - signatures, docs and, for wired functions, the endpoint (
POST /api/...), side and access rules.
- Go-to-definition, find references, document highlight - backed by a workspace cross-reference index that covers type annotations, struct fields and methods.
- Rename - refuses names that would change what a reference resolves to (shadowing, conflicts) and symbols from
std or dependencies.
- Completion - ranked by expected type, call snippets with parameter placeholders, statement snippets (
if, for, switch, ...) and std packages that are imported automatically.
- Signature help - while you're typing inside a function call's arguments.
- Code actions - organize imports, remove unused variables and imports, add a missing
std import, add wire to a declaration used from the other side, extract to function and extract to variable.
- Code lens - run
main, run a test, reference counts, and the endpoint plus cross-side caller count of wired functions.
- Inlay hints - inferred types after
let and parameter names before literal arguments.
- Semantic tokens - with
declaration, readonly, defaultLibrary and the Sova-specific frontend / backend modifiers.
- Call hierarchy, type hierarchy, selection range, folding ranges, document and workspace symbols.
- Formatting -
Format Document runs sova fmt over the buffer.
Installation
- Install the
sova toolchain so the sova binary is on your PATH. (Or set sova.serverPath in VS Code settings to an absolute path.)
- Install this extension.
- Open any
.sova file.
Settings
| Setting |
Default |
Description |
sova.serverPath |
"sova" |
Path or PATH-resolvable name of the sova binary. The extension invokes <serverPath> lsp. |
sova.trace.server |
"off" |
LSP traffic trace level. Set to "messages" or "verbose" while debugging; output appears in Output → Sova Language Server. |
sova.inlayHints.types |
true |
Inferred types after let declarations without an annotation. |
sova.inlayHints.parameterNames |
true |
Parameter names before literal call arguments. |
sova.codeLens.references |
true |
Reference count above top-level declarations. |
sova.codeLens.wire |
true |
Endpoint and cross-side caller count above wired functions. |
sova.diagnostics.unused |
true |
Fade out unused variables and imports. |
sova.diagnostics.delay |
250 |
Milliseconds between the last edit and the full workspace check. |
Backend and frontend symbols can be colored differently through semantic token customizations, for example:
"editor.semanticTokenColorCustomizations": {
"rules": {
"*.backend": { "foreground": "#c792ea" },
"*.frontend": { "foreground": "#82aaff" }
}
}
Commands
| Command |
Description |
Sova: Restart Language Server |
Stops and restarts the LSP child process - useful after updating the sova binary. |
Sova: Run main() |
Spawns sova run <file> in a terminal. Invoked from the ▶ Run code lens. |
Sova: Run Test |
Spawns sova test <file> --filter <test-name> in a terminal. Invoked from the ▶ Run test code lens. |
Debugging
The extension contributes two debug types backed by sova debug, launched through sova.serverPath. Breakpoints can be set in any .sova file.
Requirements: Chromium or Chrome for the frontend side, Delve for the backend side (auto-installed on first use, or go install github.com/go-delve/delve/cmd/dlv@latest). Build with sova build --with-debug-info so source maps, the debug sidecar and //line pragmas are emitted.
Frontend + backend (recommended)
{
"type": "sova",
"request": "launch",
"name": "Debug Sova (frontend + backend)",
"frontend": {
"url": "http://localhost:8080/",
"projectRoot": "${workspaceFolder}"
},
"backend": {
"mode": "exec",
"program": "${workspaceFolder}/dist/output"
}
}
One session covers both sides. Backend goroutines appear as threads prefixed backend:, the browser as frontend: Frontend.
Frontend only
{
"type": "sova-frontend",
"request": "launch",
"name": "Debug Sova frontend",
"url": "http://localhost:8080/",
"projectRoot": "${workspaceFolder}"
}
Launch configuration reference
| Field |
Purpose |
frontend.url |
Where the running app can be reached. Required if frontend is present. |
frontend.projectRoot |
Sova project root. Defaults to the workspace folder. |
frontend.sourceMap |
Explicit output.js.map path. |
frontend.sidecar |
Explicit output.js.sova-debug.json path. |
frontend.headless |
Run Chromium headless (default true) or headed. |
backend.mode |
"exec" (default, pre-built binary) or "debug" (Delve builds from source). |
backend.program |
Path to the binary (exec) or source directory (debug). |
backend.stopOnEntry |
Break immediately after launch. |
sova-frontend accepts the frontend.* fields at the top level.
Reactive Fields view
The Sova activity-bar container shows the reactive state of the active debug session:
- Reactive fields - the
@reactive catalogue from the sovaReactiveFields DAP request, refreshable on demand.
- Live changes - every
sova-reactive-change event, newest first (capped at 200), with side, Owner.field, old and new value.
Developing
npm install
npm run bundle # builds out/extension.js
code --extensionDevelopmentPath=$PWD
That last command opens a "Extension Development Host" window with this extension active. Open a .sova file in it to exercise the integration end-to-end against your local sova binary.
To produce a .vsix for sharing:
npx vsce package
Architecture
+-----------------+ stdio JSON-RPC +-------------+
| VS Code | <--------------------> | sova lsp |
| extension | | (Go) |
| (this repo) | | |
+-----------------+ +-------------+
| |
| spawns | reads/writes
v v
subprocess files on disk +
.sova/deps/ via the
pkgmgr resolver
Everything language-aware happens in the LSP. The extension's job is to spawn it, route notifications, and let VS Code render the results.