This repository was archived by the owner on Oct 18, 2024. It is now read-only.
v4.0.0
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.androididetocom.itsaky.androidide.treesitter. - New
TSObjectFactoryandTSObjectFactoryProviderAPIs to allow usage of customTS*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 staticcreatemethod 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
TSObjectFactorywhich would create customTS*objects. This can be used to implement recyclable objects.
- This change makes constructors of all TS objects
publicfields inTS*classes are nowprotectedand 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
IllegalArgumentExceptionis thrown. TSQueryCursor:TSQueryCursornow checks whether a query has been executed whennextMatchandremoveMatchare called. If not, it throws anIllegalStateException.- 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()returnstrue. This behavior can be changed withTSQueryCursor.setAllowChangedNodes(boolean). - Query cursors are now
Iterable<TSQueryMatch>.
TSNode:- New APIs :
edit(TSInputEdit)getNextParseState()getDescendantCount()getGrammarType()getLanguage()
- New APIs :
TSParser:TSParserparse operation is now cancellable. You can request cancellation for the previousTSParser.parse(...)call with :requestCancellationAsync: Request cancellation asynchronously.requestCancellationAndWait: Requests cancellation and blocks the current thread until theparseis cancelled.
TSParser.parse(...)now throws aParseInProgressExceptionif a parse operation is already in progress. You can check whether a parser is parsing a syntax tree withTSParser.isParsing().