ReSharper Ultimate 2016.2 EAP: Builds 7 and 8

ReSharper Ultimate 2016.2 EAP goes on, and we’ve recently published two more builds. Here is what has been fixed, and below are some new features in these builds.

Improvements in surround templates

We have been working towards merging live and surround templates as well as improving the availability of templates.

As of now, each non-file template can be used for generating code, for surrounding code, or for both, which lets you reuse your custom surround templates as live templates and vice versa, reducing their total count.

Another new thing here is that surround templates become available in the completion list, so you can start typing the name of a surround template as soon as a selection is made without pressing any additional shortcuts:

Surround templates in completion lists

The traditional way of invoking surround templates with Ctrl+E,U (ReSharper | Edit | Surround With Template) is also improved. The problem of too many templates in the Surround With pop-up, previously addressed with the editable ‘quick access list’, is now solved another way: while the pop-up shows all available templates, you can start typing a template name to shrink the list.

Marking language injections with comments

When a string literal contains a formal language, ReSharper can provide its code analysis and assistance features right inside this literal. Since v. 9.0, this has been available for regular expressions, and v. 2016.2 brings support for injected HTML.

Let’s recap how it works. As it’s impossible to automatically detect whether the formal language is intended in the literal, you have to mark the injection explicitly in one of the following ways:

  • Use the context action, which actually tells ReSharper to mark the symbol range corresponding to the string as Regexp/HTML, save this range in its internal database and keep track of it as the containing file changes. This way is very quick and straightforward, but there are two downsides: the range can be lost after an external file change, such as a VCS merge, and the injection marked this way will only be tracked locally.
  • Mark method parameters accepting regular expressions with RegexPatternAttribute from JetBrains.Annotations. This is the recommended way for regular expressions in parameters.
  • ReSharper 2016.2 introduces a third way: you can put a comment /*language=html|regexp|jsregexp*/ before the string literal. Granted, these comments require some typing and you can even think of them as contaminating your code. However, they make your intention clear to everyone who reads your code, they won’t get lost, and anyone opening your code with ReSharper will get the same features in the marked strings. By the way, the format of comments is compatible with IntelliJ Platform-based IDEs.
    Language injection with comments

More C# typing assistance

In addition to the smart behavior of dot and semicolon inside braces, which
we mentioned previously, ReSharper now automatically corrects mistyped @$ prefixes for verbatim string interpolations:

Generating abstract members in TypeScript

In TypeScript, you can now generate implementations for abstract members using either the Generate menu (Alt+Insert) or a quick-fix:

Generating abstract members in TypeScript

Please download the latest 2016.2 EAP build and give the new functionality a try. As usual, we would love to get your feedback via ReSharper issue tracker.

Comments below can no longer be edited.

19 Responses to ReSharper Ultimate 2016.2 EAP: Builds 7 and 8

  1. ReSharper Ultimate 2016.2 – das ist neu - says:

    July 20, 2016

    […] nicht möglich ist, muss eine Injection vorab genau gekennzeichnet werden. Wie das geht, wird im JetBrains-Blog ausführlich […]

  2. Dew Drop - July 20, 2016 (#2291) - Morning Dew says:

    July 20, 2016

    […] ReSharper Ultimate 2016.2 EAP: Builds 7 and 8 (Dmitry Matveev) […]

  3. Avatar

    Neil Mosafi says:

    July 20, 2016

    Will the language=html comment work for Javascript strings containing HTML, or just C# strings containing HTML?

    And what about Javascript template strings?


    • Avatar

      Dmitry Matveev says:

      July 20, 2016

      Hi Neil,
      The /*language=html*/ comment does work for JavaScript/TypeScript strings.
      As for template strings, currently we don’t allow HTML injection in template strings (as well as in C# interpolated strings) because it requires more complex analysis, e.g. when placeholders are used in tags. However, we plan to solve this problem in the nearest future.

  4. Avatar

    Saeid says:

    July 20, 2016

    Please take care of the ASP.NET Core 1.0 RTM. I have a lot of red lines and unknown references with V2016.1_2.

    • Avatar

      Jura Gorohovsky says:

      July 22, 2016

      We’re working on better Core RTM support in the span of 2016.2, which includes resolving references correctly. Hold on and watch the updates to this Early Access Program.

  5. Avatar

    Chris says:

    July 21, 2016

    Rather than marking the language of a string with comments, are you able to detect it based on content?

    While there is some overlap – it may be possible to detect (most of the time) the difference between string, html and regex.

    • Avatar

      Anton Lobov says:

      July 22, 2016

      It is possible to detect html-like or regex-like patterns in strings, but such detection will never be accurate. Especially for regex, where you can’t easily detect which particular dialect is used.

      We inject languages automatically only when we can guarantee the correctness of such behavior. For example, in JavaScript there exists a special kind of literals for regular expressions, or there exists a third-party syntax extension JSX for embedding xml-like constructs – in those cases we inject languages automatically, because we can guarantee the result.

      But for arbitrary strings it is dangerous to inject automatically based just on some heuristic – you’ll easily get lots of false errors if you use some syntax very similar to one of supported languages.

      We provide now three mechanisms that should help you in any case:
      1) annotations in C# – just mark a function parameter with RegexPatternAttribute attribute
      2) “Mark as …” action – invoke it and R# will start recognizing the string as a language (helpful when you don’t want extra comments in your code, but this kind of language injection will be lost in case of huge refactorings when the corresponding line changes and moves too much)
      3) comments of kind “//language=” – as a stable way to mark string as a language, consistent between huge changes in code

  6. Avatar

    Jan says:

    July 21, 2016

    This is all fine and dandy, but for a couple of days I’ve unfortunately joined the “Resharper is completely unusable due to performance issues” club.

    Sorry, you need to fix this. I didn’t believe all the reddit folks, but after upgrading to VS 2015 Resharper suddendly every keystroke has slowed down.

    And it’s not a hardware problem. 32 GB RAM, Core 7, 256 SSD …

    • Avatar

      Jura Gorohovsky says:

      July 21, 2016

      Jan, that’s sad to know. This is one club that we would love to be disbanded once and for all.

      Problem is, we have no idea exactly what we need to fix.

      Did you just upgrade to VS2015? Was it Update 3 that you upgraded to? What ReSharper version do you have installed on top of that? Are you experiencing performance problems when you disable ReSharper, or are they going away? Do you have Git or TFS integration enabled in your solution? XAML Designer? CodeLens?

      While we would love to magically fix all performance problems for everyone, this is unfortunately not feasible because a wide array of factors may contribute to slowness, some of which are caused by ReSharper and some are not.

      I suggest that you go through the performance checklist that we have for such cases. If nothing helps, please file a performance snapshot via ReSharper > Help > Profile Visual Studio, and we’ll be sure to look into what’s going on there.


  7. Avatar

    Anton Rademaker says:

    July 22, 2016

    Please add support for //language=sql or //language=tsql or is it possible to write our own?

    • Avatar

      Anton Lobov says:

      July 22, 2016

      Currently ReSharper has no support for SQL, and this infrastructure works only for languages that are natively supported by ReSharper, sorry.

  8. Szumma #049 – 2016 29. hét | d/fuel says:

    July 23, 2016

    […] ReSharper Ultimate 2016.2 EAP: Builds 7 and 8 […]

  9. Avatar

    Russell Mason says:

    July 23, 2016

    Is there a list of .net Core RTM features supported by Resharper? When something doesn’t work as expected I’m not sure if it’s a Visual Studio problem, or a Resharper problem, or both!

    I can’t get unit testing working through Resharper and xUnit. It appears to be looking for test dlls in a location which doesn’t match where VS builds the dlls. Is unit testing supported? The built in VS xUnit test runner works but it’s nothing like as good as the Resharper testing features.

    • Avatar

      Jura Gorohovsky says:

      July 23, 2016

      Russell, ReSharper doesn’t support .NET Core unit testing so far.

      We were looking to provide unit testing support in the scope of 2016.2 but we’re behind schedule, and looks like it will be postponed for the next feature update after 2016.2.

      As to a wider scope of .NET Core support, if you see red code but your application successfully compiles, it most probably indicates a ReSharper problem that we haven’t fixed yet.

  10. Avatar

    dadhi says:

    July 24, 2016

    Does it support //language=xaml

  11. Avatar

    Chris Owens says:

    July 27, 2016

    Please start doing something about the performance. It’s horrible. Visual Studio 2015 without Resharper is crazy fast compared to with Resharper.

    • Avatar

      Jura Gorohovsky says:

      August 2, 2016

      Chris, we recommend that you go through the VS+ReSharper performance checklist first; if it doesn’t help, please use ReSharper > Help > Profile Visual Studio to send a performance snapshot our way to investigate. Thanks

Discover more