`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.
Features
Section titled “Features”- 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 commands — Bynk: New Project (scaffolds
bynk.toml+src/<name>.bynk) and Bynk: New Context (adds acontextfile). 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
.bynkfile, 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 TestCodeLens above eachcaseruns (or debugs) that case, not the whole project — it shellsbynkc test --case "<name>", the CLI’s exact-name run filter. - Provider CodeLens on capabilities — a
capabilitydeclaration shows anN providerslens listing the services thatprovidesit, alongside theN referenceslens; click to peek the provider definitions. - Refinement-family CodeLens — a refined/opaque
type(or plain alias) over a builtin base shows anN refinements of Stringlens 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 themeablebynk.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 withbynk.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/documentationModelrequest.) - 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’sbynk/architectureModelrequest.) - A Get Started with Bynk walkthrough (Welcome page → Help → walkthroughs) that sets up a project and a first context.
- A
bynkc: checkbuild 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$bynkcproblem-matcher.
The extension activates on opening a .bynk file or any workspace containing a
bynk.toml.
Build and install
Section titled “Build and install”From the vscode-bynk/ directory:
npm installnpm run build # tsc -p .npx vsce package # produces a .vsixcode --install-extension bynk-vscode-*.vsixThe extension needs bynkc-lsp available — build it with
cargo build --release -p bynk-lsp and put it on PATH, or set
bynk.executablePath.
Settings
Section titled “Settings”| Setting | Default | Purpose |
|---|---|---|
bynk.executablePath | bynkc-lsp | Path to the language-server binary. |
bynk.compilerPath | bynkc | Path to the bynkc compiler used by the bynkc: check build task. |
bynk.trace.server | off | Trace LSP traffic (off / messages / verbose) in the “Bynk LSP” output channel. |
bynk.inlineDocRendering.enable | true | Render doc comments in place with heading colour, bold, and italic. |
Layout
Section titled “Layout”| Path | What it is |
|---|---|
src/extension.ts | Entry point: resolves and launches bynkc-lsp over stdio. |
src/inlineDoc.ts | Pure doc-comment Markdown tokenizer → heading/bold/italic ranges. |
src/inlineDocRendering.ts | Applies those ranges as in-editor decorations (the inlineDoc.ts consumer). |
src/scaffold.ts | The New Project / New Context command handlers. |
src/webviewHost.ts | The 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.ts | The Show Sequence Diagram command + panel (bynk/sequenceModel). |
src/documentationView.ts | The Show Documentation command + panel (bynk/documentationModel). |
src/architectureMap.ts | The 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.ts | The bynkc: check build-task provider. |
snippets/bynk.json | Construct scaffolds, wired via contributes.snippets. |
walkthroughs/*.md | The getting-started walkthrough steps. |
syntaxes/bynk.tmLanguage.json | TextMate grammar (highlighting fallback). |
language-configuration.json | Brackets, comments, and editor behaviour. |
package.json | Manifest: activation events, settings, commands, build scripts. |