nmsmith22389 / vscode-incrementor

Advanced increment / decrement actions for (almost) anything.
13 stars 11 forks source link

For enums, option to try and keep cursor in place, as long as it doesn't leave enum value #19

Open KillyMXI opened 4 years ago

KillyMXI commented 4 years ago

For example, I have an enum for ["var", "let", "const"] and I have following code:

var foo = 1;
var bar = 2;
var baz = 'etc';
bar += 1;

I go from line to line and change var to more appropriate declaration. It would've been really fast if I were able to issue keyboard commands like "down, dec, down, inc, down, dec"...

But, as soon as I change var to const, cursor jumps to the right, and with the next "down" key press it is outside of the region where I want it to be, and I have to press "down, left, left, inc/dec" instead or help with mouse, because that reaches the limit of how many different keys I can iterate through without mistakes.

If I have the cursor N characters from left - I want it to stay at min(N, new_length).

|var     -->   |const
var|     -->   con|st
va|r     -->   co|nst
cons|t   -->   var|