Language Server
Ce contenu n’est pas encore disponible dans votre langue.
The mashin language server (LSP) provides IDE features for any editor that speaks the Language Server Protocol. It is built into the mashin CLI and works with VS Code, Zed, Neovim, Helix, Emacs, and any other LSP-capable editor.
Starting the language server
The language server runs in stdio mode:
mashin lspThis is what editor extensions call under the hood. You do not need to start it manually if you are using the VS Code or Zed extension.
Features
Completions
The language server suggests:
- Keywords:
machine,accepts,responds with,ensures,implements,compute,ask,decide,for_each, and all other mashinTalk keywords - Step types: With inline documentation for each type
- Stdlib machines: All
@mashin/actions/*machines with their input/output schemas - Context accessors:
context.input,context.cell,steps.*with field-level completions - Config options: Valid options for each step type (
using:,with task,returns, etc.)
Diagnostics
Real-time validation as you type:
- Syntax errors with line and column positions
- Unknown keywords or section types
- Missing required fields (e.g.,
askwithoutusing:orfrom:) - Type mismatches in
returnsdeclarations - Semantic validation from the 65-rule validator (SEM003-SEM064)
Hover
Hover over any keyword, step type, or stdlib machine reference to see documentation. Includes:
- Description of what the keyword does
- Expected child structure
- Examples
- Links to the reference docs
Go-to-definition
Navigate to:
- Stdlib machine definitions
- Local machine files (when referenced in
ask ... from:) - Step definitions (when referenced in expressions like
steps.my_step) - Input field declarations
Formatting
The language server formats .mashin files according to the canonical style:
- Consistent indentation (2 spaces)
- Canonical section ordering
- Normalized whitespace around operators
Trigger with your editor’s format command, or from the CLI:
mashin fmt my_machine.mashinConfiguration
Most editors auto-detect the language server from the extension. For manual configuration, point your editor at the mashin lsp command in stdio mode.
Neovim (via nvim-lspconfig)
local lspconfig = require('lspconfig')local configs = require('lspconfig.configs')
configs.mashin = { default_config = { cmd = { 'mashin', 'lsp' }, filetypes = { 'mashin' }, root_dir = lspconfig.util.root_pattern('mashin.toml', '.mashin'), },}
lspconfig.mashin.setup({})Helix
Add to ~/.config/helix/languages.toml:
[[language]]name = "mashin"scope = "source.mashin"file-types = ["mashin"]language-servers = ["mashin-lsp"]
[language-server.mashin-lsp]command = "mashin"args = ["lsp"]Next steps
- Editor Setup - VS Code and Zed extensions
- CLI Reference - All CLI commands