Tools - a means of enhancing your talent. The better they are and the better you own them, the more you can do.
Andy Hunt and Dave Thomas “A Pragmatic Programmer. The journey from the apprentice to the master "
DISCLAIMER : This is not a custom-made and completely unpaid article (JetBrains, I hint nothing). Here are just the features of the popular
Visual Studio extension (and sometimes similar capabilities of the studio itself), which I personally use in my daily activities.
Tools are not a panacea for crooked hands and by themselves will not make an ordinary hellish expert Satan, capable of tearing up any task, like the famous four-legged friend of a rag. They do not solve your problems themselves, but only help to remove some routine things from their shoulders and make it possible to focus on the main thing without thinking about such mundane things as adding the necessary
using directives, problems of formatting or navigating through the code. Many tools (especially ReSharper) can help in solving other important tasks, such as finding errors in the code, following coding standards, running unit tests, and many others. And although all these possibilities are mega-fiches in their own right, but today we are mainly talking about the possibilities of navigation and search.
The description format is as follows: feature names, and then in brackets hot keys for the Visual Studio scheme, and then for the IDEA scheme.
')
For example: Go To Type (Ctrl + T, Ctrl + N).
1. Import Symbol Completion (Shift + Alt + Space, Ctrl + Alt + Space)
Everyone knows about the tricky IntelliSense ReSharper, and in the 10th studio it is quite good. But the feature of IntelliSense is that it works only on characters that have already been imported using the using directive. But there is a situation when you know the type name (or part of it), but you are not very sure in which namespace it is located. In this case, you can type the full name of the type, and then use Alt + Enter to add the desired namespace (see clause 9.
Auto - import using directives ), but this method will not work if you only know part of the name. And in any case, you will have to stomp all the letters, which is not always convenient.
Unlike the standard code completion mechanism,
Import Symbol Completion will look for matching the input word not only among the “visible” types, but among all the types available in the current assembly.

2 .. Search for files and types
Visual Studio 2010 has finally added at least some navigation capabilities in the form of the
Navigate To command (the Edit.NavigateTo command, see Scott Guttry's
Search and Navigation Tips / Tricks with Visual Studio for details). However, unlike the standard version of this command from VS2010, ReSharper has not one but several commands: type search, file search, and symbol search. On the one hand, this requires memorization of a large number of hot keys, but allows you to quickly find the desired class or file.
All search capabilities support CamelCase completion, so when typing
tmc we find
T ext
M essage
C ommand,
T est
M ono
C ompiler, etc.
•
Go to Type (Ctrl + T, Ctrl + N) - search by type name (looking for classes, interfaces, enums, structures)
•
Go to File (Ctrl + Shift + T, Ctrl + Shift + N) - search by file name
•
Go to Symbol (Shift + Alt + T, Ctrl + Shift + Alt + N) - an analogue of Navigate To from VS2010, searches by type names or members inside these types.
By the way, between all three types of search (more precisely, between four, since there is also a
Go to File Member ), you can switch without closing the current search (i.e. you don’t have to search the search line again if you suddenly started searching for a type, but you need to -So look for the file).
NOTEIn fact,
Navigate To of VS2010 is closest to the
Go to Symbol ReSharper team, but
Navigate To also searches for file names, which sometimes leads to an unexpectedly large amount of “noise” in the form of files with architectural diagrams and some other files that we clearly not interested.
Below are screenshots with the listed ReSharper features: Go to Type, Go to Filename and Go to Symbol:



3. Go to File Member (Alt + \, Ctrl + F12)
Visual Studio has the ability to go to a member name within a specific file (this feature is called the Navigation Bar,
Window command
. MoveToNavigationBar ), but the similar ReSharper feature is a bit more convenient. First, the
Go to File Member supports the same filtering and search capabilities as a type or file search (i.e., supports CamelCase search). Secondly, the Go to File Member displays a list of members not in the order of the declaration, but in a slightly different order (constructors, fields, properties, methods), which makes the transition to the designer as convenient as possible.

4. Navigate To (Alt + “` ”, Ctrl + Shift + G)
ReSharper supports a large set of navigation capabilities: the transition to the declaration and implementation, the transition to base classes and heirs, and many others. For each of the commands there are corresponding hot keys, but since they are a little more than dofig, I don’t feel like remembering them all. To get started, just remember one command from which you can get access to all navigation options - this is a navigation command called
Navigate To , from which you can choose a specific action. (Do not confuse this command with
Navigate To from Visual Studio, which was mentioned when discussing the search for types and files).

Most of the navigation commands are fairly well known, but I want to highlight one separately. This is
Go to Implementation (Ctrl + F112, Ctrl + Shift + Alt + B) .
Nowadays, various loosely coupled architectures built on the basis of interfaces are quite popular. As a result, when a method is called via an interface-type variable, it becomes not entirely clear what will be called in reality. In this case, the “transition to implementation” and not to the declaration of the method can be very useful.

5. Navigating the "latest files"
1. [ VS ] Navigate Backward ( View . NavigateBackward , Ctrl + -), Navigate Forward ( View . NavigateForward , Ctrl + Shift + -)2. [ R #] Recent Files ( Ctrl + “,”, Ctrl + E ) - a list of recently viewed files
3. [ R #] Recent Edits ( Ctrl + Shift + “,”, Ctrl + Shift + Alt + Backspace ) - the list of recently modified files
4. [R #] Locate File in Solution Explorer (Shift + Alt + L, Shift + Alt + L) - show the position of the current file in Solution Explorer
When intensively navigating through a solution, it often becomes necessary to switch to previous files. You can of course switch to open tabs, but this is not always the most convenient way to navigate.
The easiest way to go back one or a few steps back (or forward) is to use the standard Visual Studio commands, Navigate Backward / Forward. However, if you need to go back to several levels at once, then it is easier to search in the list of recent files (
Recent Files ) (by the way, as in other features, Recent Files supports the ability to search and filter the desired file, including CamelCase search).

Separately, I want to note the ability to show the position of the current file in Solution Explorer (
Locate File in Solution Explorer ).
6. Move code up, down, left, right (Ctrl + Alt + Shift + Up / Down / Left / Right)
The command allows you to structure members of classes, as well as move blocks of code inside a method (for example, you can add or put code inside blocks of if / for etc).

7. Go to next member / tag (Alt + Down), Go to previous member / tag (Alt + Up)
This is such an analogue of moving paragraphs in Word with Ctrl + Up / Down, only in this case the “paragraphs” are the members of the class (methods, properties, events, fields).
8. Generate Code ( Alt + Insert )
ReSharper supports quite a lot of different buns for code generation, most of which are available via Alt + Insert. Templates for generating classes / structures / enums are available from Solution Explorer (you can add and change your own templates):

And from the classes, another command is available for generating constructors, properties, method overloading, etc.

At a minimum, it is worth paying attention to the generation of constructors, overloaded methods and comparison methods (comparison methods are a separate topic and it is at least tiresome to write them correctly).
9. Auto-import using directives (Alt + Enter)
Another useful feature that I use all the time is the automatic import of
using directives.

The figure above shows the capabilities of both ReSharper and the built-in Visual Studio tools (the context menu with fixes from Visual Studio is called “Smart Tag” (View.ShowSmartTag) available by Alt + Shift + F10 or Ctrl + “.”). In addition to using different hotkeys, the difference between the two implementations is that ReSharper is looking for these types not only in the added assemblies, but also in all other assemblies of the solution, which can be very convenient, for example, when working on a project with unit tests when some projects have not been added yet.

10. Find Code Dependent on Module
Sometimes it is useful to understand what is specifically used from a particular assembly. For these purposes, in the 6th, ReSharper added the ability to search for code that depends on a particular assembly; this is available as follows: Solution Explorer -> References -> System.Xml.Linq -> Find Code Dependent on Module.

11. Duplicate a line or selection (Ctrl + D)
It is clear that copy-paste is evil, but in capable hands ... In general, in some cases it may be useful to duplicate a fragment or the current line.
By the way, here it is worth mentioning another similar possibility (this time, this is a studio opportunity, not ReSharper), which I often use: deleting the entire line without selecting it -
Cut or Delete the Current Line (Edit.LineCut, Edit .LineDelete, Ctrl + L, Shift + Del).
12. Parameters Info (Ctrl + Shift + Space, Ctrl + P)
It is often necessary to look at information about the parameters of a method (or additional method overloads) when the method call is already written in code. Usually this problem is solved by removing the opening brackets of the method and then driving it in again. As a result, IntelliSense is called, which will display information about the method or the desired parameter.
But there is a simpler option - using the Parameters Info command. This function is available both in Visual Studio (the keyboard shortcut is the same: Ctrl + Shift + Space) and in ReSharper, the only difference is what IntelliSense will be called.

13. Quick Documentation
Another possibility that exists both in Visual Studio and in ReSharper, however with slight differences in usability.
[VS] Quick Info (Edit.QuickInfo, Ctrl + K, I)
[R #] Quick Documentation (Ctrl + Shift + F1, Ctrl + Q)
Unfortunately, if
contract programming has suddenly attracted you, then none of these tools show normal preconditions and postconditions, or rather, they do not show them at all. There is an extension to the studio, called
Code Contracts Editor Extensions , which adds this information to the tool tip from Visual Studio, but the stability of this extension is very low.
14. ReSharper Namespace Provider
One of the standard naming idioms is to reconcile the logical (namespaces) and physical structure of the project (folders); This means that the name of an open (
public ) class must match the name of the file, and namespaces (
namespace ) must match the folder structure in which this file is located.
Most often, such a scheme is reasonable to adhere to and the ReSharper analyzer thinks so, and if you do not follow this, it will complain, suggest thinking again and use the correct namespaces.

However, it is always difficult to follow these principles, and you don’t want to turn off this ReSharper function. This dilemma is solved quite simply: just go to the folder properties and set the
Namespace Provider to
False .

Conclusion
ReSharper has long been a decent monster with a huge number of opportunities, and here is shown only a part of them that I use all the time. This does not mean that all the listed opportunities will be convenient for everyone or that there are no other useful features. For example, I deliberately did not touch on refactorings, quick fixes, means of providing coding style, running unit tests, templates, and much more. As for Visual Studio, it is an even bigger monster, with a huge number of features; some of them are very convenient, and some are rather mediocre (JetBrains and similar guys also need to earn something for a living). Among the convenient features of the studio itself, it is worth noting the possibility of vertical editing (I wrote a little more about it
here ), hiding arbitrary sections of code, powerful
search and replace tools and much more. But this is a topic for a separate post.
Additional links1.
ReSharper FeaturesYes, I know that no one likes to read official documentation, but sometimes you can find a lot of useful things in it!
2.
ReSharper Default KeymapVisual Studio scheme pdfReSharper 2.x / IDEA scheme pdfPrint in 3 copies and hang in front of the desktop!
3.
The best posts of Scott Guttrie for 2010Scott's post contains a very decent set of links, most of which are devoted to the new features of Visual Studio 2010. Although my article is mainly devoted to ReSharper, even in it I repeatedly touched upon the general features, so an additional source of information about the studio would be useful.