New CodeRush Plugin - CR_ReverseArgs

Hurrah, another new CodeRush plugin.

The problem minor annoyance

Occasionally I realise that I’ve passed a couple of arguments to a method in the wrong order.

What follows is usually a complicated series of…

  • Move Left (Ctrl+Left)
  • Select Right (Shift+Ctrl+Right)
  • Cut Argument (Ctrl+X)
  • Move Right (Ctrl+Right)
  • Paste Argument (Ctrl+V)

The navigation operations usually need to be repeated several times in order to get into the correct position.

Additionally there’s that bit where you either…

  • Try to judge which comma to include in the cut/paste operation.
  • Or… Delete the comma, and enter it back again once the paste is complete.

Add this to the fact that I usually have something useful on the clipboard, which I’d prefer not to have to burn whilst correcting the order of these arguments.

The whole rigmarole is something to be avoided.

Enter CR_ReverseArgs

The new CR_ReverseArgs plugin allows you to just highlight the pair of arguments, and trigger Reverse Args from the CodeRush Smart Tag menu.

Then CodeRush will do the rest.

CR_ReverseArgs

This CodeProvider should work with ints, strings, and all sorts of other objects. The 2 arguments need not be of the same type either. Feel free to switch whichever pairs you like.

Note: This plugin is NOT a Refactoring. It will affect the functionality of your code.
If you wish to move both the Arguments and their corresponding Parameters, then you should use the Reorder Parameters refactoring

Availability

This plugin is available immediately:

 

no comments
No Comments

Please login or register to post comments.