Pre-AlphaMetaScript is in early design phase. The compiler is not yet available.Join Discord for updates
MetaScript

Editor Setup

MetaScript has first-class editor support for Neovim, VS Code, and Zed. All three plugins share the same Tree-sitter grammar and LSP server, so you get a consistent experience everywhere.

What You Get

All plugins provide:

  • Syntax highlighting -- Tree-sitter powered, including JSX, match expressions, macros, and lifecycle hooks
  • LSP integration -- Completion, hover, go-to-definition, references, rename, diagnostics, inlay hints, semantic tokens
  • Smart indentation -- Auto-indent for blocks, functions, classes, match arms

VS Code

Install from Marketplace

  1. Open Extensions (Cmd+Shift+X / Ctrl+Shift+X)
  2. Search for "MetaScript"
  3. Click Install

Install from VSIX

Build and install locally:

cd tools/editor-plugin/vscode
npm install
npm run package
code --install-extension metascript-0.2.0.vsix

Configuration

SettingDefaultDescription
metascript.serverPath""Path to msc. Leave empty to auto-detect.
metascript.trace.server"off"LSP trace level: off, messages, verbose
metascript.diagnostics.enabletrueEnable inline diagnostics
metascript.inlayHints.enabletrueEnable inlay hints
metascript.semanticHighlighting.enabletrueEnable semantic tokens
metascript.completion.snippetstrueEnable snippet completions

Server Discovery

The extension searches for msc in order:

  1. metascript.serverPath setting (supports ~ expansion)
  2. Workspace: ./zig-out/bin/msc, ./bin/msc, ./node_modules/.bin/msc
  3. Extension directory: ./bin/msc
  4. System PATH

Commands

CommandDescription
MetaScript: Restart Language ServerStop and restart the LSP server
MetaScript: Expand Macro at CursorShow expanded form of a macro
MetaScript: Show Output ChannelOpen the MetaScript output panel

Status Bar

The status bar shows the language server state. Click it to restart:

  • Spinning icon -- server is starting
  • Check mark -- server is ready
  • Error icon -- server has stopped or crashed

Neovim

{
  "metascriptlang/metascript.nvim",
  ft = { "metascript" },
  dependencies = {
    "nvim-treesitter/nvim-treesitter",
  },
  opts = {
    server_path = "msc",
    lsp = true,
    treesitter = true,
  },
}

Install with packer.nvim

use {
  "metascriptlang/metascript.nvim",
  requires = { "nvim-treesitter/nvim-treesitter" },
  ft = { "metascript" },
  config = function()
    require("metascript").setup({
      server_path = "msc",
    })
  end,
}

Install with vim-plug

Plug 'nvim-treesitter/nvim-treesitter'
Plug 'metascriptlang/metascript.nvim'

" In your init.lua:
lua require('metascript').setup()

Compile the Tree-sitter Parser

After installing, compile the parser:

:TSInstall metascript

Verify

Run :checkhealth metascript to verify your setup. You should see green checks for the parser, LSP, and bundled queries.

Textobjects (optional)

Add nvim-treesitter-textobjects for motions like vaf (select around function), vif (select inner function), vac (around class), via (inner argument):

dependencies = {
  "nvim-treesitter/nvim-treesitter",
  "nvim-treesitter/nvim-treesitter-textobjects",
},

Commands

CommandDescription
:MetascriptInfoShow plugin info and diagnostic status
:MetascriptRestartServerRestart the language server
:checkhealth metascriptRun health checks

Zed

Install as Dev Extension

  1. Clone or locate the tools/editor-plugin/zed directory
  2. In Zed, open the command palette (Cmd+Shift+P)
  3. Run zed: install dev extension
  4. Select the zed/ directory

From Zed Extensions (when published)

Open Zed, go to Extensions (Cmd+Shift+X), search for "MetaScript", and click Install.

Features

The Zed extension provides:

  • Tree-sitter syntax highlighting (same grammar as Neovim)
  • LSP integration via msc lsp (auto-detected from PATH)
  • Smart indentation
  • Code outline (functions, classes, interfaces, enums, tests)
  • Bracket matching
  • Language injection for @emit strings (highlights embedded C)

Requirements

The msc binary must be on your system PATH. The extension will show an error if it cannot find it.


LSP Server

All three editors use the same language server: msc lsp. It communicates over stdio and provides:

FeatureDescription
CompletionContext-aware suggestions with type info
HoverType signatures and documentation
Go to DefinitionJump to symbol definitions
Find ReferencesAll usages across files
RenameProject-wide symbol rename
DiagnosticsInline errors and warnings
Inlay HintsInline type annotations
Semantic TokensEnhanced highlighting
Signature HelpFunction parameter hints

Verify the Server

# Check that msc is available
msc --version

# Test the LSP directly
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"capabilities":{}}}' | msc lsp

Troubleshooting

"msc not found" / "server not found"

Ensure msc is on your PATH:

export PATH="$HOME/.metascript/bin:$PATH"

Or set the path explicitly in your editor settings.

LSP not starting

  1. Verify msc lsp runs without errors in a terminal
  2. Check the editor's output/log panel for error details
  3. Try restarting the language server via the editor command

No syntax highlighting

  • Neovim: Run :TSInstall metascript to compile the parser, then :checkhealth metascript
  • VS Code: The TextMate grammar loads automatically. For semantic highlighting, ensure the server is running.
  • Zed: The grammar compiles automatically on first load. Restart Zed if highlighting doesn't appear.

Next Steps