コンテンツにスキップ
Developer Preview — APIs and language features may change before 1.0

Editor Setup

このコンテンツはまだ日本語訳がありません。

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:

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.

Features

FeatureWhat it does
Syntax highlightingFull mashinTalk grammar (TextMate)
CompletionsKeywords, step types, @mashin/actions/* machines, config options
HoverDocumentation for keywords, step types, stdlib machines, context accessors
Go-to-definitionNavigate to stdlib machines, local machines, steps, input fields
FormattingFormat via the mashin language server
DiagnosticsReal-time validation of machine structure and syntax
Snippets25+ templates for machines, steps, goals, and common patterns

Snippets

Type these prefixes and press Tab:

PrefixCreates
machineNew machine skeleton
step-reasonLLM reasoning step
step-codePure computation step
step-callCall an effect machine
step-memoryMemory operation step
inputsInput schema block
outputsOutput schema block
goalGoal specification
call-http-getCall @mashin/actions/http/get
call-http-postCall @mashin/actions/http/post
permissionsPermission policies
hooksStep hooks/middleware

Enabling the language server

For full LSP features (completions, diagnostics, formatting), build the language server and configure VS Code to use it:

Terminal window
# From the mashin-core project root
mix escript.build --app mashin_language_server

The 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):

  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

Next steps