Zed extension for the Stim DSL -- syntax highlighting, indentation, and bracket matching for .stim files.
- Syntax Highlighting -- keywords, agent types, functions, strings, comments, operators
- Smart Indentation -- auto-indent after
{, auto-dedent on} - Bracket Matching -- auto-close
{},[],(), quotes - Comment Toggle --
//line comments via Cmd+/
- Open Zed
- Open the Extensions panel (Cmd+Shift+X)
- Search for "Stim"
- Click Install
The extension requires a compiled tree-sitter grammar. To build:
-
Install tree-sitter-cli:
npm install -g tree-sitter-cli
-
Generate the parser from
grammars/grammar.js:cd plugins/zed/grammars tree-sitter generate -
Copy or symlink the extension directory to your Zed extensions folder:
ln -s $(pwd)/plugins/zed ~/.config/zed/extensions/installed/stim
-
Restart Zed.
- Keywords:
command,if,else,for,while,in,break,task,parallel - Agent Types:
bash,explore,plan,general - Built-in Functions:
ask(),confirm(),wait_for_response(),create_file() - Strings:
"double"and'single'quoted with escape sequences - Comments:
// line comments - Operators:
+,==,!=,&&,||,!,=
zed/
├── extension.toml # Extension manifest
├── grammars/
│ └── grammar.js # Tree-sitter grammar source
└── languages/
└── stim/
├── config.toml # Language configuration
├── highlights.scm # Syntax highlighting queries
└── indents.scm # Indentation rules
The grammars/grammar.js file defines the full Stim grammar for tree-sitter, covering:
- Command declarations
- Variable assignments
- Control flow (
if/else,while,for,break) - Task statements (inline, with agent type, file references)
- Parallel blocks
- Function calls
- Expressions (strings, booleans, arrays, operators)
- Comments
To publish the grammar as a standalone tree-sitter package, copy grammar.js into a new tree-sitter-stim repository and run tree-sitter generate.
MIT