Vvinhnx

tree-sitter-0-24-to-0-25

Migrate Rust tree-sitter usage from 0.24 to 0.25: removed API renames and TSInput decode follow-up guidance

rusttree-sittermigration0.24-to-0.25parsingsyntax-tree
Public
1 executions
1 stars
How to Use
Run this codemod on your codebase using the following command

The easiest way to run this codemod without installing anything globally:

Documentation

tree-sitter-0-24-to-0-25

Migrate Rust tree-sitter crate usage from v0.24 to v0.25.

What it does

Automated

  • Rust method call: node.child_containing_descendant(desc)node.child_with_descendant(desc)
  • Rust UFCS: Node::child_containing_descendant(node, desc)Node::child_with_descendant(node, desc)
  • C FFI extern declaration: fn ts_node_child_containing_descendant(...)fn ts_node_child_with_descendant(...)
  • C FFI call site: ts_node_child_containing_descendant(p, d)ts_node_child_with_descendant(p, d)

Manual follow-up required

  • Update Cargo.toml: tree-sitter = "0.25" (manual follow-up)
  • TSInput struct now has a mandatory decode field — pass NULL for built-in decoders
  • Deprecated Parser::parse()parse_with_options() before v0.26 removes it
  • Deprecated QueryCursor::matches()/captures()*_with_options() before v0.26
  • Deprecated timeout/cancellation APIs → progress callback in ParseOptions before v0.26
  • ABI 15 parser regeneration for grammar maintainers (tree-sitter generate)
  • Web bindings: match.patternmatch.patternIndex, Language.query()new Query()

Usage

bash

Or locally:

bash

Testing

bash

References

Ready to contribute?

Build your own codemod and share it with the community.