py-tree-sitter
py-tree-sitter copied to clipboard
How to get some node's name?
For example if we define field('var_name', $.identifier);
in gramma.js. How can I get the name 'var_name' from an identifier node object?
There is a property is_named
to indicate whether current node has name, but no something like name
or get_field_name()
.
If willing to use a cursor, may be the following sort of thing could work?
https://github.com/tree-sitter/py-tree-sitter/blob/b5dfe29b4ead51678bf72c5da47feaa56d4e2be1/tests/test_tree_sitter.py#L370