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?
请先登录再写评论。
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.
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.
Refactor => Change Signature ?
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.
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.
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.
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
Sure. If there are any usages of the method, there can be a refactor preview.