Skip to content

Releases: tree-sitter/py-tree-sitter

v0.23.2

24 Oct 15:31
d65416b
Compare
Choose a tag to compare

What's Changed

  • Update documentation on Query.captures() by @Bzero in #306
  • build: bump tree_sitter/core from 46bdc14 to f629fd4 by @dependabot in #307
  • fix(query): iterate over captures for the shortest size, not longest by @amaanq in #309

New Contributors

Full Changelog: v0.23.1...v0.23.2

v0.23.1

09 Oct 06:16
6e79db6
Compare
Choose a tag to compare

What's Changed

  • build: bump tree_sitter/core from 12fb318 to ee06325 by @dependabot in #286
  • ci: bump pypa/cibuildwheel from 2.20 to 2.21 in the actions group by @dependabot in #291

Full Changelog: v0.23.0...v0.23.1

v0.23.0

27 Aug 15:45
876fd40
Compare
Choose a tag to compare

Additions:

  • Node.child_containing_descendant(descendant)
  • Tree.language (getter)
  • Query.pattern_count (getter)
  • Query.capture_count (getter)
  • Query.match_limit (getter)
  • Query.did_exceed_match_limit (getter)
  • Query.set_match_limit(match_limit): returns self
  • Query.set_max_start_depth(max_start_depth): returns self
  • Query.set_byte_range(byte_range): returns self
  • Query.set_point_range(point_range): returns self
  • Query.disable_pattern(index): returns self
  • Query.disable_capture(capture): returns self
  • Query.pattern_settings(index)
  • Query.pattern_assertions(index)
  • Query.start_byte_for_pattern(index)
  • Query.end_byte_for_pattern(index)
  • Query.is_pattern_rooted(index)
  • Query.is_pattern_non_local(index)
  • Query.is_pattern_guaranteed_at_step(offset)
  • QueryError (exception class)
  • QueryPredicate (typing protocol)

Removals:

  • Parser.set_language(language)
  • Parser.set_included_ranges(ranges)
  • Parser.set_timeout_micros(timeout)
  • Node.sexp()
  • Tree.text()
  • TreeCursor.goto_first_child_for_point(row, column)
  • LookaheadIterator.reset(language, state)

Changes:

  • Language() accepts a capsule as an argument.
  • Parser.parse(...) no longer accepts a keep_text argument.
  • Query.captures(...)
    • Range arguments were removed (use set_* instead).
    • Added an argument for custom query predicates.
    • Return type was changed to dict[str, list[Node]].
  • Query.matches(...)
    • Range arguments were removed (use set_* instead).
    • Added an argument for custom query predicates.
    • Return type was changed to list[tuple[int, dict[str, list[Node]]]].
  • TreeCursor.goto_first_child_for_byte(byte) returns int | None.
  • TreeCursor.goto_first_child_for_point(point) returns int | None.

v0.22.3

18 May 21:15
2c0a6ee
Compare
Choose a tag to compare

Full Changelog: v0.22.2...v0.22.3

v0.22.2

16 May 19:35
a82d764
Compare
Choose a tag to compare

Full Changelog: v0.22.1...v0.22.2

v0.22.1

16 May 12:30
79df26e
Compare
Choose a tag to compare

Full Changelog: v0.22.0...v0.22.1

v0.22.0

13 May 20:04
454aa82
Compare
Choose a tag to compare

Breaking changes are marked with !.

Additions:

  • LANGUAGE_VERSION
  • MIN_COMPATIBLE_LANGUAGE_VERSION
  • Point(row, column)
  • Language.__repr__()
  • Language.__eq__(): checks ptr
  • Language.__int__(): returns ptr
  • Language.__index__(): returns ptr
  • Language.__hash__(): returns ptr
  • Node.__str__(): returns the S-expression
  • TreeCursor.goto_first_child_for_point(point)
  • TreeCursor.__copy__(): returns copy()
  • Query(language, source)
  • Parser(language, included_ranges, timeout_micros)
  • Parser.language (getter + setter)
  • Parser.included_ranges (getter + setter)
  • Parser.timeout_micros (getter + setter)
  • Range.__hash__()

Deprecations:

  • Node.sexp(): use str()
  • Tree.text: use root_node.text
  • TreeCursor.goto_first_child_for_point(row, column): use goto_first_child_for_point(point)
  • LookaheadIterator.reset(language, state): use reset_state(state, language)
  • Parser.set_language(language): use Parser(language) or language setter
  • Parser.set_included_ranges(ranges): use included_ranges setter
  • Parser.set_timeout_micros(timeout): use timeout_micros setter

Removals:

  • Language(path, name) !
  • Language.build_library(...) !
  • Language.name !
  • Language.lib
  • Language.language_id: use int()

Changes:

  • Language() only accepts a single integer argument. !
  • Parser.parse(...) accepts an optional encoding argument. !
  • TreeCursor.descendant_index is changed to a property. !
  • LookaheadIterator.language returns a Language instance. !
  • LookaheadIterator.reset_state(...) accepts an optional language argument.
  • Query.captures(...) arguments must be keywords (except for node).
  • Query.matches(...) arguments must be keywords (except for node).
  • Range.__repr__() prints attributes in the same order as the Range() arguments.
  • Range() arguments are no longer considered optional.

v0.21.3

26 Mar 10:29
5d52ace
Compare
Choose a tag to compare

Full Changelog: v0.21.2...v0.21.3

v0.21.2

22 Mar 18:55
30d3660
Compare
Choose a tag to compare

Full Changelog: v0.21.1...v0.21.2

v0.21.1

19 Mar 12:23
ce1af66
Compare
Choose a tag to compare

Full Changelog: v0.21.0...v0.21.1