23

Possible Duplicate:
How do you quickly find the implementation(s) of an interface’s method?

I like ReSharper's Go To Implementation feature but I often keep ReSharper disabled. Is there an equivalent extension for Visual Studio 2010?

Community
  • 1
  • 1
kenwarner
  • 27,129
  • 27
  • 126
  • 170

6 Answers6

37

I'm looking for the extension for this little "go to implementation" too. But unfortunately I couldn't find any. May be we will have to wait next version of visual studio or enable ReSharper back (which in my opinion, eating too much resources)

Well the best solution for me right now is to use "Call Hierarchy" feature of VS2010. Just follow my instruction below

  1. Move cursor to the target method name
  2. Press "Ctrl K, Ctrl T" (this will pop up "Call Hierarchy Window")
  3. Press "Down", "Down", "Right", "Down", "Enter" (this will go to your implementation method)
    • Look funny but it is actually the way to use keyboard to navigate to the item you want
  4. [More Explanation]
    • "Down", "Down" --> go to "Implements 'xxx'"
    • "Right" --> expand children
    • "Down" --> focus on the implementation method
    • "Enter" --> navigate to it

Hope this help

ensecoz
  • 900
  • 10
  • 16
6

Ctrl + F12 - Go To Declaration

David Gardiner
  • 16,233
  • 16
  • 71
  • 115
Alex Aza
  • 70,453
  • 24
  • 147
  • 129
  • i saw this in the keyboard bindings screen, but it doesn't actually do anything on my PC. maybe my setup is borked – kenwarner Jun 06 '11 at 04:55
  • @qntmfred: Assuming you're using the shortcut correctly (have to have the right editor context - word selected, window focus, etc): How to reset your settings - http://msdn.microsoft.com/en-us/library/ms247075(v=VS.100).aspx – Merlyn Morgan-Graham Jun 06 '11 at 04:58
  • This is standard shortcut. You probably have different keyboard schema. You can go to `Tools` => `Options` => `Environment` => `Keyboard` and check the shortcut for `Edit.GoToDeclaration` command. You can set the shortcut. – Alex Aza Jun 06 '11 at 04:59
  • @Alex yup I have that `Edit.GoToDeclaration` set to ctrl+f12. just doesn't seem to do anything. tried it on 2 computers, including one with a fresh VS install – kenwarner Jun 06 '11 at 05:03
  • Very weird. For me it does exactly the same what 'Go To Implementation' menu item does. – Alex Aza Jun 06 '11 at 05:07
  • so if I assign a different keyboard shortcut to Edit.GoToDeclaration and try to use it, I get "The key combination (Ctrl+G, Ctrl+D) is bound to command (Go To Declaration) which is not currently available." Do you have to do something special other than just have the cursor on a particular symbol to get this to work?? – kenwarner Jun 06 '11 at 05:18
  • I didn't do anything special, Ctrl+F12 always worked without any special magic, at least as far as I remember :). – Alex Aza Jun 06 '11 at 05:25
  • 2
    Ctrl-F12 only works when Resharper is enabled. Its doing the same thing as Alt-End I dare say. – wal Jun 14 '11 at 13:41
  • that only works on concrete types, not interfaces. R#'s go to implementation works on both types and interfaces. – PositiveGuy Sep 18 '13 at 06:10
  • It should be the right answer. Works in my Visual studio 2013. Thanks – Emdadul Sawon Aug 04 '16 at 13:43
4

For me, the easiest and free way to get "Go to implementation" functionality in VS2010 (and for VS2008 for that matter) was to

  1. Install free CodeRush Xpress http://msdn.microsoft.com/en-us/vstudio/ee663901

  2. Install "Go to implementator" Code Rush extension by Miha Markic. The author just today, updated his extension to work with most recent CodeRush Xpress 11.2.11 http://blog.rthand.com/page/Go-To-Implementator.aspx

Works very nicely.

Sebastian K
  • 5,815
  • 1
  • 38
  • 62
1

Short answer, no.

You should aim to keep Resharper enabled 100% of the time, in my opinion. Ensure Solution wide analysis is turned off, use the latest resharper (Resharper 6 is out now) and/or upgrade your PC.

wal
  • 16,300
  • 7
  • 69
  • 104
1

I'm honestly not overly familiar with Resharper but if the "Go To implementation" you are talking about is when you can click on a method call and it will take you to that method's code then I would suggest the "Productivity Power Tools" created by Microsoft.

private void foo()
{
 // does stuff
}

private void main()
{
 // hold down CTRL, foo() below will turn into 
 // a hyperlink that you can click on
 foo();
}

Here's the link http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef/

This will allow you to hold down the CTRL key which turns methods and variables into hyperlinks which when clicked will take you to where these were defined originally.

These Tools also can clean up unused Imports/using statements at the top of you code-behind/class files. And my favorite auto bracket completing

Jeremy
  • 81
  • 1
  • 5
  • While not directly related to the question I also use PowerCommands for VS2010, gives you a little bit better access thru VS to your file system http://visualstudiogallery.msdn.microsoft.com/e5f41ad9-4edc-4912-bca3-91147db95b99/ – Jeremy Feb 08 '12 at 18:07
  • 3
    thanks Jeremy - that power tool feature executes the Go To Definition command, which can also easily be executed via F12. What I'm looking for is Go To Implementation, which in Resharper is where the variable you are interested is an interface instead of a concrete type. Go To Definition will open the interface, whereas Go To Implementation will figure out (or ask you) which implementation of the interface you want to look at. – kenwarner Feb 08 '12 at 18:38
1

Not a keyboard shortcut, however Go To Definition by Noah Richards is a useful, lightweight extension to Visual Studio.

KMoraz
  • 13,655
  • 3
  • 46
  • 79
  • This doesn't go to implementation, it just pops up a definition in the current window. This is useless when dealing with interfaces and why 'Go to implementation' is so nice to have – Mario Feb 24 '14 at 17:30