Rory Becker - DevExpress CodeRush Blog

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:

 

Published Jul 01 2014, 01:21 PM by
Bookmark and Share

Comments

No Comments
LIVE CHAT

Chat is one of the many ways you can contact members of the DevExpress Team.
We are available Monday-Friday between 7:30am and 4:30pm Pacific Time.

If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

FOLLOW US

DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

Copyright © 1998-2017 Developer Express Inc.
All trademarks or registered trademarks are property of their respective owners