📜 ⬆️ ⬇️

Useful add-ons to ReSharper



Hello!

As I noticed, quite a few people use ReSharper, but completely ignore its extensions (plugins). In this article I will describe those that seemed useful to me.
The names of the extensions are clickable and lead to their detailed description.

Respeller free


Expansion for finding spelling errors. It is extremely useful in cases when comments are written, a public API is created, text is written to the log. In these cases, usually, the texts are not given by the technical writer, but are only checked during the review process. And if there are spelling errors, then Ctrl-F for the logs may produce the wrong results (after all, the letters are missing), and Ctrl-T for the project will not show the class (for the same reasons).
In it, you can create your own dictionary, which is stored in the ReSharper settings in a standard way (i.e., hierarchically: command settings, custom settings, etc.)
Work example

Enhanced tooltip


Improvement of prompts when you hover the mouse ( English - tooltip ) or in the Code Completion menu (ie, when you press Ctrl-Space). Unlike the standard one, it also:

This extension helped me more than once to quickly understand information about exceptions, as well as about when the result of a function may (or may not) be null.
')

Community External Annotations


ReSharper supports marking code with NotNull / CanBeNull attributes, as well as a number of others (for example, StringFormatMethodAttribute ) that help it to understand the many possible values ​​for arguments or results. For example, if the result of the function's operation with the CanBeNull attribute is passed to the function with the NotNull argument, this place in the code will be emphasized as potentially dangerous (by the way, the advice to the guys of SvyatoslavMC , Andrey2008 from PVS Studio Team : add these checks to yourself too). However, instead of adding attributes to the code, you can create a special xml file in which they will be described. This method is suitable for libraries whose code does not change, but the behavior has already been more or less studied. Similarly, JetBrains has tagged a number of popular libraries, such as log4net, etc.
Added tips for a number of popular projects to Community External Annotations. Moreover, if you have already studied a certain library, you know the pitfalls, you can commit annotations in git, and they will appear in all developers (who use ReSharper, of course).

ConfigureAwait Checker and AsyncSuffix


If you are writing code with Task'ami, then these extensions - just Must Have. They have already saved me from bugs more than once.
ConfigureAwait Checker requires that all awaits terminate with ConfigureAwait (true) or ConfigureAwait (false) . By default, the compiler will consider that after await it is necessary to return to its synchronization context (that is, as with ConfigureAwait (true) ), which is not always correct. For example, if you started a long Background Task from UI, then ideally it should return to the UI context only at the very end (to increase the responsiveness of the application, by reducing the load on this thread). However, if somewhere you forgot to set ConfigureAwait (false) , then the return will occur much earlier (since the entire sequence of calls is configured at the beginning, that is, in our case, in the UI stream). On the other hand, if the flag is clearly not set, whether to return back or not, it is not always clear: in this place, the context should be changed to the original one, or the developer simply forgot to set ConfigureAwait (false) . With this extension, no one will ever forget to explicitly write where you want to execute code after await.
Work example

The AsyncSuffix extension requires that asynchronous methods end with the word Async. It is extremely useful in the case of refactorings, since it allows highlighting in the review all conversions of the synchronous method to asynchronous (which reduces the likelihood that something is forgotten). And at the same time it unifies the code, so that by the signature of the method a multi-threaded idea becomes clear.
Work example


Conclusion


In fact, ReSharper has many more extensions. Most of the remaining ones are specific to a particular technology, such as AngularJS or xUnit Tests Support ReSharper . However, extensions above already accelerate development speed and reduce the likelihood of bugs. If there are more tips - welcome in the comments.

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


All Articles