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
- Open Extensions (
Cmd+Shift+X/Ctrl+Shift+X) - Search for "MetaScript"
- 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.vsixConfiguration
| Setting | Default | Description |
|---|---|---|
metascript.serverPath | "" | Path to msc. Leave empty to auto-detect. |
metascript.trace.server | "off" | LSP trace level: off, messages, verbose |
metascript.diagnostics.enable | true | Enable inline diagnostics |
metascript.inlayHints.enable | true | Enable inlay hints |
metascript.semanticHighlighting.enable | true | Enable semantic tokens |
metascript.completion.snippets | true | Enable snippet completions |
Server Discovery
The extension searches for msc in order:
metascript.serverPathsetting (supports~expansion)- Workspace:
./zig-out/bin/msc,./bin/msc,./node_modules/.bin/msc - Extension directory:
./bin/msc - System PATH
Commands
| Command | Description |
|---|---|
MetaScript: Restart Language Server | Stop and restart the LSP server |
MetaScript: Expand Macro at Cursor | Show expanded form of a macro |
MetaScript: Show Output Channel | Open 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
Install with lazy.nvim (recommended)
{
"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 metascriptVerify
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
| Command | Description |
|---|---|
:MetascriptInfo | Show plugin info and diagnostic status |
:MetascriptRestartServer | Restart the language server |
:checkhealth metascript | Run health checks |
Zed
Install as Dev Extension
- Clone or locate the
tools/editor-plugin/zeddirectory - In Zed, open the command palette (
Cmd+Shift+P) - Run
zed: install dev extension - 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
@emitstrings (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:
| Feature | Description |
|---|---|
| Completion | Context-aware suggestions with type info |
| Hover | Type signatures and documentation |
| Go to Definition | Jump to symbol definitions |
| Find References | All usages across files |
| Rename | Project-wide symbol rename |
| Diagnostics | Inline errors and warnings |
| Inlay Hints | Inline type annotations |
| Semantic Tokens | Enhanced highlighting |
| Signature Help | Function 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 lspTroubleshooting
"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
- Verify
msc lspruns without errors in a terminal - Check the editor's output/log panel for error details
- Try restarting the language server via the editor command
No syntax highlighting
- Neovim: Run
:TSInstall metascriptto 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
- Quick Start -- Write your first MetaScript program
- Language Reference -- Full syntax reference
- Compile Targets -- C, JavaScript, and Erlang backends