Open yorickpeterse opened 1 week ago
I looked a bit into using Tree-sitter queries, but it seems this requires a query file for each language, along with some non-trivial matching code. I really don't want to start maintaining hundreds of query files, so hopefully there's a better approach.
Having played around with a bunch of tree-sitter languages, it seems this particular for
case is the only one I can find that exhibits this issue, all other languages I tried wrap anything involving brackets in a proper node, instead of just sticking them as-is in the parent node.
I've opened https://github.com/tree-sitter/tree-sitter-javascript/issues/315 to see if the parser maintainers are open to wrapping the condition into a dedicated node, such that bracket matching works as expected.
An example of this is JavaScript:
Here the
(
and)
infor
are separate literal nodes, so%
can't jump between them:Ideally Tree-sitter has a way of finding the next balanced
)
given we're on a(
, but I'm not sure.