The 5 Top Features of ReSharper (and How They Make You More Productive)

0 Flares Twitter 0 Facebook 0 StumbleUpon 0 Google+ 0 LinkedIn 0 0 Flares ×


Being productive as a developer is really important so I thought I’d list my 5 top features of ReSharper, and how they make you a more productive developer.

ReSharper is one of these tools I’d heard about for many years during my time as a developer, but it was something that I’d never really given a go. That was until about 3 years ago when a colleague of mine convinced me to give it a go. I really wasn’t sold on the idea but he caught my attention with one particular feature (Go to type) which I thought was awesome.

Since then ReSharper has become an integral part of my developer toolkit and I truly believe it makes me a better, more consistent and more productive developer. This post is going to cover my 5 top features of ReSharper, and why they’re awesome!

Lastly I should say that keyboard shortcuts make you a more productive developer – in my mind this is absolute fact. I see this from my personal experience, and from those of other developers around me – if you’re in any way sceptical about this I assure you, give them a chance, persist for a little while and you’ll never look back.

I have also managed to negotiate a 20% discount on all JetBrains products for my readers (which include ReSharper). Just enter the following discount code when making your purchase: KT9XY-0JPMX-IV1PI-DLF1S-RO396. The discount is only valid for about 3 months so make sure you take advantage!
Unfortunately JetBrains have decided to revoke this discount code earlier than scheduled (The original end date was scheduled for the 20th December 2014). My apologies if you didn’t get to redeem the code or were planning to use it in the future.

Disclosure: Please note that some of the links in this article are affiliate links, and at no additional cost to you, I will earn a commission if you decide to make a purchase. Please understand that any recommendations I made for companies/products that I have experience with, and I recommend them because the are helpful and useful. Please do not spend any money on these products unless you feel you need them or that they will help you achieve your goals.

For keyboard shortcuts I prefer the visual studio ReSharper scheme over the IDEA one, but I will provide both with a prefixes VS for visual studio and ID for IDEA.

1. Go to everything (or /type/file/symbol/file member)

This one is a bit of a cheat because it really includes about 5 very similar but slightly different features of ReSharper. I can’t explain how much time this feature alone has saved me – not having to click through folders in large complicated projects, not having to do solution wide search operations, not even having to page up and down within a file to find the file property or method I’m looking for.

This feature totally changed the way I approach my development, and I use it all the time – literally every 5 minutes! So in to a bit more detail:

Go to everything (VS: Ctrl + T | ID: Ctrl + N)

Go to everything is probably the most useful feature I have found in visual studio – it pretty much means you never have to think about where anything is ever again. Furthermore you never have to manually navigate to anything ever again! Ok, so I may be exaggerating a little, but only a little!

Here’s a little demo:

  1. Firstly I find a class simply by pressing Ctrl+T (or Ctrl+N) and typing the class name – notice it does an incremental search so I don’t need to type the whole name.
  2. I then find another class by using the camel humps feature whereby I only have to type the capital letters in the class name and it finds it right away.
  3. Thirdly I find a class by using a wildcard character (*) in the middle.
  4. Forth I navigate to a property of the class by starting to type the property and ReSharper detects it.
  5. Fifth I navigate to a method using the same approach.
  6. Finally I navigate back to the first file because Go to everything remembers my recent files.

Restricting the results

Go to type (VS: Ctrl + T, Ctrl + T | ID: Ctrl + N, Ctrl + N)

Sometimes you only want to go to types (i.e. classes and interfaces etc) and don’t want the clutter of all the other stuff. In this case, from the go to everything box, you just hit Ctrl+T (or Ctrl+N) a second time, and the auto-complete box will only show types. This is great way of restricting the results it displays.

Go to file (VS: Ctrl + Shift + T | ID: Ctrl + Shift + N)

In a very similar manner to go to type, sometimes you’re looking for a file name – maybe an xml or html file for example. Whilst go to everything will find these, its sometimes easier to restrict the search to just files. this is really simple, just press Ctrl+Shift+T (or Ctrl+Shift+N) and start typing.

Go to symbol (VS: Shift + Alt + T | ID: Ctrl + Alt + Shift + N)

Ok, so this one required a bit more finger twisting, but its immensely useful. Go to symbol will basically search your entire solution and find any symbols matching what you type in. Clearly this is going to return a lot of results, but its just so useful for finding specific fields or methods, when you want to ignore files and types.

Go to file member (VS: Alt + \ | ID: Ctrl + F12)

This is the final shortcut I’m going to mention in this section as I have droned on long enough about the ‘go to’ commands. ‘Go to file member’ really is one of my favorites as it makes moving around in large files so much better. Working within a file and need to move to a particular property or method, just hit Alt+\ (or Ctrl+F12) and start typing, ReSharper will find the property or method and allow you to navigate to it in record time, you can even navigate to the constructor by typing ‘ctor’.

Another thing to note is that with any of the above options you can switch between them by pressing the respective key combination. So you could start with go to type (VS: Ctrl+T / ID: Ctrl+N), and then switch to go to file (VS: Ctrl+Shift+T / ID: Ctrl+Shift+N) – anything you typed into the find box is automatically transferred, which is incredibly convenient!

Here’s another little demo of some of the various ‘go to’ commands that I mentioned above:

  1. Firstly I navigate to a type by hitting Ctrl+T twice (or Ctrl+N), notice how the list of options reduces significantly after the second press.
  2. Next I navigate to a file by pressing Ctrl+Shift+T (or Ctrl+Shift+N), again notice that the list only shows files as opposed to types, properties etc.
  3. Then I navigate to a symbol (in my case a private field of a class not opened in visual studio) using Shift+Alt+T (or Ctrl+Alt+Shift+N)
  4. And finally I quickly navigate to a file member (in my case a method of the same class) using Alt+\ (or Ctrl+F12)

2. Rename Refactor (VS: Ctrl + R, R | ID: F2)

My first choice was always going to be the largest – the ‘go to’ commands cover so much and have so many usages that I couldn’t cut them short. My second choice is a really simple refactor command…simple, but really useful.

A rename refactor is actually already available in the standard Visual Studio installation, but it really doesn’t have the same power and utility that the ReSharper rename refactor has. – for example, ReSharper can

  • Rename related symbols.
  • Rename string literals.
  • Rename filenames where appropriate.
  • Suggest what you want to rename it to.

These are huge benefits, the shear amount of time you can save by leveraging this command when renaming is incredible. Here’s a very short video where I rename a single class in a very simple sample project, and various symbols, files etc are renamed to ensure the project is still building, but also for consistency:

3. Extract Method (VS: Ctrl + R, M | ID: Ctrl + Alt + M)

Extract method is another common refactor, and is again provided by Visual Studio by default, but that doesn’t diminish its value in ReSharper. To keep it really short, extract method simply takes a block of code, and moves it into a new method taking care of all the parameters and giving you a simple way to name that method.

I find this really useful when refactoring a long messy method for better reuse. I even sometimes use it to test what dependencies a block of code has. In this case I’ll use extract method on the code block and take a look at what parameters it has. Then I’ll either carry on with my refactor, or undo it.

Here’s a simple example where I have a block of code and use extract method to put a block of code into its own method. (As a bonus I also show a couple of extra refactor features)

  1. Firstly I extract a method from the AddComic method called CreateComic to encapsulate the logic for creating a new comic and attaching it to a ComicSeries. Notice how the parameters are all worked out for me.
  2. Just because I can I then move that method back in-line using the ‘Move Inline’ refactor (VS: Ctrl R, I | ID: Ctrl+Alt+N). This is the opposite of ‘Extract Method’.
  3. I extract the method again for good measure!
  4. Finally I move the method on to the ComicSeries so that it becomes more domain logic, than view model logic. I do this using ‘Move Instance Method’ (VS: Ctrl+R, O | ID: may not be a one)

4. Extend / Shrink Selection (VS: Ctrl + Alt + →(or ←) | ID: Ctrl + W (+ Shift))

This one is probably a slightly lesser known feature but is one of my personal favourites. Its really simple but I use it all the time. In fact I’d be lost without it!

The feature is kind of hard to explain, but really easy to understand when you see it! It basically extends or shrinks the selected text intelligently, based on its scope. So the first extend might highlight the variable name, the second might highlight the current statement, and so on. Here’s a really quick and simple video demonstrating it:

5. Refactor This (Both: Ctrl + Shift + R)

One thing that struck me when first using ReSharper was the amount of keyboard shortcuts I wanted to learn, all at once. To help me along with this I discovered the ReSharper ‘Refactor This’ command. The ‘Refactor This’ command is triggered by pressing Ctrl+Shift+R (on both VS & ID schemes), which will trigger a contextual popup that presents you with all the relevant refactoring options, and allow you to select the one that you want.

This means you don’t have to learn every single shortcut right away – just remember Ctrl+Shift+R and you’ll be off to an amazing start. Here’s another short video of me using a load of common refactor commands from the ‘Refactor This’ menu:

  1. First I rename a class using the Rename Refactor.
  2. Then I rename a couple of properties in that class.
  3. Next I extract a method, followed by inlining the method and extracting it again.
  4. I then move that method on to another class.
  5. I then change the signature of the class to add a parameter (dateBought)
  6. Next I extract the interface from a class
  7. Then I move the interface to its own file
  8. And finally after adding a new property to the class, I pull that property up to the interface. All done using just ‘Refactor This’ (Ctrl+Shift+R) – awesome!

Wrapping up

I actually found it really hard to limit myself to just 5 features of ReSharper that I love – I could easily have gone through 10, maybe 20 – I suppose I did cheat a bit with the first one! Since learning to use it, ReSharper has genuinely transformed the way I write code, and whilst it does have its quirks I’m much happier with it, than without it!

As a little bonus I have managed to negotiate a 20% DISCOUNT ON RESHARPER for all my readers. It only lasts about 3 months so get in there and take advantage! Its actually redeemable against any JetBrains product, and they have a lot of great stuff like Team City, IntelliJ IDEA, dotCover & dotTrace. Just head over to the JetBrains website and enter the following discount code when making your purchase: KT9XY-0JPMX-IV1PI-DLF1S-RO396
Unfortunately JetBrains have decided to revoke this discount code earlier than scheduled (The original end date was scheduled for the 20th December 2014). My apologies if you didn’t get to redeem the code or were planning to use it in the future.

, ,

The Essential App Marketing Kit
Subscribe To My Newsletter To Get an Entire Chapter From The Book for FREE
Never display this again
0 Flares Twitter 0 Facebook 0 StumbleUpon 0 Google+ 0 LinkedIn 0 0 Flares ×