June 2016 - Posts

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.

CodeRush 17.2.7 for Visual Studio is Now Available

In this month’s release, we add automatic block and statement formatting options, the test runner UI gets some improvements, and we introduce the Feature Advisor to help you get more out of CodeRush. Download the latest version of CodeRush at the Visual Studio Marketplace. Here’s more on what’s new:

Feature Advisor

The Feature Advisor introduces CodeRush features likely to improve your coding efficiency based on the ways you create and modify code in the editor.

When CodeRush notices code created or modified in ways which CodeRush features can do faster, it adds an entry to the feature advisor and increments the red and white counter in the bottom right of Visual Studio:

FeatureAdvisorNotification

Click this counter to open the Feature Advisor window to learn more about the new CodeRush features that can help.

FeatureAdvisor

The Feature Advisor options page shows the full list of features supported by Feature Advisor and lets you disable hinting for features you already know how to use.

FeatureAdvisorOptions

Code Formatting

We have added new options to Format statements and blocks after pressing the } and ; keys.

FormatOnBrace

Unit Testing

The world’s fastest test runner gets some improvements to help you analyze and use test run results faster.

  • You can now select and copy text from the Test Runner’s Results section.

TestRunnerSel

  • We have added a right-click radio button action to category buttons in the filtering toolbar. When you right-click a filter item, that item becomes the only filter checked.
  • When all filtering items are unchecked, the Test Runner Window shows all tests without filtering.
  • The Test Runner hints shown in the code editor now let you select and copy expected and actual values.

TestRunnerHint

Give it a Try

Download the latest version and let us know what you think about it. Our goal is to make CodeRush the fastest, most powerful code-creation tool for developers. Tell us how we’re doing. And if you love something about CodeRush, you can tell the world about it here. As always, we thank you for your support.

CodeRush 17.2.6 is Available (and Includes a New Killer Feature for Visual Studio)

Another 30 day sprint, another CodeRush release for Visual Studio. And this release includes a powerful new feature we’ve been working on that we think you’ll love. Let’s get right into it:

Smart Duplicate Selection

CodeRush’s Smart Duplicate Line (SDL) gets even smarter and morphs into Smart Duplicate Selection. This feature makes creating structurally-similar code significantly easier, and orders of magnitude faster.

This feature can be used in any language you can work on in Visual Studio, however its intelligence and abilities vary depending on the content you’re building, so let’s go through a few samples to get an idea of what it can do.

First, let’s start with some C# test code that creates a new instance of a Ninja, like this:

CreateNinja

Now I might want to create more Ninjas for the unit test. Normally I would select the block of Ninja-building code, copy it to the clipboard, move the caret to the end of the block, paste the copied code, then navigate into the new code, change a part needed to create my second Ninja, and then repeat these last two steps until the new ninja code is done.

Phew! That’s a lot of work just to create a second Ninja.

Smart Duplicate Selection (SDS) starts the same way - select the code you want to duplicate. But instead of copying anything to the clipboard, just press Shift+Enter to duplicate the selection.

ninjaDup1

SDS duplicates the selection, placing text fields around the code - parts likely to change in the duplication. Don’t worry if you see a lot of text fields when you first try this. If I’m on a text field and I don’t want to change it, I press Enter to move on to the next text field. I’ll show you how to clean this up in a moment. For now, let’s focus on the changes we want to make to this duplicated block.

For example, I might change the variable name to “ninja2”, the Name to “Leonardo”, ServedInOniwaban to true, and the birth year to 1985. pressing Enter after each edit.

It’s fast and efficient.

But this feature gets even smarter when you try to duplicate again. Let’s create a third Ninja based on the changes we just made.

Now, you could select the second Ninja-building block we just edited, and press Shift+Enter again. And while that would work, it would be an excessive number of key presses just to repeat the last duplication.

Fortunately SDS gives you a super-fast way to repeat the last duplication - just press Shift+Enter again when you reach the end of the duplicated selection (or when the caret is inside any text field of the duplication).

Pressing Shift+Enter (in our ninja-building example) to repeat the last duplication, we now get something more closely reflecting what we want to modify:

ninja3

Now we have only four fields, surrounding the duplicated code we changed in the ninja2 declaration. SDS also auto-increments the variable’s name (and other numeric primitives and enums) based on the changes made to the code.

With only four fields we just change or accept what we need, pressing Enter between changes four times.

It’s pretty amazing stuff. You can create structurally similar blocks of code or script or markup or any text at all, changing only the parts you need, and create multiples of that with what some might consider the fewest keystrokes possible.

Once SDS learns what we want to change, we can repeat it by continuing to press Shift+Enter when we reach the end of the duplicated selection (or when we’re inside any TextField of the duplication).

It’s the most efficient path to creating similar repeating blocks of code/script/markup/text.

You might also be wondering, “well, what if I already know what fields I want to modify?”

This question is best answered in a second example. Let’s switch over to XAML, where we might be creating an interface that (so far) looks like this:

XamlInstallationUI1

This UI shows download progress, but we want to add similar status controls to show progress for installation, configuration, and registration (all of which happen during our install).

The XAML for the “Download: 0%” part of the UI looks like this:

We’ve got a horizontal StackPanel containing two TextBlocks, one for the label and the other, named, for the value. So, we need to duplicate this StackPanel and its children three more times. And in each duplication, we want to change only the Text of the label TextBlock and the Name of the value TextBlock.

Since we already know what fields we want to change, we can mark those using CodeRush’s multi-select feature. It’s easy. Just select the sections of code you want to modify and press Ctrl+Alt+Enter. Like this:

PreselectSDS

Notice I’ve only multi-selected one instance of “Download”, even though I want to also modify the name of the second occurrence in “tbDownload”.

That’s okay, because SDS will automatically find all camelcase matches to anything we multi-select and link those together in the duplication.

Now select the block we want to duplicate (tip - for even faster selections, use Selection Increase)…

SelectPreMultiSelectSDS

Press Shift+Enter

DulicatedXaml

And now enter the new text for the label: “Installation”.

SDS - Installation

Done.

Ready to create another StackPanel/TextBlock set of controls for the “Registration” part of the spec? We’re already inside a text field, so we can press Shift+Enter to repeat the last duplication:

SDSXamlThird

Enter the label text: “Registration” and press Shift+Enter again, then enter “Configuration” and press Enter because we’re done.

Our interface now looks like this:

UI - finished SDS

And it includes four properly-named TextBlocks (tbDownload, tbInstallation, tbRegistration, and tbConfiguration) that we can easily access from code-behind.

You can also use SDS to duplicate CSS styles, HTML controls, parameters in method declarations, binary expressions, arguments, string constants and entire method blocks.

SDS will also remember changes you make in each file and suggest those same changes in similar duplications you perform in the same file.

You can also now dismiss all text fields by pressing the Esc key. This is especially useful for Smart Duplicate Selection because it may generate many text fields on the first duplication, and you can press Escape before or after you’ve modified the fields you need to change.

That’s the killer feature in this release, and we hope you find it as useful as we do. Let us know what you think and how we can make it even better.

Code Formatting

Earlier versions of the code wrap option would move the entire expression to the next line if any part of it exceeded the margin. The new Simple Wrap formatting option allows you to wrap only those parts of the expression that exceed the margin, performing a non-greedy wrapping and in some cases reducing the number of lines needed to see the code.

SimpleWrap

Unit Testing

  • You can now run unit tests under SciTech Software’s .NET Memory Profiler. If this third-party product is installed, you can use the Run Under Memory Profiler option to run tests designed to identify memory leaks and other memory usage issues. Note: support for the CodeRush Test Runner is included with the .NET Memory Profiler versions 5.6 and up.
  • CodeRush Test Runner now supports running tests created for the F# language.

Code Analysis

CodeRush Analyzers now appear in the Code Issues Catalog. You can use this options page for the following tasks:

  • Enable/disable specific Code Issues.
  • Add/remove Code Issues to/from Visual Studio’s background analysis.
  • Specify the severity of each Code Issue.

CodeIssuesCatalog

Region Creation

CodeRush Classic’s Region Creation feature is now available in CodeRush. Use the Ctrl+3 shortcut to create a region around the current member or selection instantly.

RegionCreation

C# 7 Syntax Support

We are supporting С# 7 syntax in CodeRush features that generate exception-throwing statements (like Throw Exceptions Contract).

Now these CodeRush features generate the specified throw-expression operation if the corresponding preference is set in the Visual Studio settings.

ThrowExpression

Give CodeRush a Try!

Download CodeRush from the Visual Studio Marketplace.

Every 30-day sprint we work hard to make CodeRush the best it can be. Let us know how we’re doing, and what we can do to make CodeRush even better for the way you develop.

More Posts