Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

F12 - Go to Implementation of Interface

When not running an application, pressing F12 (Go To Definition) on a method on an interface type will take you to the interface itself.

Is there any key combo that exists (or one that I can make) that will allow me to provide a default implementation to jump to, or allow me to quickly pick an implementation to go to?

We have several layers in our application, and it would save a lot of time to be able to jump straight to the Mock or Real implementations rather than navigating to them in source control.

like image 205
Jonesopolis Avatar asked Sep 16 '15 17:09

Jonesopolis


People also ask

How to Go to implementation in Visual Studio?

Choose Navigate | Go To Implementation in the main menu, press Ctrl+F12 , or click the symbol while holding Ctrl+Alt keys. Note that in Visual Studio 2017 and later, the Ctrl+Alt -click is used for adding multiple carets.

Why is Ctrl F12 not working Visual Studio?

Go to Tools -> Options -> Keyboard, Reset all settings. Restart your visual studio and then try to use F12.

How do I enable Go to implementation in Visual Studio code?

Go to Implementation# Languages can also support jumping to the implementation of a symbol by pressing Ctrl+F12. For an interface, this shows all the implementors of that interface and for abstract methods, this shows all concrete implementations of that method.

How do I open the implementation class in Intellij shortcut?

To navigate to the implementation, press Ctrl+Alt+B .


2 Answers

Visual Studio 2015 - Update 1

Added Edit.GoToImplementation which appeared in the context menu, but there was no keyboard shortcut associated with it by default.

Visual Studio 2015 - Update 2

Added a default shortcut of Ctrl + F12

like image 71
Kevin Pilch Avatar answered Oct 22 '22 16:10

Kevin Pilch


If using VS 2015 and above:

See answer below:

Visual Studio 2015 Update 1 added Edit.GoToImplementation which appeared in the context menu, but there was no keyboard shortcut associated with it by default.

In Visual Studio Update 2, we added a default shortcut of Ctrl+F12.


If using VS 2013 and below:

We had the same problem and started using Resharper. It has a nice Goto Implementation feature, which was working very well, as I remember.

The problem is that this tool is not free though (which is of course justified, as it offers much, much more than the mentioned feature).

Without this, I use Find All References and identify the implementation quickly by looking at the path (we have interfaces, implementations and mocks nicely segregated). But you've probably identified this possibility by yourself.

Also, you may consider an option mentioned in this answer (although it's for interface methods, not implementations):

  • move the cursor over the method
  • type CTRL+K CTRL+T to open the Call Hierarchy window
  • move down to Implements node
  • type Return to go to the selected implementation
like image 20
BartoszKP Avatar answered Oct 22 '22 16:10

BartoszKP