ReSharper C++
The Visual Studio Extension for C++ Development
ReSharper C++ 2020.1 Early Access Program Is Now Open
Today we are launching the Early Access Program for the next major release of ReSharper C++ – 2020.1. Try the EAP builds for free and get early access to the latest improvements and upcoming features!
You can download the new EAP build from our website, or via the Toolbox App.
DOWNLOAD RESHARPER C++ 2020.1 EAP
The first EAP build improves on the features introduced in the recent 2019.3 release. It also includes some new features and enhancements.
The main highlights of this build are:
- C++ support:
using enum
, attributes, and more support for C++20’s concepts - Code completion: attributes,
goto
,std::forward
, and calling base function - Code analysis: new inspections and quick fixes
- Unreal Engine 4: better Rename refactoring
- Sorting of #include directives: more options
- Other changes
C++ support
In this first EAP, we have introduced more features of the C++20 standard and we’ve extended support for C++17 attributes.
Using enum
C++20 improves using declarations to support bringing specific enumerators into the local scope. The new using enum
syntax allows you to add all the enumerators from the target enumeration. As a result, you can omit repetitions of the enumeration name when using its member enumerators, making your code more concise.
ReSharper C++ 2020.1 supports the new syntax and also adds a new refactoring that helps with adding using enum
statements. To invoke it, place the caret at an enumerator and press Ctrl+Shift+R, or choose ReSharper | Refactor | Refactor This from the main menu, and then select Introduce Using Enum from the Refactor This menu:
C++20’s Concepts
ReSharper C++ 2020.1 supports two new concept-related features:
- Abbreviated function templates – we have extended C++20’s Concepts support with this new syntax for function and lambda declarations. Now you can declare a template function with the
auto
orconcept auto
placeholder in the list of parameters:
- Constrained type placeholders – now you can constrain an
auto
type with aconcept
:
Attributes
We’ve extended support for the C++17 [[maybe_unused]]
and [[nodiscard]]
attributes. Here is a short overview of when you can use them and how ReSharper C++ can help.
[[maybe_unused]]
The [[maybe_unused]]
attribute can be added to avoid warnings from the compiler about an unused name or entity. This attribute is applicable to class declarations, function return types, variables, and more.
When the caret is on an unused entity, a new context action Add [[maybe_unused]] will be available:
And another context action will help you to replace usages of the UNREFERENCED_PARAMETER
macro with a [[maybe_unused]]
attribute:
[[nodiscard]]
The [[nodiscard]]
attribute can be added to raise a warning when the return value of a function is not used. ReSharper C++ 2020.1 now offers you the option to declare generated getters and constructors [[nodiscard]]
in the generation wizard.
You can also use a quick fix for the modernize-use-nodiscard
inspection to add the attribute to member functions.
Code completion
Code Completion is a very important feature for improving your productivity. Just start typing or press Ctrl+Space to see the suggestion lists for the following new code completions:
- attribute names:
- label names for the
goto
statement:
std::forward
in the postfix template suggestion list:
- parameters for a call to a base function from an overriding function:
Code analysis
New inspections detect more cases when you should prefer static_cast
, and the corresponding quick fix is here to help you update your code:
- Functional-style cast used instead of a C++ cast:
reinterpret_cast
used instead of astatic_cast
when casting tovoid*
:
And there’s one more new inspection – if a local variable is captured by a lambda but not used inside the lambda body, ReSharper C++ notifies you and suggests removing the unused capture:
Unreal Engine 4
Rename is one of the most useful refactorings, and now it has more UE4-specific support:
- When renaming a UE4 header, the corresponding
#include *.generated.h
directive will also be updated. - When renaming a UE4 type, the corresponding header and source files (with the A, F, E prefixes) will also be renamed.
Sorting of #include directives
We presented this feature in the 2019.3 release, but we have already received a lot of feedback, and we’re ready to make the sorting rules even more customizable. There are two new options:
- Case-sensitive sort – used to place all includes starting with uppercase letters before the lowercase ones.
- Group headers by directory – used to create groups of headers based on their location.
Other changes
A small but pleasant improvement for typing assistance: you can now select any piece of code and enter a single parenthesis/bracket/quote to surround the selection with the corresponding characters.
We’ve also added new filter categories in Go to for concepts and namespaces. Press Ctrl+T and type “/” to see all the available filters.
We have resolved the performance issue related to type hints in dependent code. They are now shown by default without any problems!
The full list of all issues fixed in this EAP build can be found in our issue tracker. If you want to know more about what is coming in future builds, check out our roadmap.
Download, try it out, and share your feedback with us!
DOWNLOAD RESHARPER C++ 2020.1 EAP
Your ReSharper C++ team
JetBrains
The Drive to Develop