Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

v4.0.0

Choose a tag to compare

@github-actions github-actions released this 18 Nov 06:26
· 78 commits to dev since this release
a0e3ea8

android-tree-sitter v4.0.0

This is a major release of Android Tree Sitter which includes the following changes :

  • Maven group ID for ATS has been changed from com.itsaky.androidide to com.itsaky.androidide.treesitter.
  • New TSObjectFactory and TSObjectFactoryProvider APIs to allow usage of custom TS* objects.
    • This change makes constructors of all TS objects
      protected so that they can only be accessed within the same package and in
      subclasses. Every TS object now provides
      a static create method to create instances of the same. Users are expected
      to use those methods to create instances of the corresponding classes instead of using the factory directly.
    • You can configure a custom TSObjectFactory which would create custom TS* objects. This can be used to implement recyclable objects.
  • public fields in TS* classes are now protected and provide getters/
    setters for better encapsulation.
  • Native methods now also check the validity of the native object before they are accessed. If the native object pointer provided to a native method is invalid (null pointer), an IllegalArgumentException is thrown.
  • TSQueryCursor :
    • TSQueryCursor now checks whether a query has been executed when nextMatch and removeMatch are called. If not, it throws an IllegalStateException.
    • When executing a query, related TS* objects are now checked for access (e.g. cursor, query, node, etc).
    • The query cursor now does not allow executing queries on changed nodes i.e nodes for which TSNode.hasChanges() returns true. This behavior can be changed with TSQueryCursor.setAllowChangedNodes(boolean).
    • Query cursors are now Iterable<TSQueryMatch>.
  • TSNode :
    • New APIs :
      • edit(TSInputEdit)
      • getNextParseState()
      • getDescendantCount()
      • getGrammarType()
      • getLanguage()
  • TSParser :
    • TSParser parse operation is now cancellable. You can request cancellation for the previous TSParser.parse(...) call with :
      • requestCancellationAsync : Request cancellation asynchronously.
      • requestCancellationAndWait : Requests cancellation and blocks the current thread until the parse is cancelled.
    • TSParser.parse(...) now throws a ParseInProgressException if a parse operation is already in progress. You can check whether a parser is parsing a syntax tree with TSParser.isParsing().