Suggestion about "quick refactoring"

We've such a shortcut as "CommandShiftUp/Down arrow" (don't remember, how it's in windows, I've Mac here), that moves blocks of code up/down. It's great but I think of similar shortcut "CommandShiftLeft/Right Arrow". It can work in method parameters and change their order (moving selected one to the left or to the right).

May be this thing would be useful not only there… Or maybe it's done already?

8 comments
Comment actions Permalink

there's a big difference between the two though.

Moving a block up/down is not strictly a refactoring (it should change how the program executes), but it is LOCAL to where you do it, doesn't have side effects.

On the opposite altering method parameter orders has side impact on any caller, and should be treated more carefully.

0
Comment actions Permalink

Yes you are right. But suggested one is similar to a small part of "Change Signature" refactoring. It is already done so I suggest only creating a shortcut for it.

0
Comment actions Permalink

Refactor => Change Signature ?

0
Comment actions Permalink

Yes. There is a refactoring "Change Signature" and I've mentioned it. But I want to create a shortcut. For defined purpose. Changing the order of method parameters.

0
Comment actions Permalink

Whether something is local or not does not have anything to do with refactoring. There are many refactorings that only make sense only a small scope like a block, method or even an expression.

S.

0
Comment actions Permalink

Talking about the order of arguments ... it would be nice if you could select the order of constructor arguments when you do a New Constructor. (Control-N -> Constructor here .. not sure what the official name is)

S.

0
Comment actions Permalink

you're right.

What as I was meaning, is that the impact of changing parameter order is high enough that I can understand it being a heavier operation for the user. Helps remind that you should not do it without consideration.
Especially, I think the preview is needed before really applying the refactoring

0
Comment actions Permalink

Sure. If there are any usages of the method, there can be a refactor preview.

0

Please sign in to leave a comment.