📜 ⬆️ ⬇️

Meet ReSharper C ++

Over the past ten years of its existence, ReSharper has been focused on .NET developers, which is not surprising for a plug-in to Visual Studio. 2 years ago, due to the successful April Fool's joke, we came to grips with supporting C ++ in ReSharper, and just recently the first official release of ReSharper C ++ was released - a new product specifically for C / C ++ developers in Visual Studio. (Those who have been waiting for the release of CLion for cross-platform development in C / C ++ will need a little more patience.)

How can ReSharper C ++ be useful? Let us examine the main features of the product.




Static code analysis


As soon as you open Visual Studio with plus projects, ReSharper C ++ begins to analyze your projects and offer fixes for problems that it finds and recommend these or other improvements. For example, if you use a type without setting a title for it, ReSharper C ++ will offer you to do this:


')



If you have a prototype of a function, but lack its definition, ReSharper C ++ will offer to generate the function body either in the same or in a separate file:





If you decide to use the printf() function, ReSharper C ++ will check the formatting arguments and suggest fixes if it finds problems:





Macros and templates


ReSharper C ++ fully understands all macros, so it analyzes exactly on the code that will be obtained after preprocessing. This gives us a number of unique features: for example, you can "deploy" macros right in the code:





If factorial is implemented through templates, ReSharper C ++ can immediately check any static_assert written using this template:





Navigation and Search


ReSharper C ++ allows you to quickly navigate through large projects and search for the necessary code in them. Here are some of the supported navigation features:




To search for all occurrences of a symbol in ReSharper C ++, there is a Find Usages mechanism with preview, grouping and filtering capabilities.



It should be noted that many navigation commands are available from the context menu, which is opened by pressing Alt + Enter :





ReSharper C ++ also includes several windows for navigating large complex projects. One of these windows is called File Structure : it allows you to quickly navigate the structure of the current file:



Another window is called the Inheritance Hierarchy , and the tree type inheritance hierarchy is displayed in it:





Concluding the navigation topic, there are commands for navigating through the class elements ( Go to Next / Previous Member ) and the errors found in the file ( Go to Next / Previous Issue ).



Patterns and code generation


We adapted the system for generating code and templates for C ++. This means that in ReSharper C ++ there is support for the following mechanisms familiar to users of the main ReSharper:




In addition to templates, ReSharper C ++ also has regular mechanisms for generating code in the Generate menu:





Refactoring


Code refactoring capabilities are a kind of ReSharper business card. Here are a few refactorings that already exist in ReSharper C ++:





Conclusion


Here is a video showing the above functionality in action:





To use ReSharper C ++ you need either a separate license or a ReSharper Ultimate license.



ReSharper C ++ can be downloaded separately or as part of the full installer ReSharper Ultimate . In both cases, a 30-day trial period.

Source: https://habr.com/ru/post/255151/


All Articles