// VSCODE-ARB — ENGINEERING REPORT

VS Code / VSCodium support for arb · standalone TextMate grammar (source.arb) · LSP via arb --lsp · DAP via arb --dap · verified with vscode-textmate

>_EXECUTIVE SUMMARY

vscode-arb is the VS Code / VSCodium extension for arb — a Tcl/Tk-flavored declarative language for visualizing and modifying Unix pipelines, on the fusevm bytecode VM + Cranelift JIT. It ships a declarative language contribution (filetype, grammar, editor config), an LSP client that launches arb --lsp, a debug adapter that launches arb --dap, and a TextMate grammar (source.arb) covering the arb surface: widgets, query verbs, input sources, directives, widget paths, and -flags.

Design principle: mirror the proven vscode-stryke runtime wiring. The LSP transport is omitted so the client spawns bare arb --lsp and never appends --stdio (the arg-rejection / “connection got disposed” failure mode learned from vscode-stryke). The binary is resolved to an absolute path through $PATH plus common install dirs (~/.cargo/bin, /opt/homebrew/bin, …), so it works even when the editor is launched from the macOS Dock and doesn’t inherit the shell $PATH.

18
Widgets scoped
10
Input sources
8
Directives
5
Trigger actions
1
TextMate grammar
1
Detection path (*.arb)
16
Tokenizer assertions
2
Runtime channels (LSP + DAP)

~COMPONENTS

FileResponsibility
package.jsonExtension manifest — contributes.languages (id arb, *.arb), contributes.grammars (source.arb), contributes.configuration (LSP settings), contributes.commands (run / debug), contributes.debuggers (type arb), and the vscode-languageclient dependency.
language-configuration.jsonLine comment #, brackets, auto-closing / surrounding pairs, word pattern, and brace-based indentationRules.
extension.jsActivates on onLanguage:arb. Starts a LanguageClient running arb --lsp over stdio, registers the run command (terminal arb <file>), and registers a DebugAdapterDescriptorFactory launching arb --dap. Missing binary → one non-fatal warning; highlighting still works.
lib/resolveBinary.jsPure (vscode-free) resolver that turns the arb.path setting into an absolute, executable path — searching $PATH then the GUI-missed fallback dirs. Unit-tested in CI.
syntaxes/arb.tmLanguage.jsonTextMate grammar — comments, shebang, single/double strings, /.../ regex, numbers / durations / sizes, widgets, query verbs, input sources, directives, keywords, widget paths, flags, and operators.
scripts/tokenize_test.jsLoads the grammar under vscode-textmate + vscode-oniguruma (the engine VS Code itself uses) and asserts the scope of 16 sample tokens.

$SCOPE MAP

Token groupTextMate scopeSample
Widgetssupport.class.widget.arbtext table gauge bars spark tail select
Query verbssupport.function.arbfield where map tally sort_by group_by percentile
Input sourcessupport.constant.source.arbin in.json in.csv in.logfmt in.yaml
Directiveskeyword.other.directive.arbsource bind grid out timeout expect
Control flowkeyword.control.arbif elif else for while match return
Declarationsstorage.type.arbfn var let import save
Widget pathsvariable.other.widget-path.arb.codes .errors .ps.sel
Flagsvariable.parameter.flag.arb-label -max -cols -color
Operatorskeyword.operator.arb|> <- => ..
Literalsstring.* / constant.numeric / string.regexpstrings, numbers, durations, /.../ regex

#VERIFICATION

The grammar is loaded under the exact engine VS Code uses at runtime — vscode-textmate driving vscode-oniguruma — and a sample spec is tokenized with the resulting scopes asserted. This proves the grammar compiles under oniguruma and classifies arb tokens correctly, including the tricky cases: a /.../ regex literal distinguished from division, a dotted widget path such as .codes, a query verb in pipe position, and a -flag.

Sample tokenAsserted scope
gaugesupport.class.widget.arb
in.logfmtsupport.constant.source.arb
/^5/string.regexp.arb
.codesvariable.other.widget-path.arb
tallysupport.function.arb
source / -maxkeyword.other.directive.arb / variable.parameter.flag.arb