Mah Language for VS Code
Editor support for Mah (.mh files):
- Syntax highlighting (a TextMate grammar covering Mah's keywords, structs/enums,
strings, numbers, and comments)
- Full language server support via
mah lsp — diagnostics, hover, go-to-definition
(including jumping into an imported file), and rename
- A custom file icon for
.mh files in the Explorer (VS Code's built-in icon themes
only — see File icon note below if you use a third-party icon theme)
Requirements
The mah CLI must be installed and on PATH. From the root of the mahlang repo:
make install-mah
This installs mah (see ../../Makefile), which the extension spawns as
mah lsp to talk LSP over stdio — the same server used by the Neovim
integration (editors/nvim), just launched by VS Code instead.
If mah isn't on PATH, or you want to point at a specific build, set:
{ "mah.serverPath": "/absolute/path/to/mah" }
Building and running locally (not yet published to the Marketplace)
From this directory:
npm install
npm run compile
Then either:
Press F5 in VS Code (with this folder open) to launch an Extension
Development Host with the extension loaded, or
Package a .vsix and install it manually:
npx @vscode/vsce package
code --install-extension mah-language-0.1.0.vsix
(Also available as make build-vscode from the repo root.)
File icon note
VS Code lets a language extension register a per-language file icon
(contributes.languages[].icon), which this extension does. It's shown by
VS Code's own built-in icon themes (e.g. "Seti (Visual Studio Code)"), but
popular third-party icon themes maintain their own language→icon tables and
don't read this field automatically:
vscode-icons: no built-in Mah icon yet; a PR to
vscode-icons/vscode-icons
adding the mah language ID would be the proper way to get one upstream.
Material Icon Theme: you can self-configure a mapping in your settings:
"material-icon-theme.languages.associations": { "mah": "python" }
(swap "python" for whichever bundled icon you'd like used in the meantime).