helix
helix copied to clipboard
feat(command): select all siblings and children
This adds two new related commands:
select_all_siblings
Selects all siblings of the node under the cursor.
select_all_children
Selects all children of the node under the cursor.
select_all_children_in_selection
Selects all children of the node under the cursor, but only if the children are contained inside the starting selection.
after trying this out for a bit I think select_all_children
would benefit a lot from only selecting children that are actually contained in the selection. The current implementation is also useful but i found that quite a lof of nodes have children I don't care about. If someone really wants all children inside the node they can do a-o first. That change would also make the command more predictable I think
after trying this out for a bit I think
select_all_children
would benefit a lot from only selecting children that are actually contained in the selection.
Hmm, but in this case, the command would basically never do anything when the selection is just a cursor, or really any time you don't happen to have an entire node contained in the selection.
But on the other hand, I could see this being useful for if you only want a subset of the children. I'll add a third command that does this.
Just added select_all_children_in_selection
that only selects if all resulting ranges are contained within the starting selection.
Sounds good, will do
Ok I've rebased and changed all the motions to use the new in-crate TreeCursor
instead of the tree-sitter API directly. This required adding a child iterator in the TreeCursor module.
Good suggestions, I took care of them.
I can finally stop splitting by commas inside a function call to select the arguments :) But it seems the docs weren't updated with the new alt-a
and alt-I
keybinds.