ReSharper C++ 2020.1 EAP: Convert to Scoped Enum Refactoring and Quick Documentation Comments
This EAP build takes us within one step of the first major release of the year! It primarily includes bug fixes but also introduces a new refactoring and the Document editor action. Let’s take a closer look at these new features:
As usual, you can download the new EAP build from our website or through the Toolbox App.
Convert to Scoped Enum
enum refactoring helps you convert a C-style enumeration declaration into a C++11 scoped enumeration. To invoke it, place the caret on an enumeration and select Convert to Scoped Enum from the Refactor This menu, or choose ReSharper | Refactor | Convert | Unscoped Enum to Scoped Enum from the main menu:
The refactoring will update all the enumeration declarations and qualify the enumerator references. Moreover, if a value of the enumeration type is implicitly cast to an integral type, ReSharper C++ will warn you about this and automatically insert a
static_cast to the corresponding type:
Please note that in rare cases, some of the implicit casts could be missed by the refactoring. In these cases, you’ll get a compilation error after the refactoring is complete. As with the rest of the C++ refactorings, Convert to Scoped Enum will warn you about potential enumeration usages in dependent code, but it will not automatically update them.
“Document” editor action
Up until now, you’ve been able to use the Document context action to generate a documentation comment for a code element, but the action needed to be invoked from the Alt+Enter context menu with the caret placed on the element’s name.
In this EAP build, we’ve introduced a more convenient way to add a comment stub – the new ReSharper | Edit | Document editor action. This action can be invoked with a shortcut (Ctrl+/ by default in the Visual Studio keymap), and it’s available anywhere above and inside a top-level code element. As with the context action, you can customize the comment stub in the Template Explorer tool window by changing the doc live template.
Check out our issue tracker for the full list of issues we’ve fixed in this EAP build.
Your ReSharper C++ team
The Drive to Develop