ReSharper C++
The Visual Studio Extension for C++ Development
ReSharper C++ 2019.1: More Responsive, Better for Unreal Engine, and with New Language Features
This year’s first major update – ReSharper C++ 2019.1 – is finally here! Explore the dozens of significant performance improvements inside, as well as dedicated support for Unreal Engine 4, more flexible integration with Clang-Tidy, naming conventions, and the new Doctest unit testing framework.
Check out the details below on how ReSharper C++ improved on the following:
- Performance improvements, including better start times and quicker navigation actions
- Visual Studio 2019 support
- Unreal Engine 4 support
- More steps towards C++17 and C++20 compliance
- K&R style C declarations
- Updated naming and formatter settings
- More flexible Clang-Tidy integration
- Documentation improvements
- Unit testing update: Doctest and improvements to Google Test and Catch
Get the brand new build from our site and evaluate its features and enhancements completely free for 30 days:
Performance improvements across all areas
Algorithmic improvements in code indexing, faster cache serialization, and significant memory usage optimizations have led to a much better performance on warm opening of large solutions and cold startup times. This affects all types of projects; we’ve performed specific measurements on LLVM projects and others, as well as game projects using Unreal Engine. Here is a sample result for AMD Threadripper 1950x, ReSharper C++ cold start time for Unreal Engine:
For more results and details, see this blog post.
Talking about Unreal Engine, we’ve additionally introduced a few new settings under ReSharper | Options | Code Editing | C++ | Unreal Engine which affect code indexing:
ReSharper C++ has been indexing Unreal Engine code in the background since v2018.3. Now, you can also turn off the indexing of the source files under “Plugins” and “ThirdParty” folders.
Getting back to more general ReSharper C++ performance, we need to mention improvements to code completion and navigation. For navigation actions, we’ve made searches such as Go to file member, Go to base class, and Go to derived class available during indexing. This means you can invoke them right after you open the project, without having to wait for project indexing to finish. Also, actions like Search everywhere, Go to Everything, and Go to type have become much faster.
Visual Studio 2019 support
ReSharper Ultimate 2019.1 (including ReSharper C++) delivers full support for the recent final release build of Visual Studio 2019. Check out the list of VS integrations in the ReSharper Installer.
Unreal Engine 4 support
You may have noticed our team’s increased attention to Unreal Engine 4 in the past year. It is of course one of the key engines in the world of AAA game titles; if a game studio doesn’t have its own game engine, chances are it’s using UE4. Our community includes a lot of game developers that have expressed a huge interest in UE4 support.
The JetBrains team has learned a lot about game development while developing Rider for Unity. This has helped us implement features specific to Unreal Engine 4 in ReSharper C++, to help you create your UE4-based games more productively. Here are the most notable ones:
- Support for the Unreal Engine naming convention across all editor actions including refactorings, code generation, and others. This comes with the Inconsistent UE4 naming inspection, which catches the naming rules violations and suggests a quick-fix. See more samples in this blog post.
- Reflection specifiers are not just text strings passed to reflection macros for ReSharper C++ 2019.1. Now we offer code completion for them. Looking ahead, for the future releases we are working on built-in documentation for these specifiers.
- Unreal Engine’s Remote Procedure Calls can confuse code navigation and generation, but not in ReSharper C++ 2019.1! It knows that for Server RPCs an
_Implementation
function should be generated, as well as a_Validate
function ifWithValidation
is set. So it suggests one or both missing option for you to generate. And in theAlt+Enter
menu, “Related UE4 functions” are suggested for quicker navigation.
- Finally, auto-import has been tuned for UE4 projects. It now follows the general rule – any
#include
should be inserted before the.generated.h
include. The incorrectly placed#include
is highlighted by the corresponding inspection. In addition, auto-import no longer suggests symbols from Private and Classes folders of your UE4 project.
Do you develop games with Unreal Engine 4? Let us know which feature you’d like to see added the most and there’s a good chance it will make it into the next release!
More steps towards C++17 and C++20 compliance
First of all, alternative (text form) representation of operators is now supported in ReSharper C++. Second, we continue working to support more C++ language features from C++17 and C++20. This time we’ve added hexadecimal floating-point literals from C++17:
From C++20, basic support for Contracts (P0542R5) and the three-way comparison operator (P0515R3) was added. This mostly includes accurate parsing and some partial resolve to get rid of obvious false positives in the code:
Finally, from C++20, the familiar template syntax for generic lambdas (P0428R2) was added:
What is your favorite feature of the upcoming C++20? Let us know in the comments section below!
K&R style C declarations
If you code in C and use K&R style C declarations, which is probably the case for legacy libraries you might be using, you’ll be happy to learn that the style is now supported by ReSharper C++:
Updated naming and formatter settings
ReSharper C++ 2019.1 introduces updated settings for formatter and naming conventions. The formatter settings have evolved in two ways:
- New settings were added for the ReSharper C++’s native formatter: you can wrap before the commas of a base class list and configure separate values for spaces around references and pointers.
- Many options from ClangFormat are now supported in ReSharper C++, including CompactNamespaces, AllowShortBlocksOnASingleLine and AllowShortFunctionsOnASingleLine, AccessModifierOffset, and BreakBeforeBraces: Custom.
What is more, when you use ClangFormat so that ReSharper C++ takes the formatting options from your .clang-format config, ReSharper C++ now identifies which formatting options are affected by given ClangFormat options:
Regarding naming convention settings, more flexibility was introduced by adding additional kinds of entities to the settings. Importantly, the settings page (ReSharper Options | Code Editing | C++ | Naming Style) has been reworked to include two separate lists, specifiers and entity kinds (organized in a tree). Combine them and add rules specific to one or several kinds of entities. Just click a rule, or select a rule and click Edit:
More flexible Clang-Tidy integration
We’ve enhanced Clang-Tidy integration. The built-in binary was upgraded to Clang 8 – this brings new code checks to your editor.
If you have your custom Clang-Tidy binary (typical if you implement a few custom checks on top of Clang-Tidy and want to run them on your code base), you can provide a path to this binary in ReSharper | Options | Code Editing | C++ | Clang-Tidy. ReSharper C++ will then use this custom binary to analyze the code. Please note though that ReSharper C++ supports Clang-Tidy 7 and later.
There are also some other useful new options in ReSharper | Options | Code Editing | C++ | Clang-Tidy, such as the list of enabled/disabled checks in a simple text form (just as you pass it to Clang-Tidy in the command line) or Clang-Tidy config file.
Documentation improvements
ReSharper C++ tried its best to help you provide documentation for your code. For a while already, it’s been possible to generate a documentation comment by pressing Alt+Enter
and selecting Document (using ‘doc’ live template).
Now, to help you with XML documentation comments, a typing assist will automatically insert ‘///’ on a new line when you press Enter
. Importantly, tags are updated when you Rename function parameters. And if ReSharper C++ detects the different set of names in the XML documentation comment and in the function’s signature, it will highlight the mismatch for you and will suggest adding a new tag or renaming the existing one:
Unit testing update: Doctest and improvements to Google Test and Catch
Our recent Developer Ecosystem Survey showed us that quite a lot of C and C++ developers are still not using any unit testing framework. And yet, we strongly believe that unit testing is an essential and useful part of development workflow, and we keep adding support for more unit testing frameworks in our tools. Before this release, we already had Google test, Boost.Test and Catch on board, and we’ve just added Doctest.
If you haven’t heard about Doctest yet, you may want to take a minute to check out it. This relatively new framework was started by Viktor Kirilov, and you can watch an overview in Viktor’s CppCon 2017 talk. Lightweight and flexible, Doctest allows tests to be written directly in the production code, and at the same time offers a way to remove everything test-related from the binary. So you can do tests and think of them as documentation to your code.
With ReSharper C++ 2019.1, you can now write tests using Doctest in your Visual Studio.
Other improvements in unit testing include support for:
- TEMPLATE_PRODUCT_TEST_CASE test declarations from Catch 2.7, and
- The GTEST_SKIP() macro from Google Test.
Whew, that’s about it for ReSharper C++ 2019.1! Give it a try and share your feedback with us in the comments below, in our tracker, or on the support forum. We’re waiting to hear from you!