ReSharper Tip of the Week #2: Navigating

An entry about tools Publication date 25. May 2008 23:10

Last week I started a new series of posts, in which I'll be presenting some of my favorite ReSharper shortcuts. Last time we looked at finding things; this time we'll focus on navigating. Note that I'm using the Visual Studio ReSharper scheme (which is the default); if you're using another setup then the shortcuts will differ. You can change this from the General pane of the ReSharper options dialogue.

Navigating Inheritance

When the cursor is on a type name, hitting Ctrl + End brings up the 'Derived Types' dialogue. From here, you can quickly navigate to any type that inherits the type you invoked it for:

image

Similarly, Ctrl + Home brings up the 'Base Types' dialogue, which allows you to quickly navigate in the other direction:

image

If there is only one derived type or one base type, then ReSharper will immediately navigate to it, skipping the dialogue (at least, this is the default behaviour - you can change it from the configuration if you want to). Note that the cursor doesn't have to be on a type declaration for this to work, it works anywhere a type name is found (such as in variable declarations, for instance).

Navigating Member Inheritance

If the cursor is on a member name, then Ctrl + End and Ctrl + Home will instead let you navigate to types which override it, or base types from which it was overridden, respectively:

image

For member declarations, ReSharper also provides a nice visual hint that the member implements an interface or overrides a base member, in the gutter of the editor:

image

Here for example, it tells us that the property is an implementation of an interface; notice the green "i" icon (circled in red). If you click the icon, ReSharper will take you to the interface where the property is declared. If the declaration is in a type outside your solution, ReSharper will bring it up in the Object Browser instead (this goes for all navigation shortcuts, incidentally).

Navigating to Usages

If the cursor is on a member name, hitting Shift + Alt + F12 will bring up a dialogue showing all the usages of this member:

image

Naturally, this list can be quite long. Hitting Shift + Alt + F11 will instead only search for usages within the current file, and instead of showing a list it will highlight the declaration in red and the usages in blue:

image

The usages remain highlighted until you press Esc.

Navigating to Declarations

If the cursor is on a member name, hitting Ctrl + Shift + F11 will take you to the type that declares this member. If the cursor is on the instance of something, this will take you to the type declaration of this instance.

Navigate from Here to...

Memorizing all these different shortcuts can be a bit daunting to begin with, and its easy to just revert to using the mouse. Don't despair just yet though; all you really need to begin with is to remember Alt + \ (that's a backlash), which will show you what navigation options are available in the current context:

image

Notice that it also shows the direct shortcut next to each option, which will help you learn them in no time.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Comments

Powered by BlogEngine.NET 1.4.5.0

Welcome!

My name is Fredrik Kalseth, and this is my blog - thanks for visiting! I am fortunate enough to work with what I love for a living, and this blog is essentially the biproduct of that.

I work as a senior consultant for Capgemini, and am also an active participant in the Norwegian .NET community, as an avid attendee but also as a speaker (most recently at NNUG and MSDN Live).

As a developer, I have a wide circle of interest. My primary passion is for agile, test-driven development, with focus on best practices and clean code. That said, I also love to work on the frontend, especially with web development.

On Twitter? My handle is fkalseth. On LinkedIn? I`m there too.

Disclaimer

This is a personal blog; any opinions expressed here are my own and do not necessarily reflect those of my employer. All content herein is my own original creation, and as such is protected by copyright law. Unless otherwise stated, all source code posted on this blog is freely usable under the Microsoft Permissive License.

What Readers Talk About

Comment RSS