109

After working for a few days with Eclipse Java I totally got addicted to pressing Ctrl and clicking on an identifier to go to its definition. Since then I've been looking for a way to achieve this in Visual Studio as well.

I realize VS has right click, Go to definition, and that F12 does the same. I also realize that Visual Assist does something similar with Alt + G. Yet none of these are as perfect as Ctrl + click.

I've actually tried my luck for a few hours trying to write a VS plugin to do it but didn't get anywhere in the time frame I thought reasonable for this.

Does anyone know how this could be achieved? A ready plugin? A macro of some kind?

Jasper
  • 2,166
  • 4
  • 30
  • 50
shoosh
  • 76,898
  • 55
  • 205
  • 325
  • 2
    What's the difference between F12 ans Eclipse Ctrl+Click? – Pokus Oct 03 '08 at 19:02
  • I have to agree that I don't see the difference but I am interested in the answer. – wcm Oct 03 '08 at 19:13
  • Can you describe why Eclipse's ctrl-click is more "perfect" than the other options you list? Fewer steps? Faster? Fewer failures? Different display of results? – jwfearn Oct 04 '08 at 01:46
  • 56
    @jwfearn et al: In my case, when I'm reading through some code (rather than writing), my right hand is already typically on the mouse, and my left thumb is near the left Ctrl key. It's super fast and easy to ctrl+click in that situation; easier than using the right-click menu (or reaching for F12). – Jon Schneider Oct 21 '08 at 03:00
  • Ctrl+Click as word selection >>> Ctrl+Click as navigate. – Sam Harwell Sep 02 '09 at 02:20

13 Answers13

67

If you use Visual Studio 2010, you can use the free Visual Studio 2010 Productivity Power Tools from Microsoft to achieve this.

splintor
  • 9,924
  • 6
  • 74
  • 89
  • 3
    After installing this VS 2010 extension, go to Options > Productivity Power Tools to see all the good stuff ('Ctrl-Click Go To Definition' is enabled by default). – Dunc Jul 30 '10 at 18:59
  • 7
    Productivity Power Tools 2013 for Visual Studio 2013: http://visualstudiogallery.msdn.microsoft.com/dbcb8670-889e-4a54-a226-a48a15e4cace – Jon Schneider Feb 26 '14 at 14:49
  • 7
    Productivity Power Tools 2015 for Visual Studio 2015: https://visualstudiogallery.msdn.microsoft.com/34ebc6a2-2777-421d-8914-e29c1dfa7f5d Control+click is equivalent to "Peek" – user1069816 Sep 01 '15 at 14:28
52

I use visual studio 2013 and 2015, I installed Go To Definition. To install this extension navigate on TOOLS -> Extensions and Updates.

enter image description here

Se Song
  • 1,613
  • 2
  • 19
  • 32
34

I'll answer the commentors who asked about the difference between Ctrl-click and F12.

Ctrl-click workflow:

  • Move hand to mouse
  • Move mouse to hover over variable name
  • Other hand holds down Ctrl key while you click
  • Move mouse to position cursor, highlight, right-click, or whatever
  • Move hand back to keyboard to continue typing

F12 workflow

  • Move hand to mouse
  • Mouse mouse to hover over variable name
  • Move hand back to keyboard
  • Hit F12 key
  • Move hand back to mouse
  • Move mouse to position cursor, highlight, right-click, or whatever
  • Move hand back to keyboard to continue typing

If you assume the cursor is already positioned on the desired variable, F12 is better. However, that's rarely the case. Also, if you stop after this specific action, assuming you want hands back at the keyboard, the cost is the same. But if you keep in mind that you probably had a reason for wanting to go to the definition, the Ctrl-click workflow saves you an instance of moving between the keyboard and mouse.

udondan
  • 57,263
  • 20
  • 190
  • 175
Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
  • 1
    Eclipse has it (besides ctrl+click) on F3, which is on left-hand, i.e. not-mouse-hand (unless you're a leftie). – Kos Dec 20 '11 at 10:53
15

Visual Assist supports Ctrl+Click as of June 2009 (build 1727). Activate Ctrl+LeftClick in VA Options | Advanced | General. (See the comment below.)

udondan
  • 57,263
  • 20
  • 190
  • 175
sean e
  • 11,792
  • 3
  • 44
  • 56
5

If you have Visual Studio 2010 you can use "Go To Definition" by Noah Richards.

http://visualstudiogallery.msdn.microsoft.com/en-us/4b286b9c-4dd5-416b-b143-e31d36dc622b

mhenry1384
  • 7,538
  • 5
  • 55
  • 74
3

I use the built in options (F12, Right-click -> Go to definition) but I know a lot of the guys at my company use Resharper and it definitely has this functionality.

udondan
  • 57,263
  • 20
  • 190
  • 175
Danny Tuppeny
  • 40,147
  • 24
  • 151
  • 275
3

oh man, just install resharper!! (vs plugin) with it installed you just go and Ctrl + click to go to definition.

this is not the only thing resharper does, try it out free!!!

udondan
  • 57,263
  • 20
  • 190
  • 175
Diego
  • 69
  • 2
3

Microsoft released a Visual Studio 2010 extension named "Productivity Power Tools" which now adds Ctrl+Click functionality. So if you're like me, and hate installing third-party addons, you can now have the same functionality!

udondan
  • 57,263
  • 20
  • 190
  • 175
Danny Tuppeny
  • 40,147
  • 24
  • 151
  • 275
2

Another option with VS (besides F12 and right-click > Go to Def) is add the code definition pane (View > Code Def Window). This is essentially another editing pane that shows the code for the current symbol - no need to Ctrl-click or anything. I keep it pinned to my secondary monitor. Any time I need to see the implementation for a symbol I just click it and look over.

Another nice thing about F12 is you can also do ShiftF12 to find references to a symbol and F8 through them. The two go together like love and happiness.

udondan
  • 57,263
  • 20
  • 190
  • 175
Justin R.
  • 23,435
  • 23
  • 108
  • 157
0

All in all, both VS and Eclipse have weird key shortcuts. I just had to respond, too: F12 is far too right on the keyboard and you have to leave the the mouse right hand for the keyboard to use it. As a long time VS user I just didn't find it until I searched for the Ctrl+Mouse equivalent in Eclipse. It's completely borked. OK? No need to argue. (The same goes for F3 in Eclipse going for definition. ???? Why the face??? It's FIND NEXT for Pete's sake. But this can be removed after mastering the Eclipse keyboard shortcut system in the course of a few years.)

Anyway, as has been said here before, Microsoft has already understood this can be an issue for new programmers coming in from Eclipse, so they provided the Power Tools (I followed the link up above).

http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef/

udondan
  • 57,263
  • 20
  • 190
  • 175
david
  • 9
  • 1
0

I prefer to bind Go To Definition to CtrlD. This makes it extremely easy to use either with both hands on the keyboard (CtrlD to go tho the definition of the symbol under the cursor) or one hand on the keyboard and one hand on the mouse (Click on a symbol, then CtrlD).

udondan
  • 57,263
  • 20
  • 190
  • 175
Marty
  • 7,464
  • 1
  • 31
  • 52
0

If you are using Visual Studio 2017, you can use Productivity Power Tools 2017

Akbaritabar
  • 1,285
  • 1
  • 9
  • 8
-1

I don't work in VS much, so I haven't used it, but I've heard incredibly good things about Resharper from everyone I know who does. Everyone has told me it's worth every penny, and significantly improves efficiency in Visual Studio. I think it has a feature like what you're looking for, along with a TON of others.

Herms
  • 37,540
  • 12
  • 78
  • 101