Closed JJLin63 closed 4 months ago
Hi there.
You must use '@' annotation in the s-expression if you want capture the node. Please reference the tree sitter docs.
sorry to bother you, I will close this issue
@JJLin63 In the following query TreeSitterQuery query = new TSQuery(json, "((document) @root)"); https://github.com/bonede/tree-sitter-ng?tab=readme-ov-file#api-tour
How can I find the capture with the name '@root' inside the for loop
while (cursor.nextMatch(match)) { TSQueryCapture[] captures = match.getCaptures(); for (TSQueryCapture capture : captures) { // How can i find the capture with the name "root", that is specified in the TSQuery @root } } The wasm tree-sitter binding provides a feature to search for capture by the tag provided in the query(@root). Is this feature not supported? or there is some way to find the capture by name?
I have the same question ☝️ Is there a way to get the tag associated to each capture in query results?
I have got a problem when using query-match syntax, which cursor.nextMatch(match) whill return Ture but match.getCaptures() always empty.
source code:
pom.xml