Editor Setup
Ce contenu n’est pas encore disponible dans votre langue.
mashin provides editor extensions for VS Code and Zed, plus a tree-sitter grammar that works with any editor that supports tree-sitter.
VS Code
The VS Code extension provides syntax highlighting, completions, hover documentation, go-to-definition, formatting, and diagnostics.
Installation
Install from the marketplace (search “mashin”) or install locally for development:
# Symlink the extension into your VS Code extensions directoryln -s /path/to/mashin-core/tools/mashin-vscode ~/.vscode/extensions/mashin-languageRestart VS Code. Open any .mashin file to verify syntax highlighting.
Features
| Feature | What it does |
|---|---|
| Syntax highlighting | Full mashinTalk grammar (TextMate) |
| Completions | Keywords, step types, @mashin/actions/* machines, config options |
| Hover | Documentation for keywords, step types, stdlib machines, context accessors |
| Go-to-definition | Navigate to stdlib machines, local machines, steps, input fields |
| Formatting | Format via the mashin language server |
| Diagnostics | Real-time validation of machine structure and syntax |
| Snippets | 25+ templates for machines, steps, goals, and common patterns |
Snippets
Type these prefixes and press Tab:
| Prefix | Creates |
|---|---|
machine | New machine skeleton |
step-reason | LLM reasoning step |
step-code | Pure computation step |
step-call | Call an effect machine |
step-memory | Memory operation step |
inputs | Input schema block |
outputs | Output schema block |
goal | Goal specification |
call-http-get | Call @mashin/actions/http/get |
call-http-post | Call @mashin/actions/http/post |
permissions | Permission policies |
hooks | Step hooks/middleware |
Enabling the language server
For full LSP features (completions, diagnostics, formatting), build the language server and configure VS Code to use it:
# From the mashin-core project rootmix escript.build --app mashin_language_serverThe extension will detect the language server automatically if it is in your PATH as mashin-language-server, or you can configure the path in VS Code settings.
Zed
The Zed extension uses the tree-sitter grammar for syntax highlighting and connects to the language server for completions, hover, and diagnostics.
Installation
In Zed, open the Extensions panel (Cmd+Shift+X), select “Install Dev Extension…”, and point it at the tools/mashin-zed/ directory.
Enabling the language server
Add to your Zed settings (~/.config/zed/settings.json):
{ "lsp": { "mashin-language-server": { "binary": { "path": "/path/to/mashin-core/mashin_language_server", "arguments": ["--stdio"] } } }}Tree-sitter grammar
The tree-sitter grammar is the canonical definition of mashinTalk syntax. Any editor with tree-sitter support can use it.
The grammar lives at tools/tree-sitter-mashin-talk/grammar.js. It handles the full mashinTalk keyword-hierarchy syntax including:
- Machine declarations and all section types
- Step types (
compute,ask,decide,for_each, etc.) - Expressions (arithmetic, string interpolation, arrow functions, match expressions)
- Comments (line and block)
Using with other editors
For editors like Neovim, Helix, or Emacs (with tree-sitter support):
- Clone or link the
tools/tree-sitter-mashin-talk/directory - Build the parser:
cd tools/tree-sitter-mashin-talk && tree-sitter generate && tree-sitter build - Configure your editor to use the grammar for
.mashinfiles - Copy the highlight queries from
tools/tree-sitter-mashin-talk/queries/into your editor’s query directory
Next steps
- Language Server - Full LSP feature reference
- CLI Reference - The command-line tool