CodeRush – New Release (v18.1.5) for Visual Studio

This Sprint Packs a Lot

This CodeRush release packs a number of important new features for Visual Studio developers. The training window, more feature support for XAML, XML, and CSS, automatic copyright headers, jump to symbol filtering and the somewhat mind-blowing, all-new, Mega Super Copy (see below for details).

As always, you can download CodeRush from the Visual Studio Gallery or the DevExpress Download Manager.

Training Window

  The Training Window from CodeRush Classic makes a reappearance in this release. You can access it through the CodeRush | Windows | Training menu item.


This window shows shortcuts for available template expansions and CodeRush features based on the current caret position:


Available templates appear above the horizontal line. Available features, grouped by category, appear below the horizontal line. If you think you may not be getting the most of CodeRush, we suggest showing this window.

Code Cleanup

  Code Cleanup gets a new Copyright Header code provider, with the ability to add copyright comments at the file’s beginning:


It is also available as a Code Cleanup provider and as a template - just press the letter h at the top of the file on an empty line and press your template expansion key (e.g., Space or Tab).

Before using the default header feature for the first time, set values for the “First Name”, “Last Name” and “Company” fields on the IDE | User Info options page.

The actual text of the generated header is stored in the h template expansion, and can be changed there as desired.

Clipboard and Selection Tools

  • We have added Cut, Copy, Select and Comment actions to the Member Icons menu.

  • Comment/Uncomment Selection now supports XAML, XML and CSS.

Code Analysis

Spell checker suggestions in the Code Actions menu now get their own custom icon, so they are more easily distinguished from other items in the same menu:


Coding Assistance

Mega Super Copy

Okay, so first we have to confess that we maybe went a little crazy on the name of this feature, but it IS pretty cool.

You can now use Multi-Select to mark important text elements before selecting and copying/cutting a block of code to get a richer smarter version of the code on the clipboard.

Any code in the selection that has been multi-selected will become linked Text Fields upon pasting.


It’s simple: Before copying code (that you know you’ll want to change on paste), multi-select the parts you’ll want to change using Ctrl+Alt+Enter. In the example screenshots above a single instance of the variable “property” was multi-selected. Next, select the entire block of code you want to work with (including the multi-selections) and copy or cut normally. CodeRush puts a smarter/richer version of the code on the clipboard, ready to paste as rich code in Visual Studio wherever you want.

You can also create zero-length multi-selections to mark caret insertion points on the paste. Just put the caret where you want the caret to be on paste (no selection), and press Ctrl+Alt+Enter to add a zero-length multi-selection marker at that location. Later when you paste, an empty TextField will be placed at that location for easy form-based entry.

Once you have Mega-Super-Copied something onto the clipboard, you can paste it as many times as you need. This is really useful for repetitive code that needs a few changes, where you know in advance what parts you want to change (and where you want the cursor) after each paste.

You can also use the Ctrl+Alt+V shortcut to paste the most recent text Mega-Super-Copied with fields, even if it is not currently on the clipboard.

Other Coding Assistance Features

The Text Links and Text Fields behavior in Smart Duplicate Line/Selection, Mega Super Copy, and Selection to Template features is now configurable. Use the Editor | All Languages | Linked Text & Fields options page to configure when the automatic links and fields should be created.


These rules apply to normal selections of code (free of any multi-selections). When multi-selections are present in the selection and any of these features are invoked, the options on this page are applied to only those elements multi-selected.


Jump To Filtering

You can now define shortcuts that bring up the Jump To window with a predefined filter. The JumpToSymbol command now accepts four parameters:

  • TypeFilter (can be: Classes, Interfaces, Structs, Enums, Delegates, and AllTypes)
  • MemberFilter (can be: Methods, Properties, Events, Fields, LocalsAndParams, and AllMembers)
  • AccessFilter (can be: Private, Protected, Internal, ProtectedInternal, Public, and AllVisibilities)
  • LocationFilter (can be: AllFiles, CurrentSolution, CurrentProject, CurrentNamespace, and CurrentFile)

You can use the “and” keyword to combine filters like this: “Classes and Structs”.

For example, if you’d like a shortcut to quickly jump to all public members in the current project, declare a new shortcut binding to the JumpToSymbol command, passing the “,AllMembers,Public,CurrentProject” filter as a parameter, like this:


In this case, pressing this new shortcut would open the Jump to Symbol window with this predefined filter:


Note: In the screenshot above I tapped the Ctrl key after window appeared before snapping this screenshot so you could see the filtering. Jump to Symbol normally appears with the filtering options hidden.

You can use this feature to create custom shortcut bindings to make is easier to find classes, interfaces, members, etc., or to search locally, project-wide, or solution-wide, all with a single keystroke.

Marker Improvements

We have improved markers behavior. System Markers dropped by CodeRush are now cleaned up automatically when CodeRush detects they are redundant or no longer needed.

Refactorings and Code Providers

  • The Declare Method code provider is now available when the caret is located at the end of the line with an undeclared method.
  • The XPO Fields code provider now copies the [Obsolete] attribute from fields to their corresponding maintained properties.
  • We have added a Collapse Accessors code formatter, which collapses both get and set property accessors into single-line form.


Type Casting Templates

We have extended the CodeRush type-casting templates so that they now additionally support explicit type casting in expressions. The following new templates were added, and will expand as described if the caret is inside a code block (but not on an empty line):

  • c. - Expands as “(Type)” with the Type identifier embedded into a Text Field so you can quickly change it. It’s also an incredibly fast way to get parens inside an expression when you need them.
  • c?Type? - Adds a typecast to a type specified in the template name variable “?Type?”. Examples:
Template Inside an Expression On an Empty Line
cd (double) double @double = (double)Expression;
cd8 (DateTime) DateTime dateTime = (DateTime)Expression;
  • c?Generic1Type?. and c?Generic2Type?. - Adds a typecast to the specified generic type (with one or two parameters) and embeds its parameters into Text Fields. Examples:
Template Inside an Expression On an Empty Line
cl. (List<Type>) List<args> list = Expression as List<args>;
cc. (Collection<Type>) Collection<args> collection = Expression as Collection<args>;
cd. (Dictionary<Type1, Type2>) Dictionary<args> dictionary = Expression as Dictionary<args>;
  • c?Generic1Type?.?Type? and c?Generic2Type?.?Type1?,?Type2? - Adds a typecast to the specified generic type (with one or two parameters). Examples:
Template Inside an Expression On an Empty Line
cl.d (List<double>) List<double> @double = (List<double>) Expression;
cd.s,i (Dictionary<string, int>) Dictionary<string, int> @int = Expression as Dictionary<string, int>;

Notes: entries in the middle column (in the three tables above) reflect new functionality in this release. Entries in the last column show previously existing (and related) casting technology. The “Expression” referenced in the last column in these tables will be replaced by an identifier in the clipboard (if any). See the C for Casting video for more on this existing functionality.

Improved ForEach Text Command

The ForEach text command now lets you iterate through all the lines of text copied to the clipboard. You can do it with the following text command:

    «ForEach(line in clipboardText,template))»

where template is the name of the template you want to execute for each line of text on the clipboard. You can access the text of each iterated line by calling «?Get(itemName)» from inside your template.

Download the Latest Version of CodeRush Now

Download CodeRush from the Visual Studio Marketplace or use the DevExpress Download Manager. And if you're enjoying CodeRush, please leave a review here so the whole world can see.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.