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
.notnull postfix templates:
This will both check if the selected entity is not
null and wrap it in an
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:
After selecting the
.throw template, you have the complete throw statement, and the caret in place to enter arguments:
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.
Needless to say, at any point you can hit Esc to revert to the traditional, non-usage-aware Go to declaration.
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.
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:
- New context actions to replace
decltypewith the underlying type, as well as to substitute a 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:
Other notable changes include a more elaborate way to determine that a function can be made
const, support for functions marked with
__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.
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:
IL code is shown in a separate tool window that is synchronized with the main code viewer:
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.
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.