helixbass / tree-sitter-grep

The Unlicense
6 stars 1 forks source link

Capture name argument #4

Closed helixbass closed 1 year ago

helixbass commented 1 year ago

In this PR:

To test: If you have a file named eg string-struct-fields.scm in the project root with contents:

(field_declaration_list
  (field_declaration
    type: (type_identifier) @type
    (#eq? @type "String")
  )
) @declaration_list

then if you do cargo run ./string-struct-fields.scm or cargo run -- --capture type ./string-struct-fields.scm or cargo run -- -c type ./string-struct-fields.scm you should see the same result as previously If you do cargo run -- --capture declaration_list ./string-struct-fields.scm you should instead see a result corresponding to the beginning of the enclosing struct fields declaration list