ReSharper C++ Starts 2020.2 Early Access Program

Posted on by Elvira Mustafina

Today we are launching the Early Access Program (EAP) for ReSharper C++ 2020.2, which brings many improvements for Unreal Engine and C++/CLI support, performance fixes, and more. This release cycle is aimed at fixing bugs, but it’s hard to resist adding some new treats. So, in the first EAP build, you’ll find a combination of polished functionality and new features!
ReSharper C++ 2020.2 EAP

The main highlights of this build are:

  • Unreal Engine: Unreal Engine project model support, new inspections, improved Find Usages and code generation, UE code style.
  • C++/CLI: inspections for gcnew and final, searching for inheritors and usages in C# code.
  • Code style and formatting: settings for multiline ternary and sorting of include directives.
  • File templates: new Source file and Header file templates.
  • Other improvements: preview for Clang-Tidy fixes, improved support for constexpr functions.
  • More than 70 fixed issues.
Note that ReSharper C++ EAP builds are not fully tested and might be unstable.

As usual, the EAP builds are free to use, and no license is required. So go ahead and get early access to the latest improvements and upcoming features!

DOWNLOAD RESHARPER C++ 2020.2 EAP

Unreal Engine

We have introduced experimental support for the Unreal Engine project model. Reading .uproject and other UE-specific project files allows us to extend the basic Visual Studio model of the Unreal Engine project. Though this is still in an early experimental stage, it already allows ReSharper C++ to better understand plugin and module references, and to suggest only available and applicable items in the #include and code completion lists.

Moreover, the Unreal Engine project model information is essential when you have different settings for various build configurations, targets, and platforms. By default, Visual Studio generates project model properties for one configuration only. With the Unreal Engine project model, you can switch between configurations and be sure ReSharper C++ will work properly for all of them.
You can enable this experimental support by selecting Use Unreal Engine project model on the Code Editing | C++ | Unreal Engine page of the ReSharper options.

We’ve updated Search Everywhere/Go To to consider symbols from engine sources as library symbols. This means matching symbols from the engine project will only be shown when no symbols are found in the game projects, or when the Include library types checkbox is enabled. If you want to always see engine symbols when using Search Everywhere/Go To, disable the Treat Unreal Engine symbols as non-project in Search Everywhere/Go To option.
Treat Unreal Engine symbols as non-project in Search Everywhere/Go To

We’ve also improved the performance of Find Usages when searching for usages of a symbol from a game project. In this case, ReSharper C++ will now look for usages only in game source files, ignoring engine source files altogether.

When using the Visual Studio project model, ReSharper C++ reads various compilation properties (such as include paths, preprocessor definitions, etc.) from the .vcxproj file generated by Unreal. In some scenarios, for example, when you add a new C++ class in Unreal Editor, these properties will be missing. This can lead to incorrect parsing and bogus error messages. When the project information is missing, ReSharper C++ will now remind you to refresh the Visual Studio project from Unreal Editor.
Refresh the Visual Studio project from Unreal Editor

The Unreal Engine coding standard recommends using both the virtual and the override keywords on overriding functions. To match the UE coding standard, ReSharper C++ will no longer warn you about the “redundant” virtual specifier on overriding functions in Unreal Engine projects. And to enforce this guideline, we’ve added a new inspection to warn you about overriding functions without a virtual specifier. As usual, the inspection is accompanied by a quick-fix to add the missing specifier easily:
overriding functions without a virtual specifier

We’ve also updated the default documentation template (Ctrl+/) to align with the Unreal Engine comment guidelines: documentation commands are now prefixed by @ instead of \.
Unreal Engine documentation template

Lastly, we’ve improved the code generating actions to work correctly for UCLASS and USTRUCT. Now ReSharper C++ places all newly generated lines after the GENERATED_BODY() declaration.

C++/CLI

It’s been a while since we last introduced improvements for C++/CLI support. The time has now come to dive deeper and bring you new code inspections, a bunch of bug fixes, and better interoperation with the C# code.

ReSharper C++ now inspects the way you allocate memory and suggests a quick-fix to replace gcnew with new when the target type is not valid:
Quick-fix to replace gcnew with new

It also works for replacing new with gcnew:
Quick-fix to replace new with gcnew

Another inspection warns you when you try to use the C++ final specifier on a managed class or interface, with a quick-fix to make it sealed instead:
Quick-fix to replace final with sealed

Moreover, in this build we’ve improved the interoperation of C++/CLI with C#. Starting in 2020.2, when looking for derived symbols from C++/CLI code, ReSharper C++ will find symbols in C# code in addition to symbols in C++/CLI. And thanks to several fixes, Find Usages now works more reliably in these multi-language scenarios.

Code style and formatting

We’ve added three new settings for better configurability:

  • Indent aligned ?: operator – formatting option for multiline ternary expression.
  • Insert // on Enter in multi-line // comments – editor option to prevent auto-extending of multi-line comments in single-line style.
  • Consider only quoted includes as potential main headers – option for sorting of include directives to improve main header detection.

The #include ordering settings have been moved to a separate options page and are now easier to find – just click Order of #includes under the Code Editing | C++ option group.

File templates

It is now easier to create files with a typical structure, predefined code, or just a header comment block. There are two new file templates – Source file and Header file. To create a new file from a file template, use the Ctrl+Alt+Insert shortcut or select ReSharper | Edit | Create New File from the main menu:
Templates: Source file and Header file

You can use the Templates Explorer (ReSharper | Tools | Templates Explorer) to edit templates according to your needs and development practices, or even to create new ones:
Templates Explorer

Other improvements

With a brief preview of a Clang-Tidy quick-fix, it’s now much easier to select the required option and understand how exactly it will update your code:
Preview of a Clang-Tidy quick-fix

There is a new completion item with an auto-generated lambda argument for an std::function parameter:
Auto-generated lambda argument for an std::function parameter

We’ve also improved the support for constexpr functions. The evaluation engine now supports the modification of values inside constexpr functions and can work with the values of class types.
constexpr functions

The full list of fixed issues can be found in our issue tracker. If you want to know more about what is coming in future builds, check out the 2020.2 roadmap.

Download it, try it out, and share your feedback with us!

DOWNLOAD RESHARPER C++ 2020.2 EAP

Your ReSharper C++ team
JetBrains
The Drive to Develop

Subscribe

Subscribe for updates