[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question on getting tree-sitter matches
From: |
Yuan Fu |
Subject: |
Re: Question on getting tree-sitter matches |
Date: |
Sun, 12 Mar 2023 19:34:59 -0700 |
> On Mar 12, 2023, at 7:32 AM, Abin Simon <mail@meain.io> wrote:
>
> 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>)
> )
>
Unfortunately, that’s currently not possible. Could you elaborate on why you
need such feature?
Thanks,
Yuan
- Question on getting tree-sitter matches, Abin Simon, 2023/03/12
- Re: Question on getting tree-sitter matches,
Yuan Fu <=
- 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