shoosh
shoosh

Reputation: 78934

Eclipse's Ctrl+click in Visual Studio?

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?

Upvotes: 109

Views: 39332

Answers (13)

Akbaritabar
Akbaritabar

Reputation: 1414

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

Upvotes: 0

Se Song
Se Song

Reputation: 1663

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

Upvotes: 52

david
david

Reputation: 9

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/

Upvotes: 0

Marty
Marty

Reputation: 7522

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).

Upvotes: 0

Danny Tuppeny
Danny Tuppeny

Reputation: 42343

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!

Upvotes: 3

Danny Tuppeny
Danny Tuppeny

Reputation: 42343

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.

Upvotes: 3

Diego
Diego

Reputation: 69

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!!!

Upvotes: 3

sean e
sean e

Reputation: 11925

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

Upvotes: 15

Joel Coehoorn
Joel Coehoorn

Reputation: 415800

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.

Upvotes: 34

Justin R.
Justin R.

Reputation: 24031

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.

Upvotes: 2

mhenry1384
mhenry1384

Reputation: 7688

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

Upvotes: 5

splintor
splintor

Reputation: 10154

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

Upvotes: 67

Herms
Herms

Reputation: 38798

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.

Upvotes: -1

Related Questions