January 2011 - Posts

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

This Month, We’re Boldly Going Where We’ve Never Gone Before

Literally! In this month’s CodeRush release, we’re making Rich Comments available, with support for bold, italics, and other formatting in comments. This release also sees improvements to the Unit Test Runner, Code Formatting, and Selection to Template, plus JavaScript/Typescript developers get new features!

Rich Comments

Want to add emphasis to a Visual Studio comment? Now you can with the Rich Comments feature. The following Markdown-like syntax elements are supported:

  • **Bold**
  • *Italic*
  • _Underline_ (underscores on either side)
  • ~Strikethrough~

RichComments

You can make selected text inside a comment bold by pressing Ctrl+B or choosing the appropriate command from the Embed Selection Action menu

You can turn on Rich Comments on the Editor | All Languages | Rich Comments options page or using the Toggle Rich Comments toolbar button.

Unit Test Runner

With this release, you can now execute a single test case of a parameterized test directly from code. Click a CodeRush test icon and choose the desired option from the Run test, Debug test, or Run test with coverage submenus.

ExecuteTestForASingleTestCase1

You can also execute a test for a particular descendant of the current class in a similar manner.

Code Formatting

We have enhanced formatting options to allow you specify how you would like to align code blocks. The “Align by” and “Indent” options are available on the Braces option page in Editor | C# | Formatting. On the Wrapping options page you can also align content for Initializers.

FormattingOptionsIndentation

Coding Assistance

Selection to Template generates cleaner templates and uses type links, text links, or regular links intelligently depending on element type.

Create Template From Selection dialog options allow you to fine tune a template before committing it, and quickly specify which elements should be wrapped up in text links.

SelectionToTemplateEnhancements

JS and TS Support

Now in Javascript (and Typescript) you can:

Download and Try 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.

Coming Up

Next month expect to see more JavaScript features, plus a mind-blowing visual feature for all languages that we think you are going to love.

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.

Training

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

Training2

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:

CopyrightHeader

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.

    MemberIcons
  • 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:

SpellCheck

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.

CopyWithFields

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.

TextLinksAndFields

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.

Navigation

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:

ShortcutBindingFilterJumpTo

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

JumpToSymbolFilter

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.

Templates

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.

CodeRush – New Release (v18.1.3)

New CSS language support, new layered options, plus multi-select and templates all see improvements in this latest release of CodeRush.

Note, if the Visual Studio Marketplace is still showing version 17.2.8, we are working with Microsoft to resolve this issue. In the meantime you can download the latest CodeRush from the DevExpress Download Manager.

CSS Language Support

CSS gets support for the following features:

Layered Options

CodeRush now stores your settings in Layers, which allow you to bind settings to a particular solution and team, in addition to personal preferences which can serve as defaults (unless overridden by team/solution settings).

You can use this feature to create solution-dependent options and share them across your entire team. These options are applied automatically to all team members using CodeRush when the solution is open.

Layers

The actual configuration settings are determined by merging all the settings layers.

Layers_Merged

There are three pre-defined layers:

  • Solution Personal Options — your personal preferences for the solution that is currently open. This layer has the highest priority and overrides any settings in lower layers.
  • Solution Team Options — your team’s preferences. Stored in a solution directory and should be added to your version control system (VCS) so these options can be shared with the entire team. Solution/Team settings override any default settings below.
  • Personal Options — These are your default preferences for all solutions you work with in CodeRush. This layer has the lowest priority and settings here may be overridden by settings in a higher-priority layer.

You can also add child layers to any pre-defined layer. Custom layers can be stored in any directory and used to specify options not defined in the base layer.

Templates

The “ninst” template (generates a new instance for the variable in clipboard) now initializes all properties with the default values, adding TextFields so you can easily change the default property initialization.

NewInstance

We have also added a "ninst," template (with a comma at the end), which creates a simpler initialization of the variable on the clipboard.

To use either of these templates, first copy a variable name to the clipboard, place the caret on an empty line, type the template name and expand it (with Space or Tab, depending on your settings).

Multi-select

Multi-selections are now cleared after being copied.

We have also added the Ctrl+Alt+Shift+Backspace shortcut to restore the most recent multi-selection.

Download the Latest Version of CodeRush Now

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

CodeRush – Cheat Sheet (v3)

Version 3 of the CodeRush Cheat Sheet is available, showing default keyboard shortcuts as well as key templates.

CodeRush – New Release (v17.2.8)

Another 30 days. Another release. This update to CodeRush brings neat improvements to Smart Duplicate Selection, a port of Invert Selection, and the ability to quickly turn code into templates.

Coding Assistance

Smart Duplicate Selection/Line (Shift+Enter) gets the following improvements:

  • Single letter identifier parts are automatically incremented/decremented if CodeRush detects an alphabetically-ordered pattern in the code:
       


  • Enhanced support for duplicating parameters and arguments, letting you quickly declare new parameters based on existing parameters and the selection. To duplicate a parameter, select the part(s) you want to change (selected parts will become fields) and press Shift+Enter. Watch the videos below to see examples of what you can do.

    • Arguments


    • Parameters:


  • Expressions can now be duplicated. You can duplicate elements combined with a variety of different operators: string concatenation, bitwise, Boolean and arithmetic. Smart Duplicate Selection will insert a default operator and mark it with a TextField so you can change it later if needed. Watch the video below for examples of what you can do:


Refactorings and Code Providers

The Invert Selection code provider gets a port from CodeRush Classic. Use this code provider to invert selected lines of code in a variety of ways:

  • Assignments (a = b  →  b = a)
  • Boolean literals (true  →  false)
  • Addition/subtraction assignments (a += b  →  a -= b)
  • Equality operators (==  →  !=)

Templates

We have added the ability to create templates right from a code selection using a context menu. Simply select the code to become the basis for your template, right-click and choose Selection to Template...

Sel2Templ1

Sel2Templ2


CodeRush automatically creates Links and Fields based on the selected code and opens the new template in the Template Editor.

Give CodeRush a Try!

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

More Posts