On this page
Editors and the language server
For an integrated editor in your browser, run veradic ide in a project directory. The browser IDE includes file editing, project Check/Prove/Build/Run, the REPL and searchable manuals with code wizards. It uses Verada's language server for saved source files and needs no editor extension. The rest of this chapter describes external editors.
Verada's editor support uses one language server, veradic lsp, with plug-ins for Visual Studio Code and Zed. The server supplies checks, proofs, navigation, fixes, formatting and APL glyph completion to clients that support those LSP capabilities. The plug-ins add highlighting for Vada (.vads, .vadb), Varc (.va) and their APL text. Vibe uses the .vb extension and Python syntax highlighting.
Visual Studio Code also shows the APL Workbench: a block canvas beside the source, checked source edits, example inputs and result inspection. The workbench is the server's (its sessions, checks, edits, native examples and their values); the extension opens its panels and relays their messages. Zed has no panel for it; veradic workbench serve shows the same workbench for a saved file in a browser.
Install veradic first (./goinstall.sh puts it in ~/.local/bin), and Z3 for proofs. Check a project in a shell (veradic check --project verada.toml) before you look for a problem in an editor.
Visual Studio Code
The extension lives in editors/vscode. Build and install it from the repository:
cd editors/vscode
npm ci
npm run package
code --install-extension verada-0.2.2.vsixIt registers the languages vada (.vads, .vadb) and varc (.va), with grammars for them and for APL text, and adds Vibe's contract statements (requires(...), ensures(...), invariant(...), decreases(...), assume(...)) and apl("...") text to Python's highlighting. It starts the server for Vada and Varc files, and for Python and Ada files under a directory with a verada.toml.
By default a Vibe file opens in Python mode, so Verada and Python extensions can both provide editor features. To use Verada's Vibe mode for the .vb files in a project's src directory and leave its Python tooling scripts to the Python extension, add the following settings to the workspace's .vscode/settings.json.
{
"files.associations": { "**/src/**/*.vb": "vibe" },
"verada.vibe": false
}Use "*.vb" for the association if every Python file in the workspace is Vibe. The status bar shows Vibe for a matching file. Set verada.path to the project compiler in the workspace settings. For a separate editor compiler, set verada.languageServerPath to its executable. It supplies the editor's inline proofs and other language features. Project tasks and agent tools use verada.path. An empty verada.languageServerPath also uses verada.path.
Settings: verada.path names the veradic executable (default veradic, found on PATH); verada.vibe (default on) lets Verada also check Python-mode files under a verada.toml; verada.proof.trigger and verada.proof.notify control the background prover; and verada.trace.server logs the protocol. The command Verada: Restart the language server restarts it. If AdaCore's Ada extension is installed too, it also claims .vads and .vadb: in a Verada workspace, set "files.associations": {"*.vads": "vada", "*.vadb": "vada"}, or disable that extension for the workspace.
Projects and tasks
Verada: New Project… asks for the folder to create the project in, its name and its syntax (Vada, Varc or Vibe), runs veradic new, and opens the new project's folder (in a new window when this one already has a folder open).
Verada: Check, Verada: Prove, Verada: Run and Verada: Build run veradic check, prove, run and build on the project of the current file: the nearest verada.toml at or above it. They are buttons in the editor title of Vada, Varc and Vibe files, and commands in the Command Palette. Each runs as a task, in a terminal of its own, in the project's directory: the terminal shows what veradic prints, its diagnostics written as file:line:column: error[CODE]: message with their notes, counterexamples and advice (the location links to the source), and a running program's output; what you type there goes to the program. The diagnostics also go to the Problems panel (with the source veradic), each run replacing the last run's. They come from veradic's JSON diagnostics, so the editor reads them exactly. A program that build writes lands in the project's directory (main, which the .gitignore of a new project leaves out). The buttons and commands save the project's changed files first.
The same four are tasks of the type verada, for the project at the root of each workspace folder and the current file's project: Terminal > Run Task… > verada. Build is the default build task, so Terminal > Run Build Task… (⇧⌘B on macOS, Ctrl+Shift+B elsewhere) builds at once. In tasks.json, a task names its command, and optionally its project (its directory or its verada.toml, relative to the workspace folder; by default the folder itself) and more arguments:
{
"version": "2.0.0",
"tasks": [
{ "type": "verada", "command": "build", "project": "app", "args": ["-o", "answer"], "group": "build", "label": "build answer" }
]
}The language server's diagnostics for open files are shown beside a task's; they agree, as both are veradic's checks.
The APL Workbench
For graphical APL editing, place the cursor in an APL expression and choose Verada: Open APL Workbench, or use the Open APL Workbench link above it. The APL Workbench guide walks through editing blocks, running an example, inspecting values and trying counterexample inputs. verada.apl.codeLens controls the links above expressions (code lenses the server gives) and is on by default.
Zed
The extension lives in editors/zed, with tree-sitter grammars for Vada and Varc in editors/tree-sitter-vada and editors/tree-sitter-varc. Install it with the command palette's zed: install dev extension, choosing editors/zed; Zed builds the extension and the grammars itself (it needs Rust, installed with rustup). Zed builds with the cargo and rustc its login shell's PATH finds, so ~/.cargo/bin must be on that PATH ahead of any other Rust, such as Homebrew's; otherwise the build stops because the wasm32-wasip2 target is missing. After changing the PATH, quit Zed and start it again.
The extension starts veradic lsp from PATH. To use another veradic, name it in lsp.veradic.binary; Zed then runs that executable itself, with the setting's arguments, so give lsp there:
{ "lsp": { "veradic": { "binary": { "path": "/path/to/veradic", "arguments": ["lsp"] } } } }The extension gives Vada and Varc files highlighting, brackets, an outline and (for Varc) indentation. Vibe is opt-in, so that Python projects without Verada are left alone; in a Verada project's .zed/settings.json:
{ "languages": { "Python": { "language_servers": ["veradic", "..."] } } }Zed draws code lenses only when its code_lens setting is "on"; its default is "off", and "menu" lists them in the code actions menu instead. The proof state above each subprogram and a failed proof's counterexample above the check are code lenses, so turn them on in Zed's user settings (~/.config/zed/settings.json):
{ "code_lens": "on" }Without them, a failed check is still a diagnostic, and its hover gives the counterexample, the failing inputs and the suggested precondition.
The APL Workbench opens from Zed in a browser: in an APL string, the code action Open APL Workbench in a browser (Cmd+.). Its edits reach Zed's buffer as workspace edits, and it asks before running examples. Its budgets are the workbench initialization option, under lsp.veradic.initialization_options.
Exact capabilities
| Advertised capability | Behavior and limits |
|---|---|
hoverProvider |
The entity's kind, name (as the source spells it) and type, or an expression's type; for a subprogram, its contracts as its declaration writes them |
definitionProvider |
The declaration; from a body's name or its end name, the declaration it completes |
referencesProvider |
Every place in the project that names the entity: uses, contracts, the declaration, bodies' names and their end names |
documentHighlightProvider |
The same places, in the document |
documentSymbolProvider |
The document's outline: packages, subprograms, types, objects and their bodies, nested |
workspaceSymbolProvider |
The declarations of the workspace's projects whose names hold the query's letters in order |
codeActionProvider |
Quick fixes derived from diagnostic edits whose ranges overlap the request, and on an APL expression Open APL Workbench (refactor.rewrite): for an editor that shows workbench panels (it says so with the client capability experimental.aplWorkbench), its command verada.aplWorkbench; for any other, Open APL Workbench in a browser, the server's command verada.aplWorkbench.browser |
executeCommandProvider |
verada.aplWorkbench.browser (a document URI and a position): opens a workbench panel on the APL expression there, served on loopback for a browser, and asks the editor to open its private address (window/showDocument, external), showing it in a message if the editor declines. The page's edits reach the editor through workspace/applyEdit; its examples run after the page allows them |
documentFormattingProvider |
Whole-document formatting; Vada/Varc canonical layout, Vibe identity |
completionProvider |
APL glyph input: inside APL text, a backtick and a key complete to the glyph |
renameProvider (with prepareProvider) |
Renames a declaration everywhere in the project that names it (its declaration, uses, contracts, bodies' names and end names). Declined, with the reason, for a reserved word or a string that is not a name, a library unit (its name is its files'), anything declared or named in Verada's library, a position on no name (the prefix of a selected name), and a new name with which the program would gain an error or any name in it would denote something else (a clash, or hiding another declaration) |
semanticTokensProvider (full) |
Each name coloured by what it denotes: namespace (packages), type (types, subtypes, exceptions), enumMember, function (subprograms, generic subprograms), parameter, variable (objects, named numbers, state abstractions); modifiers declaration, readonly (constants, named numbers, in parameters, literals) and defaultLibrary (Verada's library) |
signatureHelpProvider (on ( and ,) |
The profile of the subprogram whose call is being written, its contracts, and the parameter the cursor is at (by position, or by name after =>). While a call is half written and does not parse, the name before the open ( is looked up in the program as it last checked |
codeLensProvider |
Each subprogram's proof state above it (proving, proved, how many checks are not proved, or a proof pending for the text as it is now), and a failed proof's counterexample and failing inputs above the check; the server asks the editor to refresh them (workspace/codeLens/refresh) when they change. The titles are plain text; an editor whose clientInfo names VS Code (or VSCodium, Code - OSS, Cursor) gets VS Code's icons in them as well. Also Open APL Workbench above each APL expression (command verada.aplWorkbench, with the document's URI and the expression's start; for an editor without workbench panels, Open APL Workbench in a browser, verada.aplWorkbench.browser), unless the verada.apl.codeLens setting is off |
Requests outside the protocol serve the VS Code extension and the browser IDE. verada/aplSymbols gives the APL glyph vocabulary at a position inside APL text. The APL Workbench's are (an editor without panels uses the browser command above instead):
| Message | Behavior |
|---|---|
verada/aplWorkbench (request) |
The compiler's view of one expression: the file's APL expressions, their structure and blocks, catalogue and visible-name pages, checked edit and insertion proposals, and the preparation of examples (protocol 1, action with its parameters) |
verada/aplWorkbench/target (request) |
For a file-level command: the expression at a position, the sole expression, a choice among several (labels, previews, ranges), or none |
verada/aplWorkbench/open (request) |
Opens a panel (kind edit, at an expression, or insert, at an empty position with an empty selection); its identity and title. At most eight panels |
verada/aplWorkbench/message (request) |
A panel's webview message (connect, expressions, selectExpression, request, execute, apply, reveal, draft, encode, fixtures), answered by the panel's session: its result, or an error whose message the panel shows |
verada/aplWorkbench/hidden, verada/aplWorkbench/close (notifications) |
A panel was hidden (its preparation does not survive) or closed |
verada/aplWorkbench/stale (notification, server to editor) |
A panel's view of the source is stale: the source or one of its dependencies changed (cause source-change), or the panel's own edit was applied (canvas-edit). A browser panel's notice goes to its page instead |
A panel's edit is the compiler's exact proposal, which the server applies with workspace/applyEdit as a versioned change of the document: one Undo in the editor reverses it, and an edit to a document whose version has moved on is refused. The server waits for the editor's answer for the workbench's requestMs budget. The workbench's budgets are the initialization option and setting workbench (VS Code: verada.workbench.*), each a whole number; an unknown name or a value out of range is shown in a message and changes nothing. The server watches source and project files through workspace/didChangeWatchedFiles (the extension registers them), and documents are synchronized incrementally.
A diagnostic's message holds its label, notes, counterexample, failing inputs and help, as the command line shows them; a note about another place, a counterexample value that holds elsewhere and a secondary label are related information at their places. Unused variables, ineffective assignments, procedures with no effect and unreachable code are tagged, so editors fade them.
Document synchronization is incremental (change: 2), also accepting whole-text changes, with open/close and save notifications. Open and change check the document (a change after a short pause, so that typing does not start a check per key). When the check finds no error and a second passes without another change, the server proves the text as it is, in the background; save also proves. Open documents overlay disk contents for analysis. Diagnostics can cover dependencies; the server clears stale results, and the diagnostics of a document it closes.
Navigation needs a program that checks far enough to have its names resolved: after a syntax error it has nothing until the error is fixed. References search the document's whole project, or the document's own program when it has no project, and so does rename. Range formatting and a debug adapter are not provided; requests for them get a not-supported response.
Projects and workspace folders
Each document is checked in its project: the nearest verada.toml in its directory or above, else the one at the root of a workspace folder (rootUri or workspaceFolders, and their later changes). Its source directories, proof cache and certificates are that project's, so the server's own working directory does not matter. A file in no project is checked alone.
Progress and cancellation
Checks and proofs run in the background, one per document, so the server goes on answering while a proof runs. When the editor supports server-initiated progress, a proof shows as progress ("Proving main.vadb") that ends with its result ("proved", or the number of errors and warnings) and that the editor can cancel. A change to a document stops its running check or proof, whose result would be stale; what a stopped proof had proved stays in the project's proof cache, so the next proof starts from there. Requests also run in the background, and $/cancelRequest stops them (answered with error -32800).
The background prover
Two settings, given as initializationOptions ({"proof": {"trigger": ..., "notify": ...}}) or later as workspace/didChangeConfiguration ({"verada": {"proof": {...}}}), control it. The VS Code extension passes its verada.proof.trigger, verada.proof.notify and verada.proof.harvest settings; in Zed, put them under lsp.veradic.initialization_options.
| Setting | Values | Meaning |
|---|---|---|
proof.trigger |
idle (default), save |
Prove a second after a change that checks cleanly, or only on save |
proof.notify |
changes (default), always, never |
When to show a message (window/showMessage) with a proof's verdict: when the number of unproved checks changes, after every proof, or never |
proof.harvest |
true (default), false |
After a proof, start veradic harvest for the project, which finds what its costly proofs depend on in idle time |
Each subprogram's proof state is a code lens above it either way (in Zed, once its code_lens setting is on). A stopped proof keeps what it proved, and the next proof starts from there. The editor's proofs go into the project's proof cache, so veradic run in a terminal, which uses that cache, leaves out the checks the editor has proved, and veradic prove does not ask them again.
Single-clicking files in VS Code's Explorer can close and reopen preview tabs. On reopen, the server can reuse a recent successful proof after checking the project configuration, source contents and unsaved buffers against the inputs it proved. It keeps up to 16 such results per server. Changed inputs, an unavailable result or an explicit save take the normal checking and proof path. Selecting a tab that is already open only requests its annotations.
Columns and encodings
Positions are in UTF-16 code units, LSP's default, so a character outside the Basic Multilingual Plane counts as two columns. An editor that offers utf-32 or utf-8 in general.positionEncodings gets columns in code points or bytes instead, and the server names its choice in positionEncoding. APL's glyphs are all in the Basic Multilingual Plane.
A minimal Neovim recipe
This recipe uses the built-in LSP client (vim.lsp.start) without requiring a plugin. Open a supported source buffer, set the compiler's absolute path, and execute the Lua below (for example, save it as a local verada-editor.lua and use :luafile verada-editor.lua):
local compiler = "/absolute/path/to/veradic"
vim.lsp.start({
name = "veradic",
cmd = {compiler, "lsp"},
root_dir = vim.fs.root(0, "verada.toml"),
})For an automatic setup, call the same start operation in a FileType autocmd after assigning .vads/.vadb to Ada, .va to Varc and .vb to Python; start it for Python only where vim.fs.root(0, "verada.toml") finds a project. Useful actions are vim.lsp.buf.hover(), definition(), references(), rename(), signature_help(), document_symbol(), code_action() and format(); Neovim shows code lenses after vim.lsp.codelens.refresh(). To pass the background prover's settings, add init_options = { proof = { trigger = "save" } } to the table. Neovim's LSP configuration reference documents launch and root behavior.
Client-neutral setup
Configure a language-server client to launch the executable with argument lsp, no shell wrapper unless needed, file URI documents, incremental or whole-text change notifications, and the supported extension associations. Preserve the server's stdout exclusively for protocol frames; never print wrapper banners there. Supply a PATH that includes Z3 for proofs. The editor example is a small project to try a client against.
Diagnosing editor problems
Verify veradic check --project ... file in a shell first. If the editor shows missing-unit errors, check that the file is under the project's source directories. If proof appears only after save, proof.trigger is save; a proof also waits for a check without errors. If a proof says Z3 cannot start, fix the editor process's environment (its PATH), or set the extension's path to veradic. If formatting has no effect for Vibe, use your chosen Python formatter. If navigation disappears during an error, repair the blocking syntax error first. The VS Code extension logs to its Verada output channel; Zed's server log is under dev: open language server logs.