I very often find myself in situations where I should have opened a parentheses, but forgot and end up furiously tapping the left arrow key to get to the spot I should have put it, and doing the same to get back to where I was - that, or removing one hand from the keyboard to do it with the mouse. Either way, it's a stupid mistake on my part and a poor use of time going back to fix it.
For example, if typing something like
var x = 100 - var1 + var2;
I might get to the end of the statement and realize I wanted to subtract the sum of var1 and var2 from 100 and not add var2 to the difference of 100 and var1.
I can't really expect an IDE to prevent my mistakes, but I was thinking there could be a simple enough feature that would save time when they're made. Specifically, some kind of function that, after a closing parenthesis is added where there isn't an opening one, would start ghosting in an opening parenthesis at different statements and allow the user to switch between them.
Say you have the following statement:
var x = oldY * oldX + newY / newX - left - right;
If you put a closing parenthesis after
right and pressed the shortcut, the IDE would do:
var x = oldY * oldX + newY / newX - ( left - right);
press left, and then:
var x = oldY * oldX + newY / ( newX - left - right);
var x = oldY * oldX + ( newY / newX - left - right);
Anyway... Does this feature exist? If not, should it exist? What do senior programmers do when this happens?