TypeRB for Visual Studio Code
Language support for TypeRB.
TypeRB and this extension are in preview. Language and tooling behavior may
change before the first stable release.
Features
- Syntax highlighting and declaration snippets
- Project-wide diagnostics and quick fixes
- Checked completion for declarations, members, and call arguments
- Explicit import insertion for compiler-owned standard types such as
Result
- Hover information and signature help
- Go to definition, references, symbol rename, and project-wide symbol search
- Checked symbol occurrence highlighting within the current document
- Syntax-aware expanding and shrinking selections
- Document outline for types, fields, functions, and methods
- Structural code folding for declarations and expression blocks
- Compiler-aware semantic highlighting
- Deterministic, comment-preserving document formatting
- Run, stop, and restart a project's top-level
main() through Visual Studio
Code's Run and Debug interface
- Source breakpoints, stepping, stack frames, and variable inspection for
mode: go
- Native Test Explorer discovery and execution for
*_test.trb suites
- Test debugging with TypeRB breakpoints and variables for
mode: go
The extension discovers every trbconfig.jsonc in the opened workspace and
keeps each project in an independent language-server session. A repository may
therefore contain Go, Ruby, and TypeScript applications with overlapping type
names. Project diagnostics and symbols update when TypeRB files are created,
changed, or deleted outside the active editor.
Requirements
Install the TypeRB compiler and make trb available on PATH:
brew install type-rb/tap/trb
trb version
Getting started
Open a folder containing trbconfig.jsonc, then open or create a .trb file.
The extension starts the TypeRB language server automatically.
Select ▶ Run above a top-level main() to run without debugging. Startup,
program output, and exit status appear in the Debug Console. Use Visual Studio
Code's standard Restart and Stop controls, or press Shift+F5 to stop the
process. TypeRB: Stop Project remains available from the Command Palette.
For a mode: go project, install Delve,
set breakpoints in .trb files, and press F5 or select Debug TypeRB in
Run and Debug. TypeRB emits Go debug information that refers directly to the
original TypeRB source, so Visual Studio Code's standard stepping, call stack,
variables, watches, and debug console are available. Ruby and TypeScript
projects currently support Run Without Debugging while their source-debugger
adapters are developed.
Open the Testing view to run every TypeRB test, a nested describe suite, or
one test case. The extension also shows ▶ Run Test above individual test
declarations. For Go projects, choose the Testing view's Debug Test action
or the CodeLens action to stop at .trb breakpoints and inspect variables.
Failures link to the original assertion in the .trb source. The project must
use a process runtime; TypeScript browser test hosting is not yet available.
Create a small Go-targeted project from a terminal with:
trb init --mode go --module example.com/hello hello
code hello
See A Tour of TypeRB for an introduction to
the language.
Configuration
typerb.server.path selects the trb executable. The default is trb from
PATH; relative paths are resolved from the workspace folder.
typerb.server.config adds an explicit trbconfig.jsonc when automatic
workspace discovery is not sufficient. Relative paths are resolved from the
workspace folder.
typerb.debug.go.path selects the Delve executable for Go source debugging.
The default is dlv from PATH.
Run and Debug selects the active TypeRB project automatically. A launch.json
configuration may set config, args, and env when explicit control is
needed:
{
"type": "typerb",
"request": "launch",
"name": "Debug API",
"config": "${workspaceFolder}/apps/api/trbconfig.jsonc",
"args": ["serve"],
"env": {
"PORT": "4000"
}
}
If Visual Studio Code cannot find a Homebrew installation, set
typerb.server.path to the result of command -v trb.
Documentation
Read the TypeRB documentation
for the language, CLI, packages, and target guides.