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.

This entry was posted in How-To's and tagged , , . Bookmark the permalink.

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

  1. Pingback: ReSharper Ultimate 2016.2 – das ist neu - entwickler.de

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

  3. Neil Mosafi says:

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

    And what about Javascript template strings?

    Thanks

    • Dmitry Matveev says:

      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. Saeid says:

    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.

    • Jura Gorohovsky says:

      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. Chris says:

    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.

    • Anton Lobov says:

      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. Jan says:

    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 …

    • Jura Gorohovsky says:

      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.

      Thanks.

  7. Anton Rademaker says:

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

    • Anton Lobov says:

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

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

  9. Russell Mason says:

    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.

    • Jura Gorohovsky says:

      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. dadhi says:

    Does it support //language=xaml
    ?

  11. Chris Owens says:

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

    • Jura Gorohovsky says:

      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

Leave a Reply to Neil Mosafi Cancel reply

Your email address will not be published. Required fields are marked *