Editor support
VS Code
Section titled “VS Code”editors/vscode in the repository is the extension:
- highlighting for the whole language (numeric widths, fixed-capacity types, f-strings, raw and byte strings, capabilities, behaviors);
- snippets for functions, types,
match,with,spawn, sandboxes and more; - bracket matching, comment toggling and folding;
- the language server.
Install it from the repository:
cd editors/vscodenpm installnpm run compilenpx @vscode/vsce packagecode --install-extension resid-lang-0.3.0.vsix| Setting | Default | |
|---|---|---|
resid.lsp.enable |
true |
run the language server |
resid.compilerPath |
"" |
the compiler; empty finds build/boot/stage2.bin in the workspace, then residc on PATH |
The language server
Section titled “The language server”The language server is the compiler: residc lsp speaks the Language
Server Protocol on standard input and output, running the compiler’s own
front end (import resolution, parsing, resolution and checking) on the
editor’s unsaved buffer. It provides:
- diagnostics on open, change and save: the compiler’s own errors, with their codes, in the file they occur in (including imported files);
- hover: the definition’s signature, its
///documentation and the expression’s type; - go to definition, across imports and into the standard library;
- document symbols: functions, types, behaviors and tests;
- completion of keywords and top-level names.
Any editor with an LSP client can use it: configure the command
residc lsp for .resid files. Each request is handled in its own
memory arena and open documents live in memory files, so the server’s
memory stays flat over a long session; checking the compiler’s own 8,000
lines takes under half a second.
