ReSharper Ultimate 2016.2 EAP: Builds 7 and 8
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:
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
RegexPatternAttributefrom 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.
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: