How-To's

ReSharper 10 EAP 2

We have launched EAP for ReSharper 10 about a week ago with a set of fixes and improvements to JavaScript and TypeScript. We hinted that we had more to offer as soon as we merge the new material. Today is the day when we start delivering. ReSharper 10 EAP 2 adds considerable changes in ReSharper itself, as well as in two other ReSharper Ultimate tools: ReSharper C++ and dotPeek. Below is the list of highlights:

ReSharper

Out-of-the-box postfix templates

Do you know postfix templates? There’s a ReSharper plugin started over 2 years ago that has since garnered quite a lot of following. The idea has even been implemented in IntelliJ IDEA and its derivative products and made available out of the box. In ReSharper 10, in order to close the circle, we’re including postfix templates into core ReSharper, and this is already available in ReSharper 10 EAP 2.

From now on, without installing any plugins, you can enjoy postfix templates in C#. For example, you can start with an expression and proceed to wrap it in an if statement to check whether it returns true.

More than that, if you’re dealing with null checks on a regular basis, use .null and .notnull postfix templates:
ReSharper's postfix template to check if something is not null (before expanding)
This will both check if the selected entity is not null and wrap it in an if statement:
ReSharper's postfix template to check if something is not null (after expanding)
Need to throw an exception if the condition is met? Enter the exception class name, then a dot, and look what we’ve got here:
ReSharper's postfix template to throw an exception (before expanding)
After selecting the .throw template, you have the complete throw statement, and the caret in place to enter arguments:
ReSharper's postfix template to throw an exception (after expanding)

Usage-aware Go to declaration

In other news, ReSharper 10 EAP 2 extends the functionality of Go to declaration (as well as Ctrl+click) so that you can also use the shortcut to look up usages.

In the easiest case where you have one declaration and one usage, you can use Go to declaration to simply switch between them: you’re simply enabled to use a single shortcut instead of two different shortcuts.

If you have multiple usage of a symbol, here’s what you can do:

  • Invoking Go to declaration on a usage for the first time gets you to the declaration as you would expect.
  • Invoking Go to declaration for the second time (when already on the declaration) gets you back to the usage where you came from.
  • Subsequent Go to declaration hits take you to further found usages of the symbol, one usage at a time. Navigation between usages is aided by a Find Usages-like pane that enumerates found usages, contains additional controls to mouse-click between usages, and helps you flush all found usages to the regular Find Results window if you feel like doing this.
    A pane that shows found usages for the extended Go to Declaration

Needless to say, at any point you can hit Esc to revert to the traditional, non-usage-aware Go to declaration.

Further fixes

We’ve fixed more red code in Xamarin.Forms projects and elsewhere. Other fixes are scattered across TypeScript support, Feedback Center, code completion and Code Cleanup, among other subsystems. Here’s the (hopefully) full list of fixes in ReSharper 10 EAP 2 if you’re interested in details.

ReSharper C++

The ReSharper C++ team has basically merged everything they’ve worked for since mid August. There are about 90 issues closed during the time span, and the list is highlighted by the following:

  • A new context action to create derived class when standing on a class declaration:
    Create derived class action in ReSharper C++
  • New context actions to replace decltype with the underlying type, as well as to substitute a template type alias:
    Substitute template type alias
  • A new gutter icon (in addition to a code inspection and a quick-fix) that displays whenever ReSharper C++ detects that one local declaration hides another local declaration:
    Declaration hides previous local declaration

Other notable changes include a more elaborate way to determine that a function can be made const, support for functions marked with [[noreturn]] and __declspec(noreturn) attributes, a generate action that creates Google Mock stubs, and a way to navigate from a function declaration’s parameter to the corresponding parameter in the function’s definition.

dotPeek

The dotPeek team has implemented one of the most anticipated features: you can now navigate to IL code from any point in the C# decompiled code viewer:
Navigate to IL code viewer in dotPeek
IL code is shown in a separate tool window that is synchronized with the main code viewer:
dotPeek IL viewer tool window

IL code support is not yet implemented in ReSharper but we’ll be working on that as well.

In another considerable change, dotPeek now supports the same set of color themes as Visual Studio does: for example, you can select Blue or Dark theme, or choose to synchronize your color scheme preference with Visual Studio settings.
Dark theme in dotPeek

What’s next?

If the changes described above are relevant to you, you’re more than welcome to download ReSharper 10 EAP 2.

We have more significant changes waiting in line to be made public in further EAP builds. Stay tuned.

image description