Keyboard shortcuts for handling sides of an equals sign

It would be nice to be able to flip text over an equals sign.  There is a long method discussed here:
http://stackoverflow.com/questions/430145/how-can-i-reverse-code-around-an-equal-sign-in-visual-studio


Flip:
abc = de;


Becomes (preserving the terminator character or line continuation character at the end):
de = abc;

Part 2:
It'd also be nice to align/unalign over an equals sign, so it would be easy to perform column editing on each side.


Align with equals:
abc=de
fg=hij
kl=mn


Becomes:
abc=de
fg =hij
kl =mn


Unalign with equals (this could be useful after column inserts; a single space can be preserved on each side of the equals):
func1(abc) = func2(de)
func1(fg ) = func2(hij)


Becomes:

func1(abc) = func2(de)
func1(fg) = func2(hij)






This would save a lot of time when handling GET vs SET for a large number of fields.
4 comments
Avatar
Andrey Serebryansky
Comment actions Permalink

Hello,

Regarding your suggestions:

1. There's a 'Reverse assignment' context action in ReSharper 6 that will
do the job for each assignment.
2. There's a similar feature request in our tracker: http://youtrack.jetbrains.net/issue/RSRP-121267
and you're welcome to vote for it.

Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

It would be nice to be able to flip text over an equals sign.  There
is a long method discussed here:

http://stackoverflow.com/questions/430145/how-can-i-reverse-code-aroun
d-an-equal-sign-in-visual-studio

Flip:
abc = de;
Becomes (preserving the terminator character or line continuation
character at the end): de = abc;

Part 2:
It'd also be nice to align/unalign over an equals sign, so it would be
easy to perform column editing on each side.
Align with equals:
abc=de
fg=hij
kl=mn
Becomes:
abc=de
fg =hij
kl =mn
Unalign with equals (this could be useful after column inserts; a
single space can be preserved on each side of the equals):

func1(abc) = func2(de)

func1(fg ) = func2(hij)

Becomes:
func1(abc) = func2(de)
func1(fg) = func2(hij)
This would save a lot of time when handling GET vs SET for a large
number of fields.

---
Original message URL:
http://devnet.jetbrains.net/message/5366929#5366929



0
Comment actions Permalink

I fumbled around for a while looking for the "reverse assignment statement" feature.  I finally noticed that if I'm at the first character on the right side of the equals sign, it will give me the option to reverse the assignment statement.  Besides being hard to find, it was also bizarre that after I changed the first assignment statement, when I highlighted a small portion of assignment statements, it gave me the "reverse" option for the group, but then only reversed the first statement.  Why not reverse the entire group?

And I voted up the "align equal operands".  Thanks for pointing it out.

0
Comment actions Permalink

Cryptc User,

You can also place the caret on any of the two operands, and use Ctrl + Shift + Alt + Left/Right arrow keys to change the assignment order.

0
Comment actions Permalink

Thank you.  I noticed that it only works if a method is not being applied on the right side.  I guess that makes sense.

0

Please sign in to leave a comment.