views:

2151

answers:

7

I know this is not strictly about programming, but it's pretty close.

Anyway, in Delphi, you can hold control and click on a method to jump to its definition. In VS2008, you have to right-click and select "Go To Definition".

I use this function quite often, so I'd really like to get VS to behave like delphi in this regard - its so much quicker to ctrl+click.

I don't think there's a way to get this working in base VS2008 - am I wrong? Or maybe there's a plugin I could use?

Edit: Click then F12 does work - but isn't really a good solution for me.. It's still way slower than ctrl+click. I might try AutoHotkey, since I'm already running it for something else.

Edit: AutoHotkey worked for me. Here's my script (I'm a complete n00b, so it's probably suboptimal):

SetTitleMatchMode RegEx
#IfWinActive, .* - Microsoft Visual Studio
^LButton::Send {click}{f12}
+2  A: 

Highlight the method name and press f12

RWendi
For the record, you don't have to highlight it, just the cursor has to be in it.
Matt Greer
+3  A: 

Visual Studio 2008 defaults this to F12, but you can set it in Tools | Options | Environment | Keyboard, and change Edit.GoToDefinition - however, I'm not sure how you can get it to CTRL+mouseclick.

Raithlin
+3  A: 

Resharper does that but it's not free. Highly recommended plugin though, most experienced .NET developers use it.

Catalin DICU
Might try it.. If it's good, I'll see if I can get work to pay for it :P
Blorgbeard
"most experienced developers use it" ??? or just the ones who do .net development?
shoosh
The ones who use .net
scottschulthess
A: 

Sorry thought you're simply looking for a go to definition function in VS... For your question though, possibly you can create a macro for that...

RWendi
No offense intended, but generally if you don't know the answer, don't leave a speculative one.
Matt Greer
+4  A: 

You could create an Autohotkey script that does that. When you ctrl-click a word, send a doubleclick then a F12.

I don't have AHK handy so I can't try and sketch some code but it should be pretty easy; the AHK recorder should have enough features to let you create it in a point 'n' click fashion and IIRC it is smart enough to let you limit this behaviour to windows of a certain class only.

When you have your script ready just run the script in the background while you code. It takes just an icon in the Notify bar.

badp
+1  A: 

Just a quick note that the following AutoHotkey script works for me in Visual C++ 2010 Express.

SetTitleMatchMode 2
#IfWinActive, Microsoft Visual C++ 2010 Express
^LButton::Send {click}{f12}

I also changed the shortcuts for View.NavigateForward and View.NavigateBackward to Alt+Right/Left Arrow since I am used to Eclipse.

Tianhao Qiu
+2  A: 

Not for Visual Studio 2008, but if you upgrade to Visual Studio 2010, you can use the free Visual Studio 2010 Pro Power Tools from Microsoft to achieve this.

splintor