Roc for Visual Studio CodeOfficial Roc language support, powered by the language server built into the Features
ThanksThanks to Luke Boswell, whose roc-vscode showed how to test the packaged VSIX, and inspired the language feature, editing and server lifecycle tests here. Getting
|
| Setting | Default | Description |
|---|---|---|
roc.path |
"" |
Path to the roc executable. ~ and ${userHome} are expanded. |
roc.server.args |
["experimental-lsp"] |
Arguments that start the language server. |
roc.server.debugFlags |
[] |
Any of --debug-transport, --debug-build, --debug-syntax, --debug-server. The log file path appears in the Roc output. Transport logs contain your source code. |
roc.nightly.checkForUpdates |
true |
Weekly update check for the nightly installed by the extension. |
roc.trace.server |
"off" |
Log language server messages to the Roc output. |
Tasks
// .vscode/tasks.json
{
"version": "2.0.0",
"tasks": [
{ "type": "roc", "command": "test", "file": "main.roc", "label": "roc test" },
{ "type": "roc", "command": "run", "file": "main.roc", "args": ["--", "arg1"], "label": "roc run" }
]
}
Development
npm ci # install pinned dependencies (install scripts are disabled in .npmrc)
npm run check # typecheck
npm test # unit tests and grammar snapshot tests
npm run test:nightly # install the nightly pinned in test/roc-nightly.txt into .vscode-test/roc with the extension's installer
ROC_PATH=/path/to/roc npm run test:integration # package, install and test the VSIX in a real VS Code
npm run package # build roc-<version>.vsix
The integration tests install the packaged VSIX into a fresh VS Code profile, so packaging mistakes show up. They run once in a trusted and once in a restricted workspace, and check language features, editing, and restarting and stopping the language server. ROC_VSIX tests an existing VSIX instead of packaging one, VSCODE_VERSION picks the VS Code build, and ROC_TEST_GREP runs only the tests whose name contains it. CI also checks the VSIX contents against test/vsix-files.txt.
Press F5 to try changes in a new VS Code window.
The TextMate grammar lives in syntaxes/roc.tmLanguage.json. After changing it, run npm run test:grammar -- --update and review the snapshot diff in test/grammar/fixtures/.
Dependencies are deliberately few: vscode-languageclient at runtime, and Microsoft's or esbuild's own tooling for development. New versions are only adopted once they have been published for at least two weeks.