ReSharper C++ 2020.3: UnrealHeaderTool, C++20 Comparisons, Push-to-Hint Inlay Hints

Elvira Mustafina

Please welcome ReSharper C++ 2020.3, our final release of this year!

We’ve got many cool things you won’t want to miss, like the UnrealHeaderTool integration, new C++20 features, navigation between matching preprocessor directives, fuzzy text search, Push-to-Hint mode for inlay hints, and many other enhancements in the latest update.

ReSharper C++ 2020.3

Begin your free 30-day trial today, or update to this version immediately with an active subscription of ReSharper, ReSharper C++, dotUltimate, or the All Products Pack. The brand new build is available for download from our website or the Toolbox App.

DOWNLOAD RESHARPER C++ 2020.3

Here is a quick overview of the new features and improvements in v2020.3:

  • Unreal Engine: UnrealHeaderTool integration, an improved project model, and new inspections based on control flow analysis in HLSL shader files.
  • C++20 support: C++20 comparison rules, quick-fixes for the ranges library, and standard conformance updates.
  • Coding assistance and completion: improvements in import completion and a context action to invert a ternary expression.
  • Navigation and search: navigation for matching preprocessor directives, fuzzy text search, Peek Implementation, and Peek Base Symbols.
  • Code analysis: new modernizing inspections and Clang-Tidy 11.
  • Push-to-Hint: a new visibility mode for inlay hints.
  • Other changes: updates to Catch2 support and /external:* compiler switches.

Unreal Engine

ReSharper C++ 2020.3 provides seamless integration with UnrealHeaderTool. It runs the tool in the background as a separate process to check the file you are editing, and it shows the same errors and warnings that you would normally see at compile time. The code analysis results are displayed in the editor, just like any other ReSharper C++ inspection:

UnrealHeaderTool: Missing reflection specifier

This should save you some time, right?

UnrealHeaderTool can detect lots of different issues in your code, such as when you are using a specific meta tag without the required reflection specifier, when you’re using the GENERATED_BODY macro in a private scope, when an invalid entity is exposed to a blueprint, and so on. To learn more about the integration details and configuration, please check out this blog post. Or you can watch this short demo of the UnrealHeaderTool integration in action:

To ensure you’re up to date, ReSharper C++ now tracks Unreal Engine properties in real time and regenerates the project model as soon as you save any changes in .Build.cs, .Target.cs, .uproject, or .uplugin files.

Live tracking for Unreal Engine properties

The full power of ReSharper’s control flow analysis now comes to HLSL shader files, including warnings about unreachable code, uninitialized variables, redundant control flow jumps and conditional branches, and much more. To get it to work for HLSL, we’ve also added support for HLSL-specific input modifiers that identify a function argument as an input, an output, or both.

HLSL-specific input modifiers

We’ve also improved the conformance to the Unreal Engine coding standard. For example, our default settings for Unreal Engine projects now set the tab size to 4 characters (we still auto-detect your formatting and will not force you to use tabs if you prefer spaces). ReSharper C++ also now suggests using MoveTemp (Unreal Engine’s equivalent of std::move) for casting to an rvalue reference.

Unreal Engine's MoveTemp

Never miss when you need to regenerate the project files. ReSharper C++ will warn you when the Unreal Engine version file cannot be found, or when the engine version you use does not match the version referenced in your game project.

Regenerate project files

You can also try out all these features in the early preview of our new standalone Rider for Unreal Engine IDE. It is powered by ReSharper C++ and is currently available absolutely free – simply register and start coding!

C++20 support

With the 2020.3 update, ReSharper C++ brings full support for C++20’s comparison rules. This includes a significant change to how comparisons work, where the language is allowed to rewrite a comparison expression or reverse the order of arguments.

You can now consult the tooltip to learn how an expression has been rewritten or why a defaulted comparison operator in your class has been implicitly deleted, and view the list of considered overloading candidates when a comparison operator cannot be resolved.

 C++20: the list of considered overloading candidates

There are also new quick-fixes to add the required #include <compare> directive and create a member or a friend version of a comparison operator. Check out this blog post for an overview of the C++20 changes to comparisons and how ReSharper C++ can help you work with them.

In addition to support for C++20’s comparisons, we’ve created two new inspections with quick-fixes to help you adopt the new ranges library:

  • An algorithm operating on ranges can be used.
    An algorithm operating on ranges can be used
  • std::views::keys/values can be used.
    std::views::keys/values can be used

C++20 support has also been improved according to the standard conformance updates in Visual Studio 16.8. In particular, ReSharper C++ now supports both the standard and the extension modes for C++ coroutines, along with the new <coroutine> header.

Coding assistance and completion

Thanks to the Import Symbol completion, ReSharper C++’s completion list also suggests classes from headers that are not included in the current file. To make it even more useful, we’ve added the following enhancements:

  • The completion list now includes suitable members of incomplete classes.Import completion for incomplete classes
  • There is a new option to add an elaborated type specifier for the corresponding class.
    Add an elaborated type specifier

A new context action helps you invert ternary operator expressions:

Invert a ternary operator expression

The "Join declaration and assignment" quick-fix is now available for cases when a local variable is reassigned in all paths before being read:

Join declaration and assignment

We’ve improved argument code completion for library functions that accept macro constants. Library macro constants that are applicable to the current argument are now prioritized in the completion list. This heuristic works for functions from the standard library, WinAPI, and OpenGL.

Improved argument code completion for library functions

The most commonly used action when navigating through source code is Go to Declaration. To make the code navigation experience even smoother, Go to Declaration can now be used to quickly jump between matching preprocessor directives:

  • Navigate between #define and #undef of the same macro inside a single file.
    Navigate between #define and #undef
  • Navigate between the directives that form a single conditional preprocessing block.
    Navigation in a conditional preprocessing block

You can now also use Go to Declaration on an override keyword to navigate to the base function, instead of invoking the separate Base Symbols action on the function’s name:

Go to Declaration on an override keyword

In addition to its regular search, Find Text now performs a fuzzy search, which means it takes possible typos and missing words into account. This feature can be very helpful if you are looking for a certain format string used as an argument to a text formatting function like printf or std::format.

Fuzzy text search

Peek Implementations and Peek Base Symbols come to C++, allowing you to view and edit code in a popup window without switching away from the code you’re writing:

  • Press Ctrl+Alt+Q or use the ReSharper | Navigate | Peek menu to peek at implementations.
    Peek Implementations
  • Press Shift+Alt+Q or use the ReSharper | Navigate | Peek menu to peek at base symbols.
    Peek Base Symbols

For better readability, File Structure now uses the C++17 syntax for nested namespaces even if you have not yet adopted the new syntax in your codebase:

Nested namespaces in File Structure

ReSharper C++ continues to improve its C++/CLI support. For example, Go to Derived Symbols now works for get/set functions inside C++/CLI properties and add/remove functions inside C++/CLI events:

Go to Derived Symbols for get/set

Code analysis

In addition to the already mentioned C++20 inspections and control flow analysis for HLSL shader files, we’ve introduced a new inspection to suggest replacing usages of standard algorithms that accept a pair of iterators with equivalent algorithms that accept an iterator and a count where possible:

Use algorithm accepting count

The bundled Clang-Tidy binary has been updated to Clang 11, adding new checks and compiler diagnostics from the latest LLVM release.

Clang-Tidy 11

Push-to-Hint

ReSharper C++ provides many kinds of inlay hints. While all of the hints are useful in certain scenarios, sometimes they can be overwhelming. To help address this, we’ve come up with a new "Push-to-Hint" mechanism for inlay hints. In the Push-to-Hint visibility mode, hints are only shown when you either press and hold Ctrl, or press Ctrl twice:

Push-to-Hint

We’ve made sure that the visibility mode can be configured separately for every kind of C++ inlay hint. You can quickly change the visibility mode for a given hint using the context menu, or head to the new option pages under Environment | Inlay Hints | C++ to check out all the settings.

Change the visibility mode

Other changes

ReSharper C++ now supports the TEMPLATE_TEST_CASE and TEMPLATE_PRODUCT_TEST_CASE macros that were updated in Catch 2.8, as well as the recently introduced TEMPLATE_TEST_CASE_SIG and TEMPLATE_PRODUCT_TEST_CASE_SIG:

Parameterized tests in Catch2 2.8+

ReSharper C++ will now be able to pick up and use the include paths to third-party libraries specified via /external:* compiler switches.

And last but not least, we’ve boosted the performance of Find Usages and Rename when these actions are used on private class members. If the containing class does not have any friend classes, ReSharper C++ will now look for class member usages only in files that contain the class definition and the definitions of its member functions. For huge code bases, this optimization makes Find Usages 50, and sometimes even up to 100, times faster (for example, for the Data and Length fields of the LLVM StringRef class).

The full list of new features and bug fixes in this release includes more than 190 issues and is available in our issue tracker. Feel free to submit a new feature request or upvote any existing ones. Your feedback is always welcome!

Also, more changes are coming from the ReSharper platform, so take a look at What’s New in ReSharper, as well.

Get ReSharper C++ 2020.3 and let us know what you think!

DOWNLOAD RESHARPER C++ 2020.3

Your ReSharper C++ team
JetBrains
The Drive to Develop

Subscribe

Subscribe for updates