node-tree-sitter
node-tree-sitter copied to clipboard
What is the equivalent of `ts_node_child_by_field_name` in this wrapper?
How do I get a child of a node by its field name? I can use a cursor to walk the children and get their field names with cursor.currentFieldName
but is there any other way to do it?
I don't remember finding another way.
Am interested if there is one though!
You may access field names using index or the dot operator:
>>> syntaxNode.fields
["body"]
>>> syntaxNode.body
<the body field>
>>> syntaxNode["body"]
<the body field>
@Neppord it works. Thank you!
Sadly it's not in tree-sitter.d.ts
and there is no ts_node_child_by_field_name
equivalent.
Duplicate of #68