How-To's

ReSharper Ultimate 10.1 EAP Build 1 (Part 2)

The scope of improvements in the recently launched ReSharper Ultimate 10.1 EAP is so huge that the communications just don’t catch up with the development team anymore.

In the first part of an overview of the latest ReSharper Ultimate, we talked about an array of new context actions, refactorings, code inspections and quick-fixes.

This part 2 is less centered around C# support and lists more prominent improvements across languages supported by ReSharper, as well as considerable updates to other ReSharper Ultimate products: ReSharper C++, dotTrace and dotPeek.

ReSharper (continued)

Smart Paste

Smart Paste is a new feature that ensures the right escaping in string literals that you copy/paste around your code.

For example, you can copy a piece of text or XML that contains double quotes, paste it into a string literal in C#, and have ReSharper automatically escape all the quotes.

Smart-pasting XML into a C# string literal

This also works when you’re pasting a piece of C# code into an XML doc tag: Smart Paste will escape any generics and lambda syntax, as well as logical operators and anything else that is fine in C# but not allowed in XML values.

Other things that ReSharper can escape for you include file paths and line breaks.

The feature works in C#, VB.NET, JavaScript, XML, XAML and HTML files, making sure to respect the different ways of escaping illegal characters that are used in different contexts.

Initial support for JSON and JSON schemas

ReSharper 10.1 is expanding its technology reach by supporting JSON files and schemas in all supported versions of Visual Studio (2010-2015).

JSON and JSON schema support currently ranges from things as basic as syntax highlighting in older Visual Studio versions, to more sophisticated features like formatting and rearranging (for example, you can move object properties or arbitrary selections around), code inspections and quick-fixes, as well as code completion that is aware of schemas, paths, regular expressions and packages.

Regexp completion in JSON schema

JavaScript and TypeScript support evolves

ReSharper 10.1 brings initial support for experimental JavaScript syntax constructs that are projected to be part of ECMAScript 7. These include comprehensions, decorators, class properties, exponentiation operator, rest and spread properties for object literals.

In terms of TypeScript, ReSharper 10.1 EAP is highlighted by:

  • Support for TypeScript 1.7 that is (hopefully) complete
  • Experimental support for TypeScript 1.8 including string literal types

Other changes

Other notable changes in ReSharper 10.1 EAP 1 include:

  • Run configurations that are extended so that you can now attach the debugger to a running configuration
  • New code style settings and inspections to enforce style for braces and attribute sections
  • A quick-fix to convert a part of a loop to LINQ is now disabled by default (as it rarely produces a readable result), and a quick-fix to convert the full loop to a LINQ expression is downgraded to a hint
  • Correct detection of C# language level in .cshtml files
  • A new context action to add braces around switch case statements
  • Various fixes to existing quick-fixes such as “Encapsulate field” and “Change instantiated type”

Here’s the (presumably) full list of fixes in ReSharper 10.1 EAP 1.

ReSharper C++

Similar to the mainline ReSharper, ReSharper C++ 10.1 EAP introduces a substantial set of new context actions and quick-fixes. In addition, it adds To-do Explorer, improves the code generation subsystem, and supports more C++ language features.

To-do Explorer

ReSharper C++ 10.1 introduces the long-awaited navigation view: the To-do Explorer, which lets you view, group and filter comments that contain one of the 3 default to-do patterns (Bug, Todo and Not Implemented) and any custom patterns that you might want to set up.

Todo Explorer in ReSharper C++

If you use the full ReSharper Ultimate license and you have a multilingual solution, the To-do Explorer will gather to-do items from all supported languages: C#, VB.NET, C++, JavaScript, XAML, HTML etc.

An array of new context actions and quick-fixes

In most cases whenever there’s a code inspection, one or several quick-fixes should be available to alleviate a detected problem. With that in mind, ReSharper C++ 10.1 adds quick-fixes to some of its existing code inspections. Examples include:

  • “Create and initialize field from constructor parameter” is now available as a quick-fix to a code inspection that detects an unused constructor parameter:
    Quick-fix to create and initialize field from constructor parameter in C++
  • Whenever ReSharper C++ reports possible unintended object slicing, it now suggests a quick-fix to add an explicit cast.
  • If the type of a value that is actually returned doesn’t match the return type of a function, ReSharper C++ will suggest a quick-fix to change the return type:
    Quick-fix to change function return type in C++
  • If you are trying to assign to a read-only member, ReSharper C++ will now suggest to make the data member involved mutable:
    Quick-fix to make data member mutable in C++
  • If a base class or its function receives a final specifier, ReSharper C++ will put error highlighting over its overriding classes or functions and provide quick-fixes to remove the specifier
  • For any empty declaration that ReSharper C++ encounters, it will suggest a quick-fix to get rid of it

Other changes

Other notable changes in ReSharper C++ 10.1 EAP 1 include:

  • Rename refactoring can now rename files in addition to code symbols
  • The list of supported C++ language features is extended with generalized lambda captures (C++ 14) and exception specifications
  • The Generate stream operations action available via Alt+Ins can now generate stubs for Boost.Serialization functions: save(), load() and serialize()
  • Generate relational operators can now optionally use std::tie
  • Formatting options are now taken into account when generating code
  • All ReSharper C++ actions are banned from changing library headers
  • Code completion in C++ has undergone a massive bugfix, totaling around 50 resolved issues

Here’s the full list of fixes in ReSharper C++ 10.1 EAP 1.

dotPeek

Extension methods rendered as instance methods

For years, dotPeek has displayed extension methods as static method calls, often complexified with a legion of casts, all of which made extension methods hard to follow in decompiled code.

This update finally learns to show extension methods being called like instance methods, which makes for much more readable code.

Extension methods in decompiled code

You’ll notice from the screenshot above that dotPeek will only show extension methods as an instance method call if it is valid to do so. That is, QueryExtensions.SortBy is shown as an instance method call, but Queryable.Take and Queryable.Skip are shown as static methods, because there are other Take and Skip methods in scope that would make showing these as instance calls ambiguous.

As this change belongs to the decompiler core, it should apply in ReSharper’s integrated decompilation functionality as well.

dotTrace

Thread diagram in Visual Studio

dotTrace integrated in Visual Studio becomes a fully functional Timeline Viewer that allows you to perform detailed analysis of timeline performance snapshots right in Visual Studio.

Threads diagram, a part of dotTrace Performance Profiler integrated in Visual Studio

Before dotTrace 10.1, the main drawback of the integrated viewer compared to its standalone counterpart was the absence of the Threads diagram. This update removes the drawback: the integrated viewer gets exactly the same diagram, which you can now use to select threads, time range, and of course, view thread activity and filtered time intervals.

Other changes

dotTrace console utilities also get their portion of improvements. The reporter.exe tool used to get performance data from snapshots (e.g., for profiling automation and CI) now puts additional data in its XML reports. If you build a report with the /add_process_info option switched on, the report will include a path to the executable of the process that was profiled. This can be extremely helpful when profiling applications with multiple child processes.

There is also a number of minor improvements, such as updated colors in Timeline Viewer tables (it’s now easier to distinguish between table item states), and a more convenient grouping of snapshots in dotTrace Home.

dotMemory, dotCover

As of ReSharper Ultimate 10.1 EAP build 1, dotMemory and dotCover don’t include any significant updates apart from bug fixes.

Wrapping it up

Please download ReSharper Ultimate 10.1 EAP.

Experiencing issues with the EAP? Please report them to issue trackers of affected products. Here are links to issue trackers that you can use to report or track issues: ReSharper, ReSharper C++, dotTrace, dotCover, dotMemory, dotPeek.

image description