tree-sitter-rust icon indicating copy to clipboard operation
tree-sitter-rust copied to clipboard

query with + operation did not work to capture more than one node

Open vehas opened this issue 3 years ago • 0 comments
trafficstars

query with + operation did not work to capture more than one node. example code in rust

struct a{c: usize, b: usize}

what work ?

with query

(field_declaration_list 
            (field_declaration 
                    (field_identifier) @field
                    (primitive_type)
            )
            (field_declaration 
                (field_identifier) @field
                (primitive_type)
            )
        )

will get result 2 "(identifier)"

what did not work ?

        (field_declaration_list 
            (field_declaration 
                    (field_identifier) @field
                    (primitive_type)
            )+
        )

will get me only the first identifier

What the expectation ?

expect to get all identifier (2 in this case)

I also try to replicate this query in playground https://tree-sitter.github.io/tree-sitter/playground but not sure how it work, after I type query in the text box then what should I do next ?

vehas avatar Aug 17 '22 01:08 vehas