Consider `field("opening_delimiter", $._open_parenthesis)` in `call_arguments` and friends
DavisVaughan opened this issue · 1 comments
DavisVaughan commented
It is often useful to locate the open/close parentheses/brackets/brackets2 delimiters to be able to, say, ensure that the cursor is between them. This is currently awkward without giving them field names, so we should consider giving call, subset, and subset2 consistent field names for this. @kevinushey does that make sense in your head?
i.e. a call's arguments
node is structured as
call_arguments: $ => seq(
$._open_parenthesis,
repeat($._argument),
$._close_parenthesis
),
instead move to:
call_arguments: $ => seq(
field("opening_delimiter", $._open_parenthesis),
repeat($._argument),
field("closing_delimiter", $._close_parenthesis)
),
So then we could try to grab them by name rather than by offset, i.e. the much cleaner:
node.child_by_field_name("open")
kevinushey commented
Seems reasonable to me!