ReSharper C++ 2020.2: Unreal Engine Project Model, Improved C++/CLI Support, and More
Exciting news – ReSharper C++ 2020.2 is out! The newly introduced support for the Unreal Engine project model gives ReSharper C++ more insight into the structure of Unreal Engine projects, while updates to C++/CLI support bring better interoperability between C++/CLI and C# code. Other improvements include enhancements in navigation and search, a new set of code inspections with quick-fixes, many bug fixes, and much more.
Here is a quick overview of the new features and improvements:
- Unreal Engine: support for the Unreal Engine project model, better conformance to the Unreal Engine coding standard, and new inspections.
- C++/CLI: improved interoperability between C++/CLI and C#, extended navigation and search features, and inspections for C++/CLI-specific keywords.
- Code analysis: preview for Clang-Tidy fixes, improved support for
constexprfunctions, and highlighting for misspelled preprocessor directives.
- Code completion: auto-generated lambda argument for
std::function, and import completion can now add forward class declarations.
- Navigation and search: Go to declaration for unresolved identifiers, hidden preprocessor directives in File Structure, and faster Find Usages.
- Code style and formatting: new settings for multiline ternary, single-line style comments, and sorting of include directives.
- File templates: new Source file and Header file templates.
In this release, we are proud to introduce initial support for the Unreal Engine project model. The new project model provides more relevant completion lists that depend on the plugin and module references. It also allows us to provide better auto-import suggestions: ReSharper C++ will no longer suggest including headers from unreferenced modules or the private catalogs of any module. Moreover, ReSharper C++ now adjusts its behavior when you switch the active solution configuration, which makes it easier to work with Editor-specific preprocessor blocks and other guarded code.
This is only the beginning, and a lot more is ahead. For example, in the future the new project model will allow us to add fixes for issues such as using entities from the unreferenced modules. So stay tuned!
For easier navigation, symbols from engine sources are now treated as library symbols by default and will be hidden from Search Everywhere results. If you prefer to always see engine symbols in search results, turn off the Treat Unreal Engine symbols as non-project in Search Everywhere/Go To option on the Code Editing | C++ | Unreal Engine settings page.
Similarly, when searching for usages of a symbol defined in game source files, ReSharper C++ will now ignore engine source files. This means that both Find Usages and refactorings (like Rename) that use Find Usages results should finish faster when you invoke them on entities from your own code.
ReSharper C++ 2020.2 includes several updates for better compliance with the Unreal Engine coding standard:
- The default documentation template now uses the
@prefix for documentation commands instead of
- We’ve updated the severities for several inspections: disabled the “Class can be final” (for
IInterface) and “Const-qualified parameter in a function declaration” inspections and increased the severity of “Inconsistent UE4 naming” to error for
- The code generating actions were improved for
USTRUCT: ReSharper C++ now places all the generated declarations after the
There are also new inspections that enforce the Unreal Engine guidelines and remind you to refresh the project files in Unreal Editor:
- Overriding function does not have a
- The project files are out of date, you might need to regenerate the project files.
Lastly, a small but helpful improvement: the bundled dictionary is supplemented with common game acronyms and abbreviations, so you’ll no longer have to manually add them to the dictionary to suppress the spelling warning.
You can also try all these features in an early preview of our new standalone Rider for Unreal Engine IDE. It is powered by ReSharper C++ and it’s absolutely free at this stage – simply register, start coding, and give us your feedback!
Since the ReSharper license now covers both ReSharper and ReSharper C++ products, support for C++/CLI – a bridge between the languages – is getting a lot of updates, including a heap of bug fixes and improved interoperability between C++/CLI and C#. To get all the benefits of this C++/CLI support, you still need to install both ReSharper and ReSharper C++, but both products are now included in your license.
ReSharper C++ 2020.2 also delivers new code inspections with quick-fixes:
- Memory allocation inspections for
gcnewused on a native type, and
newused on a managed type.
- Inspection for the C++
finalspecifier used on a managed class or interface.
- A quick-fix to convert a C-style cast to a
We’ve extended the navigation and search features in C++/CLI code to find derived symbols in C# code, while Go to Base Symbols and Go to Derived Symbols now work on imported CLR entities. And thanks to several fixes, Find Usages now works more reliably in these multi-language scenarios.
We’re going to continue improving our C++/CLI support, so please let us know if it’s missing anything that is important to you.
In addition to the already mentioned inspections specific to Unreal Engine and C++/CLI, we’ve introduced a new inspection (with an accompanying quick-fix) to help you modernize your code. ReSharper C++ now gives you a hint when a variable of the
std::pair type can be replaced by a C++17 structured binding declaration:
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:
ReSharper C++ now highlights spelling mistakes in preprocessor directives:
We’ve also improved support for
constexpr functions. The evaluation engine now supports modification of values inside
constexpr functions and can work with values of class types:
When an argument of the
std::function type is expected, ReSharper C++’s code completion now suggests a new item in the completion list which generates a lambda argument with the corresponding signature:
When Import Symbol completion is enabled, ReSharper C++’s completion list also suggests classes from headers which are not included in the current file. Previously, when an import item was selected from the completion list, ReSharper C++ inserted an import directive to include the required header file. Since the 2020.2 update, ReSharper C++ can also add a forward class declaration instead of adding an import directive. A context menu with both options is shown by default, but you can change the default behavior on the Code Editing | C++ | Code Completion options page.
Navigation and search
Find usages has received a performance boost thanks to several fixes. It also finds constructor usages from braced init lists in more cases, including
Go to declaration now works on unresolved identifiers – ReSharper C++ will find all symbols with the matching name and let you navigate to them to help you understand what went wrong:
In large files with many preprocessor directives, the file outline displayed in the File Structure window can become quite confusing. We’ve updated File Structure to hide preprocessor directives by default:
Finally, ReSharper C++ can now automatically highlight usages of the element under the caret as you move through your code. Since this feature is also provided by Visual Studio’s IntelliSense, ReSharper’s highlighting is turned off by default. However, if you choose to turn off IntelliSense to improve performance, you can enable automatic highlighting of usages on the Environment | Editor | Appearance options page.
Code style and formatting
We’ve added three new settings for more flexible configuration:
- Indent aligned ?: operator – a formatting option for multiline ternary expressions.
- Insert // on Enter in multi-line // comments – an editor option to prevent the auto-extension of multi-line comments in single-line style.
- Consider only quoted includes as potential main headers – an option for sorting include directives to improve main header detection.
#include ordering settings have been moved to a separate options page and are now easier to find (Code Editing | C++ | Order of #includes).
We’ve also fixed a performance issue in files with many macro calls, and now the formatting engine works significantly faster in these cases.
The existing Class and Struct file templates by default add two new source files, one with the .h extension and another one with .cpp. If you want to quickly create just a header or just a source file, you can now use one of the two new built-in 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:
Those are all the highlights of ReSharper C++ 2020.2! The full list of new features and bug fixes is available in our issue tracker, where you’re always welcome to submit a new feature request or upvote an existing one.
More changes are coming from ReSharper itself, so be sure to visit What’s new in ReSharper for all the details. For example, code cleanup can now be launched automatically on save, or it can be applied only to the changed parts of recently modified files. We’ve also simplified our licensing offers, and now ReSharper C++ license holders can enjoy access to ReSharper at no extra cost, and vice-versa! So if you work with both C++ and C#, you no longer need an additional license.
Give ReSharper C++ 2020.2 a try and please share your feedback with us!
Your ReSharper C++ team
The Drive to Develop
Subscribe to Blog updates
Thanks, we've got you!