Skip to content

`vscode-bynk`

The Visual Studio Code extension for Bynk. It provides syntax highlighting plus the full language-server experience by launching bynkc-lsp. For step-by-step setup, see the how-to Set up editor support; this page is the reference.

  • Syntax highlighting (a TextMate grammar, mirrored from tree-sitter-bynk).
  • Live diagnostics, hover with type signatures and doc blocks, and go-to-definition — all from the bundled bynkc-lsp.
  • Format-on-save via the shared formatter (honours editor.formatOnSave).
  • Status-bar items showing the project name and compiler version.
  • Snippets for every construct — type a prefix (context, commons, type, enum, fn, capability, provides, service, on http, on cron, agent, actor, suite, property, uses, consumes) and press Tab to scaffold it, then tab through the placeholders.
  • Scaffolding commandsBynk: New Project (scaffolds bynk.toml + src/<name>.bynk) and Bynk: New Context (adds a context file). Both refuse to overwrite an existing file.
  • Run/Debug Tests from the editor — run and debug buttons in the editor title bar and right-click menu on a .bynk file, plus a Ctrl/Cmd+; chord (; then t to run, ; then d to debug). Bynk’s Command Palette and explorer entries are scoped to Bynk projects, so they stay out of the way elsewhere.
  • Per-case run/debug lenses — a ▷ Run Test / Debug Test CodeLens above each case runs (or debugs) that case, not the whole project — it shells bynkc test --case "<name>", the CLI’s exact-name run filter.
  • Provider CodeLens on capabilities — a capability declaration shows an N providers lens listing the services that provides it, alongside the N references lens; click to peek the provider definitions.
  • Refinement-family CodeLens — a refined/opaque type (or plain alias) over a builtin base shows an N refinements of String lens listing every type over the same base across the project; click to peek the family. (A lone refinement gets no lens — there is nothing to navigate to.)
  • Inline doc-comment rendering — doc comments (--- … ---) render in place with light Markdown affordances while you read the source: heading lines are coloured (a themeable bynk.docHeadingForeground, paired with bold so the cue is not colour-only), **bold** renders bold, and *italic* renders italic. Markers stay visible and the font size is never touched, so line height is stable (style-in-place, not conceal-and-reveal). The [Name] links inside a doc comment are clickable via document links. Toggle with bynk.inlineDocRendering.enable.
  • Show Documentation — the Bynk: Show Documentation command opens a webview rendering the current file’s declarations as a reference page (“live rustdoc for Bynk”): each declaration’s heading, signature, and doc comment rendered as Markdown, in outline order and hierarchy, each heading clickable back to its source. Undocumented declarations appear with a No documentation note so the page doubles as a doc-coverage view (a toggle hides them for a clean read). Doc-comment Markdown is rendered with HTML disabled; the page reads the source’s own doc comments, distinct from this documentation site. (Served by the language server’s bynk/documentationModel request.)
  • Show Architecture Map — the Bynk: Show Architecture Map command opens a webview mapping the active file’s whole project: one box per context/ adapter, an arrow per consumes (labelled with its selected capabilities where braced), and each box’s capabilities/providers/services/agents — collapsed by default, click the +/ toggle next to a box to expand it to its declarations. Every box and declaration is clickable back to its source — a whole-project map, complementing the language server’s per-handler sequence-diagram request. (Served by the language server’s bynk/architectureModel request.)
  • A Get Started with Bynk walkthrough (Welcome page → Help → walkthroughs) that sets up a project and a first context.
  • A bynkc: check build task (Terminal → Run Task) that type-checks the whole project and routes errors — including in files you haven’t opened — into the Problems panel via the $bynkc problem-matcher.

The extension activates on opening a .bynk file or any workspace containing a bynk.toml.

From the vscode-bynk/ directory:

Terminal window
npm install
npm run build # tsc -p .
npx vsce package # produces a .vsix
code --install-extension bynk-vscode-*.vsix

The extension needs bynkc-lsp available — build it with cargo build --release -p bynk-lsp and put it on PATH, or set bynk.executablePath.

SettingDefaultPurpose
bynk.executablePathbynkc-lspPath to the language-server binary.
bynk.compilerPathbynkcPath to the bynkc compiler used by the bynkc: check build task.
bynk.trace.serveroffTrace LSP traffic (off / messages / verbose) in the “Bynk LSP” output channel.
bynk.inlineDocRendering.enabletrueRender doc comments in place with heading colour, bold, and italic.
PathWhat it is
src/extension.tsEntry point: resolves and launches bynkc-lsp over stdio.
src/inlineDoc.tsPure doc-comment Markdown tokenizer → heading/bold/italic ranges.
src/inlineDocRendering.tsApplies those ranges as in-editor decorations (the inlineDoc.ts consumer).
src/scaffold.tsThe New Project / New Context command handlers.
src/webviewHost.tsThe shared webview substrate: CSP + per-render nonce, the payload-embedding HTML shell, and postMessage→reveal click-to-code — built once, consumed by both webviews below.
src/sequenceDiagram.tsThe Show Sequence Diagram command + panel (bynk/sequenceModel).
src/documentationView.tsThe Show Documentation command + panel (bynk/documentationModel).
src/architectureMap.tsThe Show Architecture Map command + panel (bynk/architectureModel).
src/webview/The browser-context webview bundles: main.ts/mermaid-gen.ts (sequence, vendored Mermaid) and docview.ts/doc-render.ts (documentation, vendored markdown-it).
src/tasks.tsThe bynkc: check build-task provider.
snippets/bynk.jsonConstruct scaffolds, wired via contributes.snippets.
walkthroughs/*.mdThe getting-started walkthrough steps.
syntaxes/bynk.tmLanguage.jsonTextMate grammar (highlighting fallback).
language-configuration.jsonBrackets, comments, and editor behaviour.
package.jsonManifest: activation events, settings, commands, build scripts.