TREE-SITTER GRAMMAR (MOJO) — C, PACKAGED AS A NEOVIM PLUGIN — LUA

Blaze-ts.nvim
OVERVIEW
Blaze-ts.nvim is a Tree-sitter grammar for the Mojo programming language, packaged as a Neovim plugin: the grammar is adapted from tree-sitter-python's architecture and extended with Mojo constructs, and the plugin ships a prebuilt parser, Tree-sitter queries and opt-in editor integrations, with nvim-treesitter not required.
HOW IT WORKS
- 1`require("blaze-ts").setup({})` registers the `.mojo` (and `.🔥`) filetype, adds the plugin's `runtime/` directory so queries resolve, and registers the bundled parser (`parser/mojo.so`, plus a WebAssembly build at `parser/mojo.wasm`) with Neovim's built-in Tree-sitter support. Source: GitHub blaze-ts.nvim README.md, "Manual" installation.
- 2When nvim-treesitter is present, the plugin also registers a `mojo` parser config so `:TSInstall mojo` builds the parser from this repository's C sources (`src/parser.c`, `src/scanner.c`). Source: GitHub blaze-ts.nvim README.md.
- 3The grammar itself extends the Python-superset base with Mojo constructs — `fn`/`struct`/`trait`, `var`/`let`/`alias`, `raises` effect specifiers, argument conventions (`inout`, `owned`, `borrowed`, `out`, `read`, `mut`, `ref`), parametric declarations and f-string interpolation — parsed by an external scanner implementing indentation/newline/string tokens with fixed-size state (indent stack 128, delimiter stack 32). Source: GitHub blaze-ts.nvim README.md.
- 4The opinionated editor stack in `blaze-ts.config` is applied only when `setup()` receives one of its section tables (`ts`, `conform`, `lsp`, `completion`, `diagnostics`, `keymaps`, `filetype`); each integration degrades gracefully when its companion plugin or binary is absent. Source: GitHub blaze-ts.nvim README.md, "Commands and configuration".
- 5Correctness is gated by a Tree-sitter corpus suite (`test/corpus`, 24 cases including malformed-input cases), regenerable with `tree-sitter generate src/grammar.js` and rebuildable with `tree-sitter build`. Source: GitHub blaze-ts.nvim README.md, "Development".
CONCEPTS
CONFIGURATION
| Option | Default | What it does |
|---|---|---|
ts | (section table; `{}` enables it) | nvim-treesitter setup + parser registration section passed to `setup()` |
conform | (section table; `{}` enables it) | conform.nvim formatter definition (`mojo format`) section |
lsp | (section table; `{}` enables it) | mojo-lsp-server wiring section (requires the binary on PATH) |
completion | (section table; `{}` enables it) | omnifunc on Mojo buffers section |
diagnostics | (section table; `{}` enables it) | `vim.diagnostic` configuration section |
keymaps | (section table; `{}` enables it) | Buffer-local keymaps on Mojo buffers section |
filetype | (section table; `{}` enables it) | Filetype and buffer options section |
parser.auto_install | true | In the repo's `lazy.lua` spec opts: auto-install the Mojo parser |
nvim_treesitter.highlight.enable | true | In `lazy.lua` opts (`additional_vim_regex_highlighting = false`) |
nvim_treesitter.indent.enable | true | In `lazy.lua` opts |
auto_install (ts setup) | true | default(opts.auto_install, true)` in `Config.setup_ts |
sync_install (ts setup) | false | default(opts.sync_install, false)` in `Config.setup_ts |
ensure_installed (ts setup) | { "mojo" } | Parsers ensured by the ts setup when not overridden |
highlight / indent / fold (ts setup) | true each | default(opts.highlight, true)`, `default(opts.indent, true)`, `default(opts.fold, true) |
CONTROLS
| Action | Control |
|---|---|
| Run `require("blaze-ts").setup()` | :BlazeTS |
| Full health report (parser, queries, Mojo environment probe) | :BlazeHealth |
| Parser-only health (config registration, parser path, loadability) | :BlazeParserHealth |
| Reinstall parser (nvim-treesitter if available, else re-register bundled parser) | :BlazeReinstallParser |
| Blaze-TS health check (lazy spec key, Mojo buffers) | <leader>mh |
| Mojo parser health (lazy spec key, Mojo buffers) | <leader>mp |
| Reinstall Mojo parser (lazy spec key, Mojo buffers) | <leader>mr |
| Start / expand incremental selection | `<C-space>` (init and node-incremental) |
| Shrink incremental selection | `<BS>` (node-decremental) |
| Scope-incremental selection | <C-s> |
| Lua API equivalents | require("blaze-ts").health_check()`, `.parser_health()`, `.reinstall_parser() |
NOT COVERED
- The README documents the seven `setup()` section tables only as empty `{}` examples; the contents/defaults of the `conform`, `lsp`, `completion`, `diagnostics`, `keymaps` and `filetype` sections were not documented there (defaults above for the `ts` section come from `lua/blaze-ts/config.lua`). - The sandbox clone's README (`~/workspace/repos/blaze-ts.nvim/README.md`) is an older, different text (it routes setup through `require("blaze").setup()`, contains a broken lazy spec quote, and lists only highlighting/incremental parsing/indentation/semantic analysis as blaze.nvim uses); the GitHub README above supersedes it and the two disagree. - Language-binding status in the README: Swift bindings are present but explicitly not verified; the Node.js binding test is blocked upstream (tree-sitter JS runtime 0.25.1 has no prebuild for Node 26's ABI). Source: GitHub blaze-ts.nvim README.md, "Language bindings". - The README states the grammar is under active development with breaking changes expected until it is fully registered with nvim-treesitter.
REFERENCES
- Tree-sitter documentationThe parser generator and incremental parsing library the Mojo grammar is built with.
- Tree-sitter — Creating parsersThe grammar.js to generated-parser workflow Blaze-ts.nvim's development loop follows: write the grammar, generate, and test against a corpus.
- Tree-sitter — QueriesThe query language behind the highlight, indent, and fold captures the plugin ships.