Language injections in ReSharper Ultimate 2016.3

ReSharper Ultimate 2016.3 introduces a new infrastructure for language injections in string literals, which enables ReSharper to treat particular string literal contents as a piece of code written in one of the supported programming languages: C# or ECMAScript regular expressions language, CSS, HTML, JSON or JavaScript.

You can inject a language into a string literal in one of the following ways.

Method 1: “Mark as injected language” context action

When you open the Alt+Enter menu on a string literal, you’ll see a “Mark as injected language” item. In the submenu, choose one of the supported languages. The contents of this string literal will be recognized as a piece of code in that language:

Mark as injected language

Even though this kind of injection tracks code changes and persists in many ordinary cases, it can disappear if you perform huge code reorganization, such as moving to another file or performing Extract method refactoring. Please take into account that tracking code changes has a performance penalty, so if you have many items injected using “Mark as” in the same file, in some cases you may notice a slowdown.

If you need to remove language injection inserted using the “Mark as injected language” context action, you can press Alt+Enter and select “Remove <language> injection mark” there:

Remove injection mark

Method 2: injection comment

You can use a comment to inject a language into a string literal.

The syntax is mostly compatible with the syntax used by IntelliJ IDEA for the same feature. That means that if your team members use both IntelliJ-based products and ReSharper, all of them will have the same experience for injected languages.

A language injection comment has the following form:

where language specifies a language ID to inject. It is case-insensitive. The following language IDs are currently supported:

  • CSS – CSS language injection
  • HTML – HTML language injection
  • JSON – JSON language injection
  • JSREGEXP – ECMAScript regular expression language injection
  • REGEXP – .NET regular expression language injection
  • JAVASCRIPT – JavaScript language injection

Please note that some of language injections are available only for particular target languages.

Availability of language injections using code comments is shown in the following table:

Injected language In C# strings In JavaScript strings
CSS Yes Yes
HTML Yes Yes
JSON Yes Yes
ECMAScript regular expression No Yes (prefix/postfix unsupported)
.NET regular expression Yes (prefix/postfix unsupported) No
JavaScript Yes Yes

prefix= and postfix= options provide a way to specify a string that “precedes” your string and a string that “follows” your string, respectively. This is very helpful if you want to have language assistance only for a code fragment. For example, you can inject a CSS color value into a string by using the following comment:

HTML injected into JavaScript

It is important to know that prefix= and postfix= are matched textually, so that all the leading and trailing whitespaces specified in these options will be included in the target string. For example, if you want to have a prefix { and a postfix } without any whitespaces, then you need to specify the following options:

Language injections using code comments don’t have the problems of the “Mark as” action described in Method 1. They are stable as long as your comments are there, and they don’t cause any visible performance impact.

There are, however, several differences in how IntelliJ Platform implements the same feature (which is used in IntelliJ IDEA, WebStorm, and other IntelliJ-based products):

  1. In ReSharper implementation, quotes are not trimmed, neither from language=, nor from prefix= and postfix=. This is done intentionally, because you may want to have prefix/postfix with quotes, and also this is done to encourage using simple injected language IDs.
  2. Comment positioning in ReSharper is more relaxed than in IntelliJ implementation. In IntelliJ, the injection comment always matches the nearest following literal, so you’ll locate it as close as possible to the target literal. In ReSharper, language specifics are taken into account, and the comment may be located after the literal itself, or after some simple construct embracing the literal, or even at the end of the line.

Method 3: automatic injections

This kind of injection is performed by ReSharper itself, so in most cases you will work with injections without even noticing it. For example, if you set the innerHTML property of a JavaScript object, you’ll get HTML assistance in your assigned string value. Also, HTML and CSS injections are automatically provided for Angular templates in JavaScript code:

Automatic injection in AngularJS

ReSharper has a dedicated Options page where you can see all the available automatic injections and disable or re-enable them as needed.

Language injection settings

This mechanism is extensible, and it’s easy to provide your own places for language injections for supported languages in your ReSharper plugin. You’ll need to implement the interface called IInjectionNodeProvider as a SolutionComponent.

  • In the Check() method, provide your logic for checking the particular syntax tree node. If it returns true, the target language will be injected in this node. You can save some intermediate computation results into “data”, to use them for prefix and postfix computation.
  • GetPrefix()/GetPostfix() provide an ability to specify prefix and postfix for language injection (check ‘Comment’ section of this article to learn more about prefixes and postfixes). You can use a previously computed state “data” here.
  • ProvidedLanguageID should be one of the IDs described in the section ‘Method 2: Injection Comment’ above (using InjectedLanguageIDs static class properties is recommended).

As your plugin is loaded by ReSharper, you’ll see your own injections implementing IInjectionNodeProvider in the same options page where built-in injections are shown.

Current limitations and plans

Currently you can inject a language only into a single proper string literal. That means that you can’t inject a language into a string concatenation. Also currently you can’t inject a language into a C# 6 interpolated string or a ECMAScript 2015 template string if they have template arguments (for argument-less template strings, injection works). Note that even though injection works with C# string.Format string, the string content is treated literally, without substituting the arguments. So, depending on your target language, it may or may not be a syntax error.

Currently there is no mechanism to provide language injections using ReSharper external annotations. One of the upcoming ReSharper releases will introduce a [Language] external annotation for C# to provide you with one more way to manage language injections.

Please note that using prefix= and postfix= for language injections can cause some features to behave unexpectedly in certain situations. This may happen if you have significant constructs (such as variable declarations) in prefix/postfix code, or if some parts of the same syntax element are split between prefix/postfix and the real string contents. Use this possibility with care.

All the symbols defined inside language injections (for example, JavaScript variables or CSS classes defined inside string literals) are local to the injected piece of code, and are not guaranteed to be reachable from code external to the inject.

Language injections can be implemented only for the languages that are natively supported by ReSharper. For example, that means that until SQL is natively supported by ReSharper, it’s impossible to have injected SQL, despite the fact that it is a highly requested feature. But for any language natively supported by ReSharper language injections are doable. Please create a feature request if you’re missing one.

We’re going to address many of these limitations in our further releases. Stay tuned!

Posted in How-To's | Tagged , , , , , | 12 Comments

ReSharper Ultimate 2016.3.1

Looking for a bugfix release? We have one! ReSharper Ultimate 2016.3.1 is now available for download. This update addresses a selection of issues in ReSharper and ReSharper C++.

ReSharper 2016.3.1 is mostly about integrating into Visual Studio 2017 RC. We’ve received a lot of complaints about 2016.3 not detecting a Visual Studio 2017 RC installation. In all cases, repairing the Visual Studio installation would fix the issue, and based on this experience, we’ve updated the installer to detect (and warn about) incomplete Visual Studio installations.

Other than that, the new ReSharper fixes a couple of code analysis regressions, issues with discovering .NET tests in certain scenarios and running Jasmine tests, and addresses some false red code reports in PCL projects and elsewhere. Here’s the full list of ReSharper fixes for your reference.

ReSharper C++ 2016.3.1 improves an assortment of code inspections, quick-fixes, unit testing, IntelliSense and XML documentation usage scenarios. Here’s the full list of ReSharper C++ fixes.

Posted in How-To's | Tagged , , , | 5 Comments

ReSharper Interactive Tutorials

Probably, there is no person in the world who knows ReSharper in all its diversity. Even proficient ReSharper users normally only use a limited set of their favorite ReSharper actions in their everyday life. Though this set can be wide enough, there’s always a chance you miss some important ReSharper tricks that can make your development workflow easier. But where and how should you get to know and try them?

We at JetBrains are continuously working on all possible ways of communication, such as blog posts, learning videos and online help. For example, if you want an easy way to try a feature instead of only reading about it, we’ve created two repositories available on GitHub:

With both solutions, the idea is simple: you open a solution and follow the instructions that are given in comments to the code.

Today, we announce a new way to get started (or catch up) with ReSharper: a plugin with a set of interactive ReSharper tutorials. The idea that it is based upon is similar to our tutorial solutions available on GitHub but with one very significant difference: you are guided through a tutorial solution, and the plugin verifies every step you take.

How tutorials work

  • The tutorials are installed into Visual Studio as a ReSharper plugin. Go to ReSharper | Extension Manager, search for “Tutorials”, and install the plugin.
    Install ReSharper Tutorials plugin
  • After you install the plugin, the ReSharper menu will get an additional Tutorials… item.
    ReSharper Tutorials menu
  • Once you run the tutorials, the ReSharper Tutorials window will appear suggesting you to select a tutorial.
    Select a tutorial
  • As soon as you launch a tutorial, a separate tutorial solution is loaded. You’ll be guided through a number of steps, each illustrating a particular feature. The plugin automatically checks whether you have performed the actions described in a step (some steps only show info, so you’ll only need to click Next Step to proceed).
    Tutorials in action

Currently, there are two tutorials available:

  • ReSharper Essentials will get you started with the most important shortcuts and commands.
  • What’s New in ReSharper 2016.3 will guide you through ReSharper 2016.3 features for C#.

This is a preview version and work is still in progress. There’s a lot of more to do: make the UI fancier, add more advanced tutorials, and other enhancements. Nevertheless, it’s already a fully functional product and probably the most convenient way to learn ReSharper.

You’re welcome to give a new plugin a try, learn something new, and provide your feedback.

Posted in How-To's, ReSharper Tips&Tricks | Tagged , , | 10 Comments

ReSharper Ultimate 2016.3 is Released!

We have just finalized an update to ReSharper Ultimate, and we invite you to check out what’s new and download ReSharper Ultimate 2016.3 RTM!

Watch the following video for a summary of what is new in ReSharper Ultimate 2016.3, or read on for the main highlights of this release:

ReSharper

In addition to 700+ fixes, major highlights of ReSharper 2016.3 are the following:

  • Visual Studio 2017 RC initial support. All ReSharper Ultimate tools now support Visual Studio 2017 RC, including the new .csproj based .NET Core projects. Please note that though Visual Studio 2017 is marked as “RC” there are a number of features and architectural changes that are currently marked as “preview”. As such, we are still working on support for some of these new Visual Studio features, such as lightweight solution load and .NET Core unit testing.
  • Early support for C# 7 and VB.NET 15. ReSharper 2016.3 learns to understand VB.NET 15 and C# 7 binary literals and digit separators. C# 7 local functions are supported with a set of code inspections, such as Possible System.NullReferenceException, Access to disposed closure, and Access to modified closure. C# 7 out variables, pattern-matching in is expressions and switch cases are also supported.
    Digit separators and binary literals
  • New code generation actions. Generate Relational members action helps you automatically overload relational operators (>, <, , ) and/or implement IComparable and IComparable<T> using selected fields and properties. Generate Relational comparer creates a comparer class derived from Comparer using selected fields and properties. Generate Dispose pattern action helps you generate the implementation of IDisposable with optional nullability checks and destructor for unmanaged members.A quick-fix that helps implement a dispose pattern for IDisposable
  • New quick-fixes and context actions. ReSharper 2016.3 adds a new quick-fix to Introduce fields and auto properties from all unused parameters. This is an extension to the existing quick-fix that will introduce a field from a single constructor parameter, but if you extend the Alt+Enter menu item, it will now apply to all unused parameters at once.
    Introduce from unused parameters quick-fix
    The Introduce property quick-fix also includes a Configure default menu item, which will set what kind of property is generated by default. There's also a new context action on fields of type Lazy to introduce a property to encapsulate fieldname.Value.
  • New Transform Parameters refactoring is based on two existing refactorings: Transform Out Parameter and Extract Class from Parameters. It can be invoked on a method declaration and will rewrite the method’s parameters, changing incoming parameters to a new class, or a tuple, and optionally creating a new class for return value and any out parameters. Transform Parameters refactoring in ReSharper 2016.3
  • ReSharper's unit testing assistance is now available for NUnit and xUnit.net unit tests in ASP.NET Core and .NET Core projects in Visual Studio 2015.
  • Navigation and search improvements:
    • The Find Results window now works asynchronously, meaning that you can work with the results tree while usage search is still in progress. The Show in Find Results button becomes available in the pop-up as soon as you invoke Usages of Symbol (Shift+Alt+F12). So you can just click it or press + to go on working with the code while the search continues in the Find Results window.
      Async Find usages in ReSharper 2016.3
    • Recent Files can now delete entries with the Delete key, and both the Recent Files and Recent Edits pop-ups will now show the path of the file, to avoid confusion with similarly named files.
    • Go to Text now supports new formats of content files, such as .less, .hbs, .coffee, .scss, .dart, .as, .styl.
    • There is a new setting to remember the last search in Go to Everything, Go to Text and other search actions.
  • ReSharper Build receives its own Build Results window, which lists build warnings and errors. You also get more control over how you want to see the results. You can see them as a flat list, or enable grouping, to show by a mixture of project, folder and file. Or you can use ReSharper’s semantic knowledge of the file to group by namespace, type and member.
    Build Results window in ReSharper 2016.3
    Moreover, ReSharper Build now gets its own implementation of NuGet restore.
  • TypeScript, JavaScript and JSON support improvements:
    • Go to Implementation now works for TypeScript types too: you can jump from a base type or member to any of its implementations, bypassing intermediate steps in the inheritance chain.
    • A new quick-fix in TypeScript lets you quickly add type guards to disambiguate unresolved symbols.Surround with typeguard quick-fix
    • Structural Navigation (Tab or Shift+Tab) now works in JavaScript, TypeScript, and JSON.
    • Initial support for TypeScript 2.0.2 (“2.0 RC”): boolean, number and enum literal types.
    • The Encapsulate Field refactoring, which helps you quickly create a property for a field and optionally replace usages of the field, now works in TypeScript.
    • Optimized memory usage for TypeScript caches.
    • TypeScript support gets code completion for literal types, as well as a number of formatting fixes for JSX/TSX files.
  • Extended language injections. In addition to regular expressions and HTML, ReSharper 2016.3 lets you inject CSS and JSON in C#, JavaScript, and TypeScript strings. There are two ways to do so: you can either use the Mark as context action or you can use comments with the special syntax: //language=javascript|html|regexp|jsregexp|json|css
    Marking string literal as JavaScript
    In addition, ReSharper now automatically injects languages in certain known scenarios, such as injecting JavaScript into AngularJS templates, or CSS in jQuery's $[] indexer.
  • Redesigned inspections severity options page (Code Inspection | Inspection Severity).
  • ReSharper 2016.3 might now suggest you to use some of its features that can increase your productivity. In case it notices that some operation can be performed more efficiently, it would show a pop-up with a suggestion. You can enable the feature it suggests, read more about it, or disable further suggestions.

  • New options page (Code Editing | Third-Party Code), which allows adding C++, JavaScript, TypeScript, CSS, HTML and JSON files, folders and wildcards to be treated either as "skipped" or "library". ReSharper will completely ignore "skipped" files, and treat "library" files as read-only indexed for navigation, but with no inspections, quick-fixes and refactorings.
  • Assembly Explorer can now load assemblies directly from nuget.org or from any NuGet package source. Opening assemblies from NuGet package source
  • Stack Trace Explorer now lets you open external stack traces faster: if you copy a stack trace that contains symbols from the currently opened solution and then switch focus to Visual Studio, ReSharper will automatically load it to the Stack Trace Explorer without the need of pressing any shortcuts.

ReSharper C++


ReSharper C++ 2016.3 comes with 180+ fixes and the following set of larger improvements:

  • Visual Studio 2017 RC initial support: Just like the other tools in the ReSharper Ultimate family, ReSharper C++ 2016.3 can be installed into Visual Studio 2017 RC, but please note that in order to work with ReSharper C++ you should set Enable Faster Project Load to false under Tools | Options | Text Editor | C/C++ | Experimental.
  • New typedef refactorings. The Introduce typedef refactoring allows you to quickly create a typedef for the selected data type and replace this data type and all its occurrences with the newly created typedef. The Inline typedef refactoring does the inverse: it replaces an existing typedef with the actual data type.
    cpp_typedef_refactorings-still
  • Postfix completion and templates: Inherited from the mainline ReSharper, postfix code completion allows you to focus on your data, rather than the syntax. When you type a dot (.) or an arrow (->) after an expression, ReSharper C++ will suggest free functions that would accept that expression as the first parameter. ReSharper C++ 2016.3 gets some postfix template goodness as well. You can now quickly wrap an expression with one of the following templates: if, else, while, do, return, switch and foreach.
    Postfix templates in ReSharper C++ 2016.3
  • Catch support. In addition to Boost.Test and Google Test frameworks, unit testing assistance is now extended to support the Catch C++ test framework. Other unit testing improvements include support for Boost.Test in Boost 1.62 and improved performance on dynamic tests. Moreover, unit tests are now automatically updated for externally changed files.
  • C++ code analysis from the command line. Starting from this update, ReSharper C++ code inspections are available via InspectCode, a free command line tool that allows running ReSharper C++ inspections without opening a solution in Visual Studio.
    Command Line Tools for ReSharper C++ 2016.3
  • Enhancements in Quick Documentation: ReSharper C++ 2016.3 can display rich, syntax highlighted tooltips for C++ code elements. The tooltips will display function and variable types, as well as documentation. C#-style XML documentation comments are also sometimes used for C++ symbols. With ReSharper C++ 2016.3 they are correctly displayed in the Quick Documentation pop-up (Ctrl+Shift+F1) and in the quick info tooltip.
    Improved Quick Doc in ReSharper C++ 2016.3
  • Third-party code settings page now allows to exclude files from indexing, so ReSharper C++ will ignore "skipped" files, and treat "library" files as read-only.
  • Support for nested namespace definitions introduced in C++17 and a context action to use the new syntax for nested namespaces.
  • New options for C++ code formatter: "Spaces within parentheses in cast expressions", "Align chained method calls", "Align chained binary expressions" and "Place enumerators on new line".

Other tools in ReSharper Ultimate family also received their shares of improvements. First of all, dotCover 2016.3, dotTrace 2016.3 and dotMemory 2016.3 support .NET Core applications profiling and coverage and provide initial support for Visual Studio 2017 RC. Read on for the list of product-specific changes.

dotCover

  • Reworked coverage highlighting: new highlighting engine in dotCover 2016.3 reveals both coverage status and unit test status. A marker in the text editor shows red if any tests related to the current statement are failing, green if all tests are passing, and grey if there are no tests covering this statement.
    Updated coverage highlighting in dotCover 2016.3
  • New filtering options that allow easy selection of what code should be covered: all assemblies, everything except System and dotCover assemblies, or only solution assemblies without dependencies.
  • Multi-selection for nodes in the coverage tree.

dotTrace

dotTrace 2016.3 provides a wide set of improvements for its Timeline Viewer, for instance:

  • In dotTrace 2016.3, Timeline Viewer incorporates Subsystems feature from the Performance Viewer. To recap, each subsystem just groups calls made within a certain namespace or assembly. It is very handy for a quick estimation of how time in a particular call subtree is distributed among various components: user and system code, WPF, LINQ, collections, strings, and more.
    Subsystems in dotTrace Timeline view
  • New Debug Output filter that can be enabled to focus on what your application writes to the debug output, e.g. with the Debug.Write system method.
  • The new Native Memory Allocation event filter allows you to see what methods are making the allocations and analyze all issues related to native memory: potential memory leaks, issues with unmanaged components used by your managed code, and others.
  • The Call Stack window in dotTrace Timeline gets a whole bunch of enhancements in 2016.3. The Show system functions option that was helpful when analyzing methods’ own execution time is back again. The Top Methods list now shows not only methods own time, but total time as well. Moreover, now you can click on a method’s own or total time in Top Methods or Call Tree. This will apply a filter by a corresponding method or by a method and its subtree. The Top Methods list now follows your selection in Call Tree.

In addition there is a new Events window that shows you a list of events occurred in the profiled application: file operations, JIT, SQL queries, and more. Selecting an event will give details of the event, including timestamp, duration and call stack:
Events window in dotTrace 2016.3

dotMemory

dotMemory 2016.3 adds new inspections to check your application on finalized objects and objects queued for finalization. A new Finalizable objects inspection on the overview page shows such objects sorted by their type.
Finalizable objects inspection in dotMemory 2016.3

dotPeek

dotPeek 2016.3 introduces new ways to explore metadata of .NET assemblies. You can now dig through all metadata items (tables, blobs, strings, etc.) right from the Assembly Explorer, which enables you to automatically find and display usages of metadata table items, decode and display values of blob items and explore PE file headers.
Metadata explorer in dotPeek 2016.3
Same as elsewhere in the assembly tree, you can double-click metadata items to decompile and display the corresponding code.

Licensing

If you have an active subscription for ReSharper, ReSharper C++ or ReSharper Ultimate, we encourage you to upgrade to 2016.3 right away. If you are unsure whether your licenses are eligible to use with 2016.3, or if you need a formal quote or any other assistance, please get in touch with JetBrains sales anytime.


Get ReSharper Ultimate 2016.3

Posted in News and Events | Tagged , , , , , , , | 43 Comments

ReSharper Ultimate 2016.3 Release Candidate

The new release is now so close, you can almost taste it: please download ReSharper Ultimate 2016.3 Release Candidate.

ReSharper Ultimate 2016.3 Release Candidate

If you have watched the progress of Early Access Program but were hesitant to try the early builds in your production environment, Release Candidate is just the right build to test-drive 2016.3 in your daily work. Please do download the RC and let us know if there are any critical issues compared to the latest released version, 2016.2.2.

Here’s a quick recap of changes introduced in 2016.3:

  • All ReSharper Ultimate tools can now work with Visual Studio 2017 RC (still not supported: lightweight solution load; .NET Core unit testing targeting .NET Core 1.1+)
  • ReSharper implements initial support for C# 7 and VB.NET 15; adds new code generation actions, context actions and quick-fixes; introduces a Transform Parameters refactoring; supports running .NET Core unit tests that target .NET Core 1.0.x in Visual Studio 2015; brings noticeable improvements in usage search and ReSharper Build; improves support for TypeScript, JavaScript and HTML; extends the language injection mechanism.
  • ReSharper C++ starts to support the Catch unit testing framework and improves its Boost.Test runner; adds refactorings to introduce or inline typedefs; improves Quick Documentation and Quick Info controls; adopts the idea of postfix completion and postfix templates from the mainline ReSharper.
  • dotCover, dotTrace and dotMemory level up support for .NET Core profiling and coverage.
  • dotCover introduces a more compact way to highlight coverage status in Visual Studio code editors, which is very relevant for Continuous Testing.
  • dotTrace adds multiple improvements to its Timeline Viewer.
  • dotPeek reveals a variety of metadata in its Assembly Explorer.
  • dotMemory extends its set of automatic memory inspections.

Please download the Release Candidate, and do voice your concerns if something goes wrong as you’re using it.

Posted in How-To's | Tagged , , , , , , , | 30 Comments

ReSharper Ultimate 2016.3 EAP 11

We’re nearing the end of the EAP cycle for ReSharper 2016.3. We’ve just released EAP 11, mostly focused on fixing bugs and stabilisation, and with only a couple of new features. Now is the time to try out ReSharper 2016.3, and let us know any issues you encounter.

ReSharper C++

While EAP 9 introduced support for Visual Studio 2017 RC, changes to the project model meant that C++ projects didn’t work. We’re pleased to say that EAP 11 addresses this, and C++ projects are working again. However, we currently require the Enable faster project load property to be turned OFF. Other than this, we’re not aware of any other show stopper issues with C++ support. If you do encounter any issues, please let us know.

This build also introduces a new context action to convert nested namespaces to the new C++17 nested namespace syntax. Note that this requires setting  /std:c++latest in the C/C++ | Command Line | Additional Options section of project properties.

Convert to nested namespaces context action

ReSharper

Aside from various bug fixes and stabilisation, the biggest change of note in ReSharper itself is the support for extra file formats in our super fast Go to Text feature. On top of existing file types, we now support finding text in .less, .hbs, .coffee, .scss, .dart, .as and .styl files.

Download ReSharper Ultimate 2016.3 EAP

Please download the latest ReSharper 2016.3 EAP build and try it with your projects. If you come across any issues, please let us know in issue trackers of ReSharper and ReSharper C++.

Posted in News and Events | Tagged , , , | 8 Comments

ReSharper Ultimate 2016.3 EAP 9 and 10

With all the excitement of releasing the first public EAP build of Rider last week, we didn’t post about ReSharper Ultimate 2016.3 EAP 9. And now we’ve released EAP 10, so let’s get caught up!

Visual Studio 2017 RC

ReSharper Ultimate products now have initial support for Visual Studio 2017 RC, including the new .csproj based .NET Core projects. It’s important to note, however, that even though VS2017 is marked as “RC”, there are a number of features and architectural changes that are currently marked as “preview”. As such, we are still working on support for some of these new Visual Studio features, such as lightweight solution load and opening from folder.

Similarly, the new .csproj based .NET Core project system is marked as “alpha”, and while we support loading projects in this format, there are what we can euphemistically call “rough edges”. One such example is unit testing, which is no longer compatible with how it was run in the project.json world. Existing project.json based testing is of course still working.

A much more serious issue is that changes to the project model means that ReSharper C++ doesn’t currently work with VS2017 RC, at all. We currently recommend against updating to VS2017 RC if you wish to continue using ReSharper C++.

dotCover

Improved highlighting in Continuous Testing sessions

The other big news is that we are now introducing a much requested feature for Continuous Testingimproved highlighting!

ReSharper Ultimate users can enable Continuous Testing to run only the tests that are affected by your current code changes, based on dotCover coverage data (and don’t forget ReSharper Build to speed up the build cycle!). Our previous highlighting left a little to be desired, so we’ve updated it.

We now display a marker in the text editor showing red if any tests related to this change are failing, green if all tests are passing and grey if there are no tests covering this line of code. And when a result is outdated, because the test, or a line of code related to that test has changed, the markers are shown faded.

Continuous Testing highlights

Hovering over the marker highlights the associated region of code and gives a quick summary of the state of change. Clicking on the marker shows a popup with the list of tests that affect the current line. It also includes a small toolbar to rerun all associated tests, only dirty tests, and to run or debug any selected tests. Even better, you can insert a break point and start debugging with a single click.

Double clicking a test in the list will navigate to the test in the results window, and clicking the arrow to the right of a failing test will open a flyout window with failure and exception details, all clickable, of course.

Continuous Testing details popup

(Note that there appears to be a high DPI issue here. If you have DPI set to 200%, then the list of tests doesn’t appear. We’re investigating, and will get it fixed in a future EAP build.)

Revised filtering settings

This build of dotCover also introduces a new Filtering options page that allows easy selection of what code should be covered – all assemblies, everything except System and dotCover assemblies or only solution assemblies, without dependencies. It also allows hiding auto properties from coverage results, and allows editing filters based on assembly name, namespace, typename or attribute.

dotCover Filters option page

ReSharper

Transform Parameters refactoring

C# support gets a new refactoring, Transform Parameters, which takes existing two refactorings – Transform Out Parameter and Extract Class from Parameters – and merges and improves them. The new Transform Parameters refactoring can be invoked on a method declaration and will rewrite the method’s parameters, changing incoming parameters to a new class, or a tuple, and optionally creating a new class for return value and any out parameters.

Transform Parameters refactoring dialog

Quick-fixes to introduce fields and properties

Next, we have a new quick-fix to introduce fields and auto properties from all unused parameters. This is an extension to the existing quick-fix that will introduce a field from a single constructor parameter, but if you extend the Alt+Enter menu item, it will now apply to all unused parameters at once.

Introduce field or property from all unused parameters

The Introduce property quick-fix also includes a Configure default menu item, which will set what kind of property is generated by default – get only, mutable, with private setter, etc.

More new and updated code actions

C# gets another couple of small updates. Firstly, the Generate constructor action gets a small update with an option to check parameters for null. If checked, it will generate guard code that throws ArgumentNullException in the constructor.

And secondly, a new context action on fields of type Lazy<T> will introduce a property to encapsulate fieldname.Value.

Introduce property for lazily initialised field

TypeScript

TypeScript support gets code completion for literal types, as well as a number of formatting fixes for JSX/TSX files.

TypeScript literal completion

To-do item colors

And finally, we’ve fixed a minor irritation: to-do items displayed in one colour in the editor, and a different colour in the To-do Explorer! Now each to-do pattern can have a category – “Normal”, “Edit”, “Error”, “Question” or “Warning”, and each category can have its own colour, which is reflected in the To-do Explorer, the editor and can be configured in Visual Studio’s Fonts and Colors options page.

ReSharper C++

Postfix templates

ReSharper C++ gets some postfix template goodness, with new templates for if, else, while, do, return, switch and foreach. If you’re not familiar with postfix templates, the idea is that they allow you to focus on your data, rather than the syntax.

Typedef refactorings

This build also introduces a couple of new refactorings: Introduce typedef and Inline typedef. Simply highlight a typename and select Introduce typedef from the Refactor this menu (or use Ctrl+R, I) to introduce a typedef. The Inline typedef refactoring will do the inverse – replace an existing typedef with the actual type.

cpp_typedef_refactorings-still

Finally for C++, there’s a small fix to automatically update unit tests when a file is changed externally to the IDE, such as updating from source control.

dotTrace

Events and subsystems in Timeline Viewer

dotTrace’s Timeline view has had a fairly major update with the introduction of subsystems, and the reworking of some of the filter categories.

dotTrace Timeline view subsystem filters

Firstly, the Interval Filters and Analysis Subject filter groups have been merged into a new Events group, which allows filtering by time, memory allocation, debug output (new to this build), garbage collection, file operations, SQL queries and so on.

And secondly, we’ve introduced Subsystems as a set of filters, which you may be familiar with from dotTrace’s other profiling views. Subsystems group methods by namespace and assembly, to categorise code such as WPF, string handling or collections. We’ve extended this to also include time spent in file operations, JIT, garbage collection, SQL queries and so on, to allow a very flexible way of categorising a filter.

Subsystem definition dialog

This is a really helpful way of classifying where time is being spent, giving you an immediate view on what areas require attention: for example, you could see that your code needs to improve string handling, or is spending too long working with collections.

Call Stack view updates

We’ve also made some subtle but really useful changes to the Call Stack view. The methods pane now also shows what proportion of time is spent in various subsystems. Clicking on the subsystem name will enable the equivalent subsystem in the Filters pane, updating the visible methods and call stack to show the methods which end up calling into the subsystem.

Top methods view with subsystems

The methods pane now has a new toolbar which includes a button to follow the selection in the call tree, filtering the list of top methods. There is also a button to toggle showing system functions as separate items, rather than rolling the time spent into the calling method. And finally, there is a button to toggle sorting, by either top method based on own or total time.

Download

Please download the latest ReSharper Ultimate 2016.3 EAP build, and if you come across any problems with this build, please let us know.

Posted in News and Events | Tagged , , , , , , | 14 Comments

Introducing Rider, the New .NET IDE webinar: recording and Q&A

The recording of our recent webinar with Matt Ellis, Introducing Rider, the new .NET IDE from JetBrains, is now available:

In this webinar, Matt shows how to get up and running with Rider, and quickly get it working with your .NET Framework and .NET Core projects. He looks at the features that are familiar to ReSharper users, with code completion, inspections and quick fixes, testing and NuGet. He also shows what the IntelliJ platform brings to the party, including version control, debugging and database tools. And all of this on a Mac.

Questions and Answers

There were some popular questions asked during the webinar, as well as those that we didn’t get the chance to answer on the day.

Q: What can you say about the integration with Unity?

A: Basically Unity support is there: you can edit, run and debug Unity applications, attach to Unity process etc. There’s a featured Unity plugin that works with Rider and ReSharper, which contains Unity-specific generation and coding assistance features. There’s also a plugin that integrates Rider into the Unity editor. We’ll take a more in depth look at Unity support in a blog post that is coming soon.

Q: Will Rider have a coverage tool for Unity editor unit test tool?
A: It’s not decided yet whether we’ll add coverage tools in near future for Unity or for any other frameworks.

Q: Are you planning to add Xamarin Support?
A: Yes. You can already open and edit Xamarin solutions. You can’t run or debug them now but we’ll be working on that.

Q: Any plans to support visual design aspects for Xamarin solutions?
A: Yes, we’re investigating this as well. No time estimates so far but rest assured we’re looking at this.

Q: Are you also developing a GUI designer like in Visual Studio for WinForms, WPF etc?
A: Yes, we’re looking at how we can support at least previewing WinForms/WPF/Xamarin Forms. We’re not sure we’re going to make it for the first release though.

Q: Any news on licensing yet? Part of All Products licence?
A: Rider is definitely going to be a part of All Products subscription. Pricing is not defined but will most probably end up somewhere between ReSharper and IntelliJ IDEA price tags. More details to be decided and announced.

Q: Can you setup a custom font in Rider?
A: Absolutely: see File | Settings | Editor | Colors and fonts | Font. Support for fonts with ligatures is there as well. You can even install custom IDE themes although this is a bit more complicated.

Q: Will we be able to run a UWP project in Rider v1?
A: We probably won’t be able to support UWP in v1; in a longer run, we’ll certainly look at this.

Q: Any support for ReSharper Code Cleanup profiles to format code according to predefined layout? Is it possible to import from existing ReSharper settings?
A: Rider should actually read your per-solution ReSharper settings by default. UI for code style settings and Code Cleanup is coming.

Q: Are ReSharper plugins supported by Rider? Is there any place I read about requirements to make plugins compatible with Rider?
A: If a ReSharper plugin doesn’t contain any UI, Rider can reuse it. We’ll be working on documentation and SDK to make ReSharper plugins available in Rider. Right now, it’s pretty much a manual and undocumented process.

Q: Is there a way to sync my IDE settings between Windows and Mac?
A: Yes. Right now if you’re using ReSharper, save your settings to solution-wide layer with “Save to”. This will create a .sln.dotSettings file, which Rider will respect on Windows and Mac. If you’re not using ReSharper and only using Rider, you’ll probably have to wait until we implement UI for settings management in Rider. We’re working on that.

Q: Will you support SonarLint?
A: In principle, you can even use IntelliJ’s SonarLint plugin with Rider as it’s marked as compatible (we have never tried it though, so unsure if there are issues). However you may not need a lot of that as Rider provides ReSharper’s 2000+ code inspections, including inspections for JavaScript, TypeScript etc.

Q: Does Rider support F# as well or is it a planned feature?
A: Rider doesn’t support F# at this point. We are considering adding F# support in future as it’s a top-voted feature request.

Q: Will other JetBrains .NET tools eventually be available with Rider? (dotTrace, dotCover, dotMemory, etc…)
A: We’re hoping to make them available in some form at some point in future but this is complicated because dotTrace and dotMemory both use a lot of Windows-specific UI. Not something we’re working on in the scope of v1. However, dotPeek’s decompiler engine is available in Rider as well as in ReSharper.

Q: How do I create a live template, such as a NUnit test snippet?
A: Live template editor isn’t implemented yet but will be available at a later time. Current workaround: create a template in Visual Studio + ReSharper, save it to solution-wide .dotSettings file, and Rider will pick it up.

Q: How far are we from v1 release?
A: We expect to release in 2017, probably in Q2.

Q: How will you track with changes happening in VS 2017? Will Rider updates be kept in sync with ReSharper updates?
A: Yes, we’re going to reuse changes introduced in ReSharper updates. Some of them (inspections, context actions) come to Rider “for free”; others require additional effort. As to Visual Studio 2017, if Microsoft introduces something that we don’t have, we’ll consider how and whether to implement anything similar.

Q: Are structural navigation and “smart cursor movement” (when you press dot inside parenthesis, focus is moved outside of expression) in your plans? Really hard to switch to Rider from Visual Studio + ReSharper without that feature :(
A: Structural navigation and typing assists that you’re referring to both require additional efforts to port to Rider, so these will be available later.

Q: Will there be diagrams as in IntelliJ IDEA or layer diagrams?
A: This is not planned in the scope of v1.

Q: Is it possible to share naming conventions between team members (share on a network drive, URL, …)?
A: It will be possible. Right now, if you’re using ReSharper in Visual Studio, save a team-shared solution settings file, and Rider will use it.

Q: Can Rider navigate to .NET source code (instead of decompilation)? Does Rider uses public symbols?
A: Yes it can. It doesn’t decompile library code if it can pull source from Microsoft Reference Source Center: same as ReSharper and dotPeek.

Q: Will Rider eventually substitute all your add-ons for VS?
A: No. Rider will reuse new features introduced in ReSharper but Rider and ReSharper will co-exist: if you’re fine with Visual Studio, you’ll have ReSharper available; if you’re eager to switch IDEs, there’s Rider for you.

Q: Is Rider compatible with Visual Studio 2008 projects and solutions?
A: Yes, you should be available to load, edit, run and debug these projects on Windows.

Q: Some more information on debugger? Same as within Visual Studio?
A: A different implementation. We’re targeting feature parity with Visual Studio by the time of v1. Just My Code and Edit and Continue are currently two missing pieces. (GPU and native debugging are out of scope though.)

Q: Will there be an integration for ClearCase?
A: There are ClearCase plugins available for the IntelliJ platform, but they’re not currently marked (or tested) as compatible with Rider. If there’s demand, we’ll try to make them compatible.

Q: What framework is Rider written in?
A: Rider is written in a custom framework that implements a fast and efficient protocol to be able to transfer data between the backend (ReSharper) and the frontend (IntelliJ IDEA), and guarantees data consistency.

Q: How soon will Rider support .NET Core 1.1 and MSBuild based .csproj files?
A: We hope to provide support for these technologies in upcoming EAP builds, most probably before end of this year.

Q: Does Rider support running on both .NET framework AND Mono on Windows? Or is Windows .NET Framework only?
A: Mono on Windows should work as well.

Q: Does Rider support any obfuscation solutions?
A: We haven’t looked in this direction yet.

Q: What is the expected timeline for having multiple projects open simultaneously?
A: Definitely before v1. Hopefully before end of this year. This feature has a very high priority.

Q: Any plans on supporting the JavaScript tools (e.g. Angular) available in the IntelliJ platform?
A: Yes. We’ll be integrating a lot of WebStorm features into Rider soon, including Angular support.

Q: Will there be Community and Ultimate editions similar to IntelliJ IDEA, or a single edition like WebStorm and RubyMine?
A: We’re targeting one edition.

Posted in How-To's | Tagged , , | 8 Comments

JetBrains Rider Early Access Program is now public

Back in January, we announced Project Rider. In March, we started the private Early Access Program. Today, we’re very excited to announce that the Rider EAP is now open to everyone!

Rider splash screen

We’ve had some fantastic feedback during the private EAP, and Rider is now well on the way to release. While we’re not quite feature complete, and there are still a couple of rough edges, we know of many people, inside and outside of JetBrains, who are already using Rider for day-to-day development. We’d love you to try it for yourself and let us know what you think, good as well as bad – log an issue, leave us a comment or ping us on Twitter (@JetBrainsRider).

TL;DR:

Download the first public Rider EAP build.

And here’s the Rider home page, the issue tracker and please read the survival guide for various known issues and workarounds. There is also a webinar on November 23rd which will demonstrate Rider in action.

But let’s back up for a moment.

What’s Rider?

Rider is a full featured, cross platform .NET IDE based on ReSharper and IntelliJ. The front end and user interface is built on the proven IntelliJ platform, just like WebStorm or IntelliJ IDEA, and can run on Windows, Linux and Mac. But the engine that drives all of your favourite JetBrains IDE features is ReSharper, running as an out of process language server.

This is a great mixture. Both IntelliJ and ReSharper provide industry leading IDE functionality, and running ReSharper out of process frees us from sharing resources and memory with Visual Studio.

Rider

Features

So what’s in the Rider public EAP?

Rider is using ReSharper to provide language features, and our main goal has been to expose as much of this ReSharper functionality as we can for 1.0. And we’ve been building ReSharper for over 12 years, so that’s a lot.

Fortunately, the way Rider works means that a huge amount of functionality can be brought over very quickly. Rider already supports ReSharper’s rich navigation and find usages; automatic, smart and import completion; the vast majority of ReSharper’s over 2,200 inspections and over 1,000 context actions and quick fixes; as well as unit testing, solution wide analysis and more.

Code completion popup

But of course, Rider is an IDE, and needs to implement full IDE functionality, including features that ReSharper doesn’t provide, so we also build and debug as well as handle project management – solutions, references, NuGet, and so on.

In fact, there are almost too many features to easily list, so instead, let’s take a look at a couple of different scenarios we’re targeting – .NET Framework, .NET Core, and Xamarin and Unity.

.NET developer

Rider will load standard .NET Framework or Mono projects. It understands Visual Studio .sln files, and will load any MSBuild based project (e.g. .csproj).

And because we now own the solution load process, you’ll find that it’s fast. Even better, if you edit a project file externally, Rider will quickly and automatically reload, almost without you noticing.

References are of course supported by right-clicking on the project in the Solution Explorer. Or you can use our new NuGet window to search, install and update your NuGet packages. Traditionally, this functionality is provided by Visual Studio, so it’s nice to be able to provide a typically JetBrains implementation – we cache results and update in the background, and we think you’ll be very pleased with the speed of it.

NuGet tool window

And of course Rider supports build, run and debug. Projects are built with MSBuild or XBuild if you’re running cross platform with Mono, while run and debug make use of a powerful feature of IntelliJ – Run/Debug Configurations (ReSharper has a similar feature).

Run configurations allow specifying as many different ways of launching your project as you need, and Rider offers a number of .NET specific templates for launching projects, running arbitrary executables, .NET Core and so on.

Furthermore, Rider supports debugging run configurations. This includes .NET Framework, Mono and .NET Core. Rider uses IntelliJ’s existing debugger UI, offering a familiar call stack view, as well as locals and watch variables. Rider also supports break on exception and setting the next instruction.

Debug configuration dialog open with debugger running

No IDE is complete without support for unit testing, and Rider supports running and debugging xUnit.net and NUnit tests, with a familiar user interface – icons displayed in the editor, run or debug from the Alt+Enter menu, and a tree view of running tests. Double click a test to navigate to the code, and of course, the stack traces are clickable, too.

Unit test icon in the editor

And if you’re worried about switching to a new IDE, don’t be! Our getting started wizard will walk you through setting up Rider, including choosing keymaps that are familiar to Visual Studio and ReSharper users, and suggesting plugins to work better with your code.

Keymaps getting started page

.NET Core developer

Rider also supports .NET Core projects. It can open existing projects from the project.json file, or create new ones based on templates from the new project wizard.

New project dialog

And of course, this is all cross platform. If you want to target .NET Core on Mac, or Linux, you obviously want your tooling to be there, too. Rider will give you a full IDE on Windows, Mac and Linux.

When you open a .NET Core project, Rider will automatically restore all NuGet packages, and shows packages as a dependency tree, rather than a flat list. Once loaded, Rider provides the same rich IDE functionality as you get with a traditional .NET Framework project – code completion, navigation, refactorings, inspections and so on.

Adding a reference is as simple as editing the project.json file (with code completion, naturally) and saving; Rider will restore the packages automatically. You can swap between multiple target frameworks with a chooser in the status bar.

Target framework switcher

It also includes specific functionality for ASP.NET Core, such as Tag Helpers in .cshtml files, with code completion, find usages, and refactoring all supported.

CSHTML tag helper completion

And of course, Rider will build, run and debug your .NET Core projects, all cross platform. But please read the survival guide for known issues with adding references, debugging and unit testing.

And finally, Rider has inherited ReSharper’s ability to run and debug .NET Core unit tests. Well, mostly. This feature is not quite finished, and doesn’t work in all cases – for example, non-Windows projects that also target the .NET Framework. But it currently supports xUnit.net and NUnit, and will also support projects that target multiple frameworks. Again, please check out the survival guide.

Test runner

Unity and Xamarin developers

While we’ve mostly been focused on exposing existing ReSharper functionality, and adding new, essential IDE level features such as debugging, we also want to make Rider a great IDE for developing Unity3D and Xamarin solutions.

We haven’t really got started on Xamarin support right now, although Rider already includes ReSharper’s existing Xamarin.Forms XAML editing features, with more planned.

But we’re a bit further along with Unity support. Firstly, the Unity editor can be made to open projects, C# files and error messages in Rider by adding the Unity3dRider plugin to your Unity project (this will hopefully be built into Unity in the future). See the readme in the repo for instructions on getting this set up. We’ll blog more about this very soon.

Then, once a project is open in Rider, you’ll find that there is specific Unity functionality, too. We’re bundling the ReSharper Unity plugin (yes, Rider supports plugins!), which adds a number of useful features, such as automatically setting the supported C# language level (no more C# 6 suggestions in your C# 4 code!) and inserting and auto completion of Unity message methods. See the plugin’s readme on GitHub for more details.

Auto completing Unity message methods

Furthermore, Rider will also debug your Unity project. The Run → Attach to local process menu item will show a list of available processes to debug, including available Unity instances.

Attach to Unity process to debug

We’ll write more about Unity support in a future blog post.

IntelliJ features

As if all this wasn’t enough, Rider inherits a number of very cool features from IntelliJ, too. Features such as the REST test client, rich version control support, and the often life saving local history.

Rider also includes DataGrip’s rich database tooling. This means you can open a .sql file and get smart code completion, on-the-fly analysis and quick-fixes across a huge range of databases – MySQL, PostgreSQL, SQL Server, Oracle, and loads more. You can run queries, examine results and even refactor your database.

Rider showing database tooling

And that’s not mentioning access to IntelliJ’s rich plugin ecosystem. While the plugin SDK is still under development, Rider already supports both IntelliJ and ReSharper plugins, so Rider can take advantage of existing IntelliJ plugins such as VIM editing mode. Check out the currently available plugins for Rider on our plugin repository site.

Check out Hadi’s Rider Tips and Tricks video from NDC Sydney for more examples of how the IntelliJ platform will help you using Rider.

Why should you use Rider?

Hopefully, you can see that we’ve made Rider a fully fledged IDE, utilising the years of experience and functionality we’ve built into IntelliJ and ReSharper. For a pre-1.0 product, it’s already got an enormous amount of functionality.

We’re aiming to build the best IDE experience for .NET development. We want Rider to be feature rich, and we want it to be fast. And by owning the entire IDE stack, we can deliver on this, and innovate in areas that we haven’t looked at before, such as significantly improving the experience of searching in NuGet.

But the simplest answer is to download it, and try it for yourself – see how well it works for your own solutions and projects.

And remember, Rider is built from the ReSharper codebase – Rider IS ReSharper. New features and fixes in one product will flow into the other. Above all, we’re offering you a choice – if Rider works well for you, cross platform or on Windows, then great! But if you prefer Visual Studio, then rest assured, ReSharper will always be there to help you.

Oh, and one last thing. You might have noticed that we started this journey with the codename “Project Rider”, and were planning on an official name later. Well, it’s now later, and honestly, we like the name Rider. So that’s what it’s going to be – welcome to JetBrains Rider.

Download the first public Rider EAP build from the web site, or fire up Toolbox: Rider’s going to be there as well.

Posted in News and Events | Tagged , , , | 86 Comments

Live Webinar: Introducing Rider, the new .NET IDE from JetBrains, November 23

Join us Wednesday, November 23d, 15:00 – 16:00 GMT (11:00 AM – 12:00 PM EDT) for our free live webinar, Introducing Rider, the new .NET IDE from JetBrains, with Matt Ellis.

rider_webinar_introducing_rider_the_new_net_ide_from_jetbrains

Rider is a new cross platform .NET IDE, built on the IntelliJ platform and ReSharper. But don’t worry about life outside of Visual Studio. We’re here to help and guide you through this brave new world.

In this webinar, we’ll show you how to get up and running with Rider, and quickly get working with your .NET Framework and .NET Core projects. We’ll take a look at the features you’ll be used to from ReSharper, with code completion, inspections and quick fixes, testing and NuGet. We’ll also look at what the IntelliJ platform brings to the party, such as version control, debugging and database tools. We’ll even look at how we can work with Unity projects. And all of this on a Mac.

Space is limited, please register now.

About the presenter:

Matt EllisMatt Ellis is a Developer Advocate at JetBrains. He has spent 20 years shipping software and currently works with language tooling, having fun with abstract syntax trees and source code analysis. He owns and contributes to various open source projects, and believes in the open closed principle.

Posted in News and Events | Tagged , , | 1 Comment