Editor tooling for ICU MessageFormat 2 (MF2) messages, maintained as a sibling of the localize Elixir library.
One grammar, several editor front-ends. Where the editor supports tree-sitter, it uses the shared tree-sitter-mf2/ grammar directly — same parse tree, same capture names, uniform highlighting across editors. Where the editor only supports regex grammars (VS Code TextMate, classic Vim), a separate per-editor implementation covers the same token classes.
| Folder | Editor(s) | Parser | Elixir ~M sigil injection |
|---|---|---|---|
tree-sitter-mf2/ |
Source of truth grammar (shared) | tree-sitter | — |
zed-mf2/ |
Zed | tree-sitter | ✅ |
nvim-mf2/ |
Neovim via nvim-treesitter | tree-sitter | ✅ |
helix-mf2/ |
Helix | tree-sitter | ✅ |
emacs-mf2/ |
Emacs 29+ via treesit.el |
tree-sitter | ✅ |
vscode-mf2/ |
Visual Studio Code | TextMate regex | ✅ |
vim-mf2/ |
Classic Vim | Vim regex | — |
The Localize library provides a ~M sigil for compile-time-validated MF2 messages. Every extension in this repo that supports injection will switch grammars inside ~M"...", ~M"""...""", ~M(...), and the lowercase ~m variants, so the inner text is highlighted (and, where tree-sitter is involved, structurally navigable) as MF2. Outside the sigil the file is plain Elixir.
Classic Vim cannot cleanly do this with its regex syntax engine — use Neovim with nvim-mf2 if you rely on sigil highlighting.
"TextMate grammar" is a regex-based format (.tmLanguage), originally from the TextMate editor, now consumed by VS Code, Sublime Text, Nova, and others. It is not tree-sitter, and none of those editors currently use tree-sitter as their primary highlighter for third-party languages:
- TextMate (the editor) — regex grammars only. Our
vscode-mf2/syntaxes/mf2.tmLanguage.jsonworks there directly. - VS Code — TextMate is the supported route for extensions. VS Code has some internal tree-sitter usage for a handful of built-in languages but no public API for third-party tree-sitter grammars yet.
- Sublime Text 4 — primary highlighter is
.sublime-syntax(a regex format derived from TextMate). Tree-sitter integration exists but is optional and requires additional plumbing per language. - Nova — regex only.
In practice, the same TextMate grammar file we ship for VS Code can be rewrapped for TextMate, Sublime Text, and Nova with trivial packaging changes. Tree-sitter-native editors (Neovim, Helix, Zed, Emacs 29+, Lapce) consume tree-sitter-mf2/ directly.
-
Sublime Text. Uses
.sublime-syntax(YAML) grammars. Writable from the TextMate grammar with modest translation effort. -
JetBrains IDEs (IntelliJ, WebStorm, RustRover, etc.). Requires a full JetBrains plugin project in Kotlin/Java — significant effort. Out of scope until demand exists.
-
Kakoune, Lapce, Nova. Niche; happy to accept PRs, not actively targeting.
If you want MF2 support in an editor not listed here and that editor supports tree-sitter, the tree-sitter-mf2/ grammar and queries should port over with very little work — most tree-sitter hosts use the same .scm query format.
The Localize Elixir library is a runtime / build-time package on hex.pm. Editor extensions:
- have different release cadences and registries (Zed Extensions, VS Code Marketplace, nvim-treesitter parser registry, vim-plug-able git repos);
- depend on different tooling (Node, tree-sitter CLI,
vsce); - target consumers who are not Elixir users and shouldn't need to install the hex package.
Keeping editor assets here avoids polluting the Elixir package with non-Elixir files and lets each artefact have its own versioning and CI.
Apache-2.0. See the root LICENSE file.