VS Code Extension for Turmeric

The Turmeric VS Code extension provides syntax highlighting for .tur files, including support for both standard S-expression syntax and sweet-exp (indentation-based) syntax.

The extension lives in vscode-syntax-ext/ at the repo root and ships a pre-built .vsix package.

Installation

From the pre-built package

cd vscode-syntax-ext
code --install-extension turmeric-syntax-0.1.0.vsix

From source (development)

cd vscode-syntax-ext

# Option A: copy to extensions directory
mkdir -p ~/.vscode/extensions/turmeric-syntax-0.1.0
cp -r * ~/.vscode/extensions/turmeric-syntax-0.1.0/

# Option B: symlink for live editing
ln -s "$(pwd)" ~/.vscode/extensions/turmeric-syntax-dev

Reload VS Code after either option.

Features

Once installed, any .tur file is automatically highlighted:

Bracket and indentation support

{
  "[turmeric]": {
    "editor.tabSize": 2,
    "editor.insertSpaces": true,
    "editor.formatOnSave": false
  }
}

Scope names (for theme customization)

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

Known limitations

Rebuilding the .vsix

cd vscode-syntax-ext
npm install -g @vscode/vsce
vsce package
# produces turmeric-syntax-X.Y.Z.vsix

See also