vscode-expand-selection-to-scope
vscode-expand-selection-to-scope copied to clipboard
Shrink selection planned?
I can't really work with this plugin without this important feature
You can undo last operation (CTRL+Z
) to shrink the selection back.
Anyway implementing this feature as you might have had in mind is rather difficult or impossible. Imagine you have these two inner scopes, expand selection to the outer one, then shrink back. Which one of the two inner scopes will be selected? The one true answer might have been both, then it's feasible to implement, but it may not be practical.
var outerScope = {
fn: () => {
return {
a: true,
b: "first inner scope"
}
},
fn2: () => {
return {
a: "second inner scope",
b: "expand selection from here"
}
}
}
You could save all selection expand positions in a history array. Then you can always track your way back.
So you didn't mean a general shrinking ability, you should have been more clear. Anyway, if you want to undo an expand selection, you can use aforementioned CTRL+Z
.
My first thought was a general shrinking ability. But after your answer, I changed my mind to a history tracking solution. Of course you can use CTRL+Z. But it feels like an anti-pattern / quick hack.
Agree. I have reported it as an issue yesterday. Selection tracking history sounds reasonable and is a good feature request.
Alt+←
/→
is a cursor position history. It would be nice to undo/redo expansion on these keys as well.