03 October 2008

ReSharper Guidelines -- First Time Users

Harry L. wrote in review of ReSharper on Visual Studio Gallery:
... I have found that I used the features of Resharper almost without knowing it. What amazed me was how many features I use without going up a long learning curve...

Indeed, most important ReSharper features can be instantly learned right from the code editor without reading any documentation. However, I thought that having some guidelines about where to look and how to improve own productivity would be nice anyway. So I'm going to write several posts about how to use ReSharper in a form of guidelines.

Shortcuts are given for Visual Studio keyboard scheme, but you can easily find shortcuts for your configuration in ReSharper menu.

First Time Users guidelines:


  1. DO open your real project in Visual Studio with ReSharper enabled. Playing with the productivity tool in a sandbox doesn't really give you understanding about its effect. It can take some time for ReSharper to analyze your solution for the first time, but it will be much faster during subsequent runs.

  2. DO NOT run away from your Visual Studio when you first open your source code with ReSharper :) You will see colored identifiers, a lot of squiggles indicating warnings and suggestions, redundant code painted in gray -- your code most likely will be overhighlighted. You will clean it up pretty fast with ReSharper. You can switch Color Identifiers off if you wish (ReSharper / Options / Code Inspection / Settings).

  3. DO configure your naming (ReSharper / Options / Languages / Common / Naming Style) and formatting preferences (ReSharper / Options / Languages / C# / Formatting Style). ReSharper uses these settings when guessing on identifiers, while updating the code and doing other automatic code generation and transformation for you.

  4. DO learn 4 keyboard shortcuts to use in code editor:

    • Alt-Enter - opens code transformation menu with Quick Fixes and Context Actions. Try it whenever you see light bulb to the left of your code, and see what you can do with it.
    • Alt-` (Navigate from Here) to open menu with actions to navigate from currently selected symbol, like "Go to base", "Go to derived" and "Go to usages"
    • Alt-Ins (Generate) -- generates type members, like properties, constructors, overrides and implementations, Equals, GetHashCode and ToString methods.
    • Ctrl-Shift-R (Refactor This) -- opens menu with all refactorings available at current caret position (or current selection in any ReSharper tool window).

  5. DO NOT use Solution Explorer to find code, use "Go to Type" (Ctrl-T), "Go to File" (Ctrl-Shift-T), "Recent Files" (Ctrl-,) and other commands from ReSharper / Go To menu. This will help you navigate much faster.


After you familiarize yourself with these basic actions, download and print key map and start exploring other commands.

5 comments:

fallout said...

Is there any way to get to the properties window for a file without finding the file in the solution explorer?

I have found that the only 2 things I still need solution explorer for are changing the build action of a file (eg making an embedded resource) and adding references. Alternative ways to do both of these would be very appreciated.

vansickle said...
This comment has been removed by the author.
vansickle said...

fallout:
not sure that fully understand your question, but you can quickly find file in Solution-Explorer by use Alt-Shift-L (in IDEA-like keymap, also if you use "Solution folder", it must be open) and then use F4

Ilya:
Thanks for article, but it will be better if you spend a little time to provide IDEA-like shortcuts for you articles. Because it's annoying, when I going through your article, find something new - for my case I always use special navigation shortcuts like base, inheritor n etc. and didn't notice "Navigate from here" - try your shortcut - "Alt-`" and it's not working. And need some time to re-read you article, understand that you use another keymap (I see that you mention it, but I start reading from lower paragraph) and find Ctrl-Shift-G.

For this article:
Alt-` : Ctrl-Shift-G
Ctrl-T : Ctrl-N
Ctrl-Shift-T : Ctrl-Shift-N
Ctrl-, : Ctrl-E

Others the same.

Ilya Ryzhenkov said...

vansickle, these are guidelines for people who has experience with Visual Studio, but never used ReSharper or IDEA before. For them choosing Visual Studio key map would be natural selection. I don't think there are many people out there who choose the other key map and still need "how to start" guidelines :)

Andrey said...

Ilya, I've been using ReSharper for a while but still don't know about how is Stack Explorer is working. Could you please describe it's usage a little bit? Thanks in advance.