The Turmeric VS Code extension provides syntax highlighting for .tur files
(both standard S-expression syntax and sweet-exp indentation-based syntax),
document formatting via tur format, and a language client that launches the
compiler's built-in language server (tur lsp).
The extension lives in vscode-syntax-ext/ at the repo root.
cd vscode-syntax-ext
# Option A: copy to extensions directory
mkdir -p ~/.vscode/extensions/turmeric-syntax-0.2.0
cp -r * ~/.vscode/extensions/turmeric-syntax-0.2.0/
# Option B: symlink for live editing
ln -s "$(pwd)" ~/.vscode/extensions/turmeric-syntax-dev
Reload VS Code after either option.
.vsixBuild the package (see "Building a .vsix" below), then:
code --install-extension turmeric-syntax-0.2.0.vsix
Once installed, any .tur file is automatically highlighted:
defn, let, if, match, handle, defclass,
definstance, defeffect, and all other Turmeric special formscons, car, cdr, map, filter, etc.0xFF), binary (0b1010),
scientific notation, strings, booleans (#t, #f), characters (#\a);) and block comments (#| ... |#)->, ->>, |>)'), quasiquote (`), unquote (,)(), [], {}Cmd+/ (; for line comments)The extension registers a document formatter that pipes the buffer through
tur format (requires tur on PATH). Use the standard Format Document
command, the extension's "Format Turmeric Document" command, or enable
editor.formatOnSave for the [turmeric] language.
The extension launches tur lsp for .tur files (diagnostics, hover docs,
go-to-definition). The turmeric.serverPath setting (default "tur")
points it at the executable to use.
{
"[turmeric]": {
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.formatOnSave": false
}
}
| Scope | Matches |
|---|---|
keyword.control.turmeric |
if, match, loop, while, etc. |
keyword.definition.turmeric |
defn, defmacro, defstruct, etc. |
keyword.type.turmeric |
:int, :cstr, type annotations |
keyword.effect.turmeric |
defeffect, handle, perform |
support.function.builtin.turmeric |
Built-in functions |
entity.name.function.turmeric |
User-defined function names |
constant.numeric.integer.turmeric |
Integer literals |
constant.numeric.float.turmeric |
Float literals |
constant.language.boolean.true.turmeric |
#t |
constant.language.boolean.false.turmeric |
#f |
constant.character.turmeric |
Character literals |
string.quoted.double.turmeric |
String literals |
comment.line.semicolon.turmeric |
Line comments |
comment.block.turmeric |
Block comments |
tur binary on PATH (or a
turmeric.serverPath setting pointing at one)..vsixcd vscode-syntax-ext
npm install -g @vscode/vsce
vsce package
# produces turmeric-syntax-X.Y.Z.vsix
vscode-syntax-ext/ -- Extension sourcevscode-syntax-ext/syntaxes/turmeric.tmLanguage.json -- TextMate grammarvscode-syntax-ext/language-configuration.json -- Bracket / comment configtur format CLI the
extension's formatter shells out to