My 8 Favorite ReSharper Shortcuts
Out of all the Visual Studio extensions I have installed, ReSharper is my favorite, by far. It allows me to easily refactor components, run analyses on my code base, and quickly navigate through different files. With it comes a plethora of shortcuts, far more than I can remember. Still, even a small subset has increased my productivity dramatically. Here's my list of ReSharper shortcuts that I've found to be indispensable.
#Show Action List
The one shortcut known by probably every ReSharper user is ALTENTER. It opens the action list presenting quick-fix and refactoring suggestions:
I've more or less included it here for the sake of completeness – you've likely used it plenty of times.
#Rename
Another shortcut I'm using rigorously is CTRLR, R which renames the symbol under the caret. It can be used to rename namespaces, classes, structs, methods, fields, local variables, and other symbols. The suggestions for a new name are pretty good from time to time, depending on the use case:
#Introduce Variable
The next candidate is CTRLR,V which introduces a new local variable and initializes it with the currently selected expression:
And here's the code afterwards:
This shortcut comes in handy when you want to factor out variables of a complex expression.
#Introduce Field
Similar to Introduce Variable is Introduce Field, mapped to CTRLR,F, which creates a new field from the currently selected expression. ReSharper will present a dialog box that allows you to specify the modifiers for the field:
Here's the updated code:
#Refactor This
Of course, there are many, many more refactoring methods in ReSharper. Since I'm not using all of them on a daily basis, I haven't memorized every single shortcut. The one shortcut I did remember, though, is CTRLSHIFTR, which is called Refactor This. It shows a list of possible refactoring for the symbol under the caret:
#Extend Selection
If you want to select blocks of code that belong together, CTRLSHIFTW is for you. Starting from the current caret position, ReSharper will successively expand the selection in an intelligent way:
No more selecting string literals or blocks of code with the mouse! The opposite action (shrinking the selection) is implemented as well, but I rarely use it.
#Go To File
To quickly navigate between files in my solution, I like to use ReSharper's Go To File function. It's mapped to CTRLSHIFTT by default, but I changed it to CTRL, because I find it easier to type. Go To File will display a little text box in which you then enter parts of the file name you want to navigate to:
It's pretty smart about PascalCased type names, too:
You can even specify the folder hierarchy with a space (note the blue highlights):
Great productivity enhancement!
#Locate in Solution Explorer
Finally, I'm a big fan of ALTSHIFTL, which locates the opened file in the Solution Explorer:
When working on a certain file, I often find myself needing to adapt files within the same directory as well. That's when Locate in Solution Explorer comes in especially handy.
#Summary
Here's the cumulative list of shortcuts I mentioned above. I've included the alias for each shortcut so you can easily find it in the Visual Studio Keyboard settings menu in case you want to change the keys it's mapped to:
- ALTENTER – Show Action List (
ReSharper_AltEnter
) - CTRLR,R – Rename (
ReSharper_Rename
) - CTRLR,CTRLV – [Introduce Variable]https://www.jetbrains.com/help/resharper/Refactorings__Introduce_Variable.html) (
ReSharper_IntroduceVariable
) - CTRLR,CTRLF – Introduce Field (
ReSharper_IntroduceField
) - CTRLSHIFTR – Refactor This (
ReSharper_RefactorThis
) - CTRLSHIFTW – Extend Selection (
ReSharper_ExtendSelection
) - CTRLSHIFTT – Go to File (
ReSharper_GotoFile
) - ALTSHIFTL – Locate in Explorer (
ReSharper_LocateInSolutionExplorer
)
Here's how I keep those settings in sync between multiple dev machines: Keep Your Visual Studio and ReSharper Settings In Sync Between Multiple Development PCs
That was just the top of the list, there's more! Other shortcuts I'm using frequently that I haven't mentioned so far include:
- CTRLR,S – Change Signature
- CTRLSHIFTENTER – Complete Statement
- CTRLSPACE – Symbol Code Completion
- CTRLALTSPACE – Smart Code Completion
- ALTDELETE – Safe Delete
- ALTINSERT – Generate Code
I recommend you go ahead and explore them on your own. If you're still hungry for more shortcuts, go ahead and explore the Keyboard Shortcuts page in the official ReSharper documentation. I'm sure you'll find plenty of goodies in there.