migraine logoMigraine

Editor Setup

Configure editor support for .mg files — syntax highlighting, diagnostics, completions, and more

Migraine provides built-in editor support for .mg workflow files. Use migraine init --editor to automatically configure your editor.

Quick Start

# Auto-detect and configure all installed editors
migraine init --editor auto

# Configure a specific editor
migraine init --editor vscode
migraine init --editor neovim
migraine init --editor vim
migraine init --editor helix

Supported Editors

VS Code

Installs the bundled Migraine extension with:

  • Syntax highlighting — Full TextMate grammar for .mg files
  • Diagnostics — Real-time parse error detection
  • Autocompletion — Keywords, blocks, properties, value prefixes
  • Hover docs — Markdown documentation on hover
  • Document outline — Block structure in the sidebar
migraine init --editor vscode

Neovim

Writes configuration to ~/.config/nvim/:

  • LSP configurationlua/migraine_lsp.lua using lspconfig
  • Filetype detection.mg files mapped to migraine filetype
  • Syntax highlighting — Vim syntax definitions
migraine init --editor neovim

After setup, add to your init.lua:

require('migraine_lsp').setup()

-- Or with nvim-cmp:
require('migraine_lsp').setup({
  capabilities = require('cmp_nvim_lsp').default_capabilities(),
})

Vim

Writes configuration to ~/.vim/:

  • Filetype detection.mg files mapped to migraine filetype
  • Syntax highlighting — Vim syntax definitions
  • ALE linter — Integration with Asynchronous Lint Engine
migraine init --editor vim

Helix

Appends Migraine LSP configuration to languages.toml:

migraine init --editor helix

This adds an entry like:

[[language]]
name = "migraine"
scope = "source.mg"
file-types = ["mg"]
roots = ["migraine.yaml"]
comment-token = "#"

[language-server.migraine-lsp]
command = "migraine"
args = ["lsp"]

LSP Server

The Migraine LSP server runs via stdio and provides:

FeatureDescription
DiagnosticsParse errors shown inline
CompletionKeywords, blocks, properties, value prefixes
HoverDocumentation on hover
Document symbolsmetadata, workflow, config blocks in outline
Semantic tokensRich token-based highlighting

Starting the LSP manually

The LSP is started automatically by configured editors. To run it manually:

migraine lsp

This starts a JSON-RPC server on stdio, communicating via the Language Server Protocol.

Manual LSP Configuration

If you need to configure an editor manually, the LSP server command is:

command: migraine
args: ["lsp"]

File type: migraine
File extensions: .mg

Example: LSP with Neovim (manual)

lspconfig.migraine_lsp.setup({
  cmd = { 'migraine', 'lsp' },
  filetypes = { 'migraine' },
  root_dir = lspconfig.util.find_git_ancestor,
})

Example: LSP with Helix (manual)

Add to ~/.config/helix/languages.toml (or ~/Library/Preferences/helix/languages.toml on macOS):

[[language]]
name = "migraine"
scope = "source.mg"
file-types = ["mg"]
roots = ["migraine.yaml"]
comment-token = "#"

[language-server.migraine-lsp]
command = "migraine"
args = ["lsp"]

On this page