Aller au contenu
Developer Preview — APIs and language features may change before 1.0

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.

The VS Code extension provides syntax highlighting, completions, hover documentation, go-to-definition, formatting, and diagnostics.

Install from the marketplace (search “mashin”) or install locally for development:

Terminal window
# Symlink the extension into your VS Code extensions directory
ln -s /path/to/mashin-core/tools/mashin-vscode ~/.vscode/extensions/mashin-language

Restart VS Code. Open any .mashin file to verify syntax highlighting.

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

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 action 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

The extension ships with a bundled server, so completions, diagnostics and formatting work out of the box with no build step.

To use the full mashin language server instead (the same one the CLI runs), point the extension at it in VS Code settings:

{
"mashin.languageServer.command": "mashin lsp"
}

mashin lsp speaks LSP over stdio and needs no computer running.

The Zed extension uses the tree-sitter grammar for syntax highlighting and connects to the language server for completions, hover, and diagnostics.

In Zed, open the Extensions panel (Cmd+Shift+X), select “Install Dev Extension…”, and point it at the tools/mashin-zed/ directory.

Add to your Zed settings (~/.config/zed/settings.json):

{
"lsp": {
"mashin-language-server": {
"binary": {
"path": "mashin",
"arguments": ["lsp"]
}
}
}
}

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)

For editors like Neovim, Helix, or Emacs (with tree-sitter support):

  1. Clone or link the tools/tree-sitter-mashin-talk/ directory
  2. Build the parser: cd tools/tree-sitter-mashin-talk && tree-sitter generate && tree-sitter build
  3. Configure your editor to use the grammar for .mashin files
  4. Copy the highlight queries from tools/tree-sitter-mashin-talk/queries/ into your editor’s query directory