Packages

Elixir bindings to the tree-sitter-mf2 grammar. Incremental, error-recovering CST parser for ICU MessageFormat 2 (MF2) messages suitable for editor tooling and LSP use.

Current section

Files

Jump to
Raw

CHANGELOG.md

# Changelog
All notable changes to this project are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versioning follows [Semantic Versioning](https://semver.org/).
## [0.1.0] — April 19th, 2026
First published release of the Elixir NIF bindings to the MF2 tree-sitter grammar. Grammar ships from [`mf2_treesitter`](https://github.com/elixir-localize/mf2_treesitter); this package is the Elixir-specific consumer.
### Highlights
C NIF over the vendored tree-sitter C runtime. No Rust toolchain requirement, no system `libtree-sitter` dependency. Builds in one step via `elixir_make`.
Resource-typed NIF pattern:
* `TSTree` held as a NIF resource with a destructor that calls `ts_tree_delete`.
* `TSQuery` held as a NIF resource with a destructor that calls `ts_query_delete`.
* `TSNode` encoded as a tagged tuple `{:node, tree_resource, node_bytes}` so nodes keep their owning tree alive as long as they are reachable.
* Node accessors are O(1): a single NIF call + a `memcpy`.
Elixir API covers what an LSP server or editor backend would need:
* `Localize.Mf2.TreeSitter.parse/1`, `parse_incremental/3`, `changed_ranges/2`.
* `Localize.Mf2.TreeSitter.Node` — type, range, text, named/children, parent, siblings, descendant-for-byte-range, `error?`, `missing?`, `has_error?`, `to_sexp`.
* `Localize.Mf2.TreeSitter.Query` — load (by bundled name or path), captures, matches, pattern_count, capture_names.
* `Localize.Mf2.TreeSitter.Edit` — struct describing incremental edits.
* `Localize.Mf2.TreeSitter.diagnostics/1` — walk a tree and collect every ERROR/MISSING node for LSP `textDocument/publishDiagnostics` or inline-squiggle UX.