[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Question on getting tree-sitter matches
From: |
Abin Simon |
Subject: |
Question on getting tree-sitter matches |
Date: |
Sun, 12 Mar 2023 20:02:18 +0530 |
Hey,
How would I get the set of matches from tree-sitter with items from the
same query together.
For example if I have a query of the following form:
(function_declaration (identifier) @id) @func
elisp-tree-sitter returns this as the output of `tsc-query-matches`:
[(0 . [
(func . #<user-ptr ptr=0x4f7fa40 finalizer=0x7f2173b15780>)
(id . #<user-ptr ptr=0x4f7fa00 finalizer=0x7f2173b15780>)
]
)
(0 . [
(func . #<user-ptr ptr=0x10043a0 finalizer=0x7f2173b15780>)
(id . #<user-ptr ptr=0x7b9a660 finalizer=0x7f2173b15780>)
]
)
]
This groups the matches from the same "query" together.
I could only find `treesit-query-capture` which just returns a list of
captures items in the following form:
(
(func . #<treesit-node function_declaration in 441-791>)
(id . #<treesit-node identifier in 446-460>)
(func . #<treesit-node function_declaration in 865-1052>)
(id . #<treesit-node identifier in 870-888>)
)
- Question on getting tree-sitter matches,
Abin Simon <=
- Re: Question on getting tree-sitter matches, Yuan Fu, 2023/03/12
- Re: Question on getting tree-sitter matches, Abin Simon, 2023/03/13
- Re: Question on getting tree-sitter matches, Yuan Fu, 2023/03/14
- Re: Question on getting tree-sitter matches, Abin Simon, 2023/03/15
- Re: Question on getting tree-sitter matches, Yuan Fu, 2023/03/19
- Re: Question on getting tree-sitter matches, Abin Simon, 2023/03/20
- Re: Question on getting tree-sitter matches, Ergus, 2023/03/20
- Re: Question on getting tree-sitter matches, Yuan Fu, 2023/03/20
- Re: Question on getting tree-sitter matches, Eli Zaretskii, 2023/03/20