-
-
Notifications
You must be signed in to change notification settings - Fork 88
Description
Right now you can take lines paragraphs and soon non whitespace sequences that expands from both anchor and active of the selection. Currently containing scopes only use start off the selection.
I want both of these to have the same result. (air and bat are in different functions)
take funk air past bat
take air past bat take funk
I was thinking that we could implement this first thing in the selection/scope modifier by basically calling the specific implementation twice, once for both ends. To day we pass the entire selection to the specific modifier(line, funk, ...). What if we pass in a single position instead?
const startSelection = getSelectionForScope(selection.start, "function"); // function is of course a variable
if (selection.isEmpty()
|| getNodeAtLocation(selection.start).id === getNodeAtLocation(selection.end).id) {
return startSelection;
}
const endSelection = getSelectionForScope(selection.end, "function");
return getSelectionFromPositions(startSelection.start, endSelection.end);
- Add test for Update scope type modifier to expand on both ends #484 (comment)
- Add test for "funk wrap that" with
that
mark starting in one statement and ending in another (see Re-evaluate decision to make non-empty selections non-weak #883) - Add test for "snip funk after that" with
that
mark starting in one function and ending in another (see Re-evaluate decision to make non-empty selections non-weak #883) - Bug with
"item"
#901
edit (@pokey)
Let's implement this one in a new ContainingScope
stage that all containing scopes share. The algorithm should be as described in #629 (comment). The initial implementation will be folded into #629