Editor Setup
This guide covers syntax highlighting and editor support for BtScript files (.bts).
VS Code
Installation
-
Copy the
vscodefolder to your VS Code extensions directory:- Linux/macOS:
~/.vscode/extensions/btscript-0.1.0 - Windows:
%USERPROFILE%\.vscode\extensions\btscript-0.1.0
- Linux/macOS:
-
Restart VS Code
Or for development:
cd editors/vscode
code --extensionDevelopmentPath=$(pwd)
Features
- Syntax highlighting for all BtScript constructs
- Bracket matching and auto-closing
- Comment toggling
Emacs
Installation
Copy emacs/btscript-mode.el to your Emacs load path and add to your init file:
(require 'btscript-mode)
Or with use-package:
(use-package btscript-mode
:load-path "/path/to/btscript/editors/emacs"
:mode "\\.bts\\'")
Features
- Syntax highlighting for keywords, special forms, built-ins
- SRFI-88 keyword highlighting (
word:postfix style) - Pipe-quoted symbol highlighting (
|btft:task-name;1.0.0|) - Automatic indentation
- Comment support (
;) - Imenu integration (navigate flows, tasks, functions, structs, enums)
- Electric pairs for parentheses and strings
IntelliJ IDEA / Rider
Installation
- Open Settings > Editor > TextMate Bundles
- Click "+" and select the
btscript.tmbundledirectory - Restart the IDE
Features
- Syntax highlighting via TextMate grammar (same as VS Code)
What Gets Highlighted
| Element | Example | Typical Color |
|---|---|---|
| Special forms | flow, task, function, trigger, let, defstruct | Purple/keyword |
| Keywords | id:, window:, as:, version: | Blue/type |
| Built-in functions | rolling-avg, latest, ceiling, array-avg | Cyan/function |
| Operators | +, >, and, mod | Operator |
| BTI references | btft:rolling-avg;1.0.0 | Type |
| Pipe-quoted symbols | |btft:task;1.0.0| | Type |
| Durations | PT5M, PT1H30S | Number |
| Strings | "sensor.temp" | String |
| Numbers | 42, 3.14 | Number |
| Booleans | true, #f | Constant |
| Definitions | function/variable/struct names | Function/variable/type |
| Predicates | null?, is-valid? | Function |
| Mutators | set!, clear! | Warning |
| Comments | ; comment | Comment |