CodeRush 17.2.5 is Available

Another 30 days, another CodeRush release. Download the latest version from the Visual Studio Marketplace. This update contains the following enhancements:

Code Style

  • You can now change the default visibility modifier CodeRush uses for generated members.

    17.2.5-DefaultScope
    This setting is used by Declaration Providers, Templates and other features that generate new members from scratch.
  • There's a new Code Style option that lets you set preferences for adding clarifying (but optional) parentheses to your code.

    17.2.5-OptionalParentheses

    You can apply these Code Styles with the Code Cleanup feature.

    17.2.5-OptionalParenthesisCleanup

Templates

  • Now you can create new templates based on existing templates. Just right-click the template you want to duplicate (in the Templates options page), and select "Create Duplicate". Enter a new template name, and change the expansion or context as needed.

    17.2.5-TemplatesDup
  • Now you can easily insert template aliases into your existing templates (allowing templates to insert the contents of the aliased templates into the editor when they expand). Inside the Template Editor, just right-click and choose "Insert Alias...", then specify the name of the template to include. This is useful for sharing the same code expansion between two or more templates.

    17.2.5-TemplatesAlias|
  • You can now easily include any type in the CodeRush templates system as a Template Name Variable. Just right-click the type anywhere it appears in the Visual Studio editor and choose “Use Type in Templates...”.

    17.2.5-UseTypeInTemplates

    After selecting Use Type in Templates..., CodeRush asks for the shortcut mnemonic to use for the type.

    17.2.5-UseTypeInTemplates2

    After adding the new type, it will instantly become available in all type-aware templates, including declaration verbs like "m" (for methods), "p" (for properties), "q" for constants, "t" (for types) and "v" (for variables).
  • We have improved support for new language features in templates and other context-aware features by adding the [InInterpolatedString] context and adding the language version parameter to the [InVisualBasic(version)] and [InCSharp(version)] contexts.

Try It Today!

Download CodeRush from the Visual Studio Marketplace and let us know what you think. Updates every 30 days. The latest What’s New is always here.

CodeRush 17.2.4 is Available for Visual Studio

Another 30 days, another CodeRush release. In this release, what used to be called “CodeRush for Roslyn” (which works in Visual Studio 2015 and up) is now known simply as CodeRush.  If you’re working in earlier versions of Visual Studio CodeRush Classic is still available and supported.

CodeRush has a new product icon, which looks like this:

CoreRushIcon128x128
The new CodeRush icon.

And we have a new product logo text, which looks like this:

CodeRush640

Here’s what’s new in this latest sprint:

XML Support

The following features are now available in XML:

XMLFeatures

Visualization Tools

The Right Margin Line can help you keep code lines from getting too long or exceeding style guidelines. The margin serves as a visual indicator showing lines that have overrun the specified line length.

RightMargin

You can enable the right margin line using the new button (on the CodeRush Visualize toolbar) and configure it in the CodeRush Options dialog on the Editor | All Languages | Right Margin Line page.

RightMarginToolbar

Code Analysis

With Code Metrics you can now establish a Threshold value that determines when the metric appears and when/if the metric contributes to code analysis. This option allows code analysis to report type members that exceed your specified complexity thresholds.

CodeMetrics

Code Formatting

C# Document Formatting adds the following options:

  • Wrapping and Spacing configuration for the “??” operator.
  • Wrapping and Spacing configuration for the base types list.
  • Wrapping and Spacing configuration for the constructor initializer.
    FormattingConstructor
  • Excessive Line Breaks Removal.
    FormattingLineBreaks
  • Separate Line Break configuration options before “else”, “while”, “catch” and “finally” keywords.

Navigation

  • The filtering dialog now has “Select All/None” switches for Scope, Types, Members and Access.
  • The filtering dialog also gains the ability to quickly reverse a filter (Shift+filter key selects/deselects all but the filter element associated with that key).

NavFilter

    CodeRush 17.1.9 is Now Available

    CodeRush 17.1.9 is now available, adding support for source code & XAML formatting, Microsoft Fakes support, and we have improved the unused member de-emphasis experience.

    Code Formatting

    The Code Formatting feature now includes new (beta) abilities to configure Line Breaks. Two new options pages have been added:

    Editor | C# | Formatting | Blank Lines — enables you to configure the number of blank lines around and within the following code elements:

    • Namespaces
    • Types
    • Methods
    • Properties
    • Fields

    Editor | C# | Formatting | Braces — enables you to configure the line breaks around and within the following code blocks:

    • Namespaces
    • Types
    • Methods
    • Properties
    • Accessors
    • Lambda Expressions and Anonymous Methods
    • Statements


    Code Formatting styles are applied using the Code Cleanup feature.

    XAML Formatting

    We have added an ability to normalize whitespace inside XML comments.

    XAML_Whitespace

    Unit Testing

    • CodeRush Test Runner now supports the Microsoft Fakes isolation framework.

      It helps you mock the code you are testing by replacing parts of your application with the small pieces of code under the control of your tests.


      Note: Microsoft Fakes framework is available only in the Enterprise version of Visual Studio.

    • The Code Coverage filtering has been improved. You can now filter the report, not only by name and percentage, but also by node kind.

      For example, you can create a filter that only shows methods with test coverage between 1% and 40%, like this:

      CoderageFilter

    Code Analysis

    We have improved the Highlight Unused Members experience so that member de-emphasis is temporarily disabled when the caret is inside the member.

    Thanks For Your Support!

    You can always download CodeRush for Roslyn from the Visual Studio Marketplace.

    If you’re already using CodeRush for Roslyn and enjoying it, please share a review with other Visual Studio developers!

    CodeRush for Roslyn 17.1.8 is Available

    Another 30 days, another release of CodeRush for Roslyn. This release brings improvements in .NET Core 2.0 support, code formatting, code analysis, code providers, and templates.

    .NET Core 2.0 Support

    The Unit Test Runner now runs .NET Core 2.0 tests and can calculate Code Coverage in Portable PDB debug-symbols-format projects. Also, the Unit Test Runner gets a performance boost when running .NET Core tests.

    Code Formatting

    We have added a new code formatting feature that controls spacing options in your code. Now you can add or omit spaces around virtually every part of code, with more formatting options available than what you get with Visual Studio alone. Spacing style code formatting rules are applied with the Code Cleanup feature.

    Formatting_Spaces

    We have also improved XAML formatting, adding the ability to format markup extensions. You can now control the following options:

    • Break arguments apart only if the argument count for an element exceeds a specified count.
    • Align markup extension arguments with first argument.


    Code Analysis

    This release includes a preview of a new feature we’ve been working on, NullReferenceException Analysis. This feature identifies unprotected code that may unintentionally raise NullReferenceExceptions.

    Null-reference exceptions are often thrown in unexpected, edge-case scenarios, and can easily remain undetected even after publishing your software. These code defects are challenging to find and are often discovered by customers after the application has shipped.

    CodeRush for Roslyn now identifies code that may be prone to throwing a NullReferenceException. You can turn this feature on for C# (it is disabled by default) on the Editor | All Languages | Static Code Analysis options page:

    NullRefSearch

    Turn this feature on and let us know what you think.

    Refactorings and Code Providers

    We have added a new Add XML Comments code provider, which lets you instantly add new XML doc comments to members.

    If you use Add XML Comments for a member that is an override or an interface implementation, the XML doc comment is based on the documentation found in the interface or ancestor class. If the target method has no base method or its base method or interface declaration has no XML comment, the code provider generates an empty XML comment with the correct structure.

    Local Function Templates

    Templates for creating methods are now available inside members in C# (for C# version 7 and above) to create local functions:

    LocalFunctionTemplates

    For more information on using templates to create methods and write code quickly, see the M for Methods video in the CodeRush Feature of the Week series.

    ClickToWatch_0C42A107

    Thanks For Your Support!

    You can always download CodeRush for Roslyn from the Visual Studio Marketplace.

    If you’re already using CodeRush for Roslyn and enjoying it, please share a review with other Visual Studio developers!

    CodeRush 17.1.7 Released

    This release of CodeRush for Roslyn, our Visual Studio productivity boosting add-in includes enhancements to code coverage, code analysis, and more. This release also includes a preview release of project-wide code cleanup.

    Code Coverage

    You can now exclude specific projects from Code Coverage analysis using the *.runsettings file. For details refer to Microsoft’s article, Customizing Code Coverage Analysis.

    ExcludeFromCoverage

    You can now create and apply Filters to the Code Coverage report. For example, you can create a filter that only shows members with less than 70% coverage.

    FilterCoverage

    Code Analysis - Unused Members

    We have added a new analyzer that detects unused members.

    HighlightUnused

    You can also configure unused member highlighting in the CodeRush options dialog (Editor | All Languages | Static Code Analysis | Highlight unused members).

    HighlightUnused2

    Unused members can be safely deleted without changing program behavior.

    Refactorings and Code Providers

    The Use string.Format refactoring is now available on interpolated strings.

    Project-wide Code Cleanup (Preview)

    You can now run Code Cleanup for the entire project. Simply right-click the project you want to clean in the Solution Explorer and select Cleanup Project from the context menu.

    CleanupProject1

    As CodeRush cleans the project, a window shows progress.

    CleanupProject

    If code cleanup is cancelled, all code files will remain unchanged.

    Reminder: This feature is in a preview state, and may break or change the behavior of your code. If you find Code Cleanup yields unexpected results, please let us know. You can globally undo the entire operation using the Visual Studio’s Undo action (available when any document changed by code cleanup is open).

    Download CodeRush for Roslyn from the Visual Studio Marketplace.

    More Posts