Closed AntonPieper closed 1 year ago
Sure, I'll add it. Are there any other APIs you want me to implement?
I already have the constructor for Query
down. Later I'll try to implement the missing methods. For now the only missing function is the TSQuantifier
s. When this works out, Query
could be used to implement syntax highlighting for all tree-sitter grammars using the queries/
directory. As is now, TSQuery
is a wrapper around the API and TSQuery
does not directly support predicates like #match?
As is now, TSQuery is a wrapper around the API and TSQuery does not directly support predicates like #match?
As written in the tree-sitter docs, predicates are not directly handled by the tree sitter library and as android-tree-sitter only provides Java bindings for the library, I think it will be better if the code editor implementation handles predicates.
You can have a look at sora-editor. It supports tree sitter syntax highlighting and has support for predicates. You can even add your own predicates (example).
Added in 5c61cff482532b348e694ddae36e832fd3fe4150. A new release will be published soon.
I am trying to port the rust bindings for the
Query
including predicates) to kotlin. Whilst doing this I noticed that not all functions have bindings.What is missing:
ts_query_capture_quantifier_for_id
TSQuantifier
-enumTSQuery#getCaptureQuantifierForId(int patternId, int captureId)
Implementation
getCaptureQuantifierForId
(untested)TSQuantifier.java
TSQuery.java
ts_query.cc