Friday, December 22, 2006

The Joy of ReSharper

After hearing friends rave about ReSharper, I finally took the plunge, and it's wonderful.
Use the IntelliJ key bindings.

Some of my favorite features:
  1. Cntl-n: find type. This takes you directly to the object of your desire. ReSharper (RS) does the google-suggest thing of giving you a dwindling list of all the objects possible based on your current key strokes.
  2. Cntl-Shift-N: Go to a file anywhere in the directory structure.
  3. RS gives advice on code. For example:
    textWriter.Write("\r\n
    Date:"+DateTime.Now.ToString()); 
  4.  Ctl-Alt-v:  Add a variable to the left of an expression - if you don't have a ";". For example:
    new StringBuilder()
    [Ctl-Alt-v]
    var stringBuilder = new StringBuilder(); 
  5. RS said the "ToString()" was redundant and (this is the best part), offered to automatically correct it for me (OK, deleting a string is not all that helpful, but some of the other advice is a little tedious to implement. I especially like the offer to use the string.format option on long concatenated strings mixed in with variables. You can turn off specific suggestions like "the 'this' prefix is redundant".
  6. Real Refactoring. VS2005 comes with a few refactoring options, but typically not the ones I need. RS has a cornucopia of refactoring methods. Maybe the jetbrains developers actually read
    book

    by Fowler, unlike some other IDE teams.
    One of my favorites is "Encapsulate Field..." which adds the getter and setters for a field.

No comments: