Go To Definition

Free

Make ctrl+click perform a "Go To Definition" on the identifier under the cursor. Also, when the ctrl key is held down, highlight identifiers that look like they have definitions to navigate to.

(59) Review
Visual Studio
2013, 2012, 2010
Download (113,803)
11/10/2013
2.5
View
E-mail Twitter del.icio.us Digg Facebook
Add to favorites
Description
Reviews (59)
Q and A (26)
Sign in to write a review
Sort by:

by stabilopro | at 6:08 AM

by Jamie Collins | February 28 2014

A fantastic extension I've been using since VSS 2010 and have just installed VSS 2013.

In common with @a5Digital, I too would like a way of navigating 'Peek Definition' but wonder whether this functionality is exposed by the API. There is no mention of 'peek' in the docs for VSConstants.VSStd97CmdID (http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.vsconstants.vsstd97cmdid.aspx). So it doesn't seem possible - or am I missing something?

Noah Richards March 01 2014
| Edit |
Delete

It wouldn't be in the "97" set, since that was for VS 97, so waaaay too old :) Check the values in the vsstd12cmdid section, which has peek definition + peek navigate (http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.vsconstants.vsstd12cmdid.aspx).

by zjacobs | February 25 2014

I wish this worked. Using VS2013 and GTD 2.5. I ctrl+click doesn't do anything. Ctrl+hover and the identifier turns into a hyperlink but when I click nothing happens.

Noah Richards February 25 2014
| Edit |
Delete

That's unfortunate. Can you point me (a comment in Q&A) at what GTD 2.5 is? It must somehow conflict with how the mouse event is handled, but I'm not sure how.

by Oleg V. Korzhukov | February 18 2014

Most useful extension I ever installed to VS

by Batu Ozk | January 15 2014

by iphilsy | January 03 2014

Thank you thank you thank you. Works great. You turned my frown upside-down!

by ITSTH | November 28 2013

For me it's the best plugin ever for visual studio. It's the fastest way of navigating. Just one suggestion: I think it would be nice if Ctrl+RightClick on a keyword triggered the search for references of a function.

by denis_stankovski | November 21 2013

Thank you so much!

by a5Digital | November 13 2013

I agree with most of these reviews - this extension is a must. However I there is so much more potential here which would leave me baffled if the author doesn't explore the possibility of augmenting this:

a) allow for another key combo + left click perform a peek definition
b) allow for another key combo + left click perform a find all references

If these are exposed via the API (and I believe they are), adding these features should be fairly trivial.

Noah Richards November 14 2013
| Edit |
Delete

Sending a different command would be pretty easy to add, yup. If you want it to be configurable, that's more difficult, but just hardcoding combinations wouldn't be bad.

If you're curious about implementing it yourself, the source is here: https://github.com/noahric/gotodef. The actual command logic is in DispatchGoToDef in GoToDefMouseHandler.cs, so you could probably modify that function (or add new functions) for peek or find all references. Since the extension is still built to be compatible with VS2010, you'd want to hardcode the cmdset/cmdid for peek definition and do a version check first, though.

If you have any questions, let me know on the Q&A!

by Daniel Joos | October 21 2013

Works with VS 2013. It just requires some manual work:
1. Download the .vsix file
2. Unzip it (e.g. using 7zip)
3. Open the vsixmanifest file and add the following block to line 22
<VisualStudio Version="12.0">
<Edition>Pro</Edition>
</VisualStudio>
4. Save and Zip all files again
5. Rename the .zip to .vsix and install it

Noah Richards November 10 2013
| Edit |
Delete

2.5 should now support VS2013. Let me know if you run into any issues, thanks!

by maxima | October 21 2013

+1 VS2013
--------------------------
I use this from day one and is most helpful tool ever... But I have a request (I am amazed that nobody made it yet).

Could you please add Ctrl-Shift-Click to invoke VS Find All References command.

That will make your tool best for ever!! :)

Noah Richards November 10 2013
| Edit |
Delete

2.5 should now support VS2013. Ctrl-shift-click doesn't do find all, but it is now ignored (per another user's request).

by Jan Mazur | October 19 2013

+1 for the VS2013 support

Noah Richards November 10 2013
| Edit |
Delete

2.5 should now support VS2013. Let me know if you run into any issues, thanks!

by Kurt Dowswell | October 18 2013

Please add VS 2013 support! Love this extension. Use it countless times per day :)

Noah Richards November 10 2013
| Edit |
Delete

2.5 should now support VS2013. Let me know if you run into any issues, thanks!

by f00nth | October 04 2013

by Gameme | September 23 2013

Its awesome to get a navigation style similar to source insight. I love it.

by Stefanos Anastasiou | August 24 2013

This plugin is using a hack, which makes it unusable with DSLs.

The plugin, uses the following export type:

[ContentType("code")]

And in addition it tries to highlight and subsequently find symbol definitions, for every classification span which happens to have the following characters in them

if ((name.Contains("identifier") || name.Contains("user types")) &&
SetHighlightSpan(classification.Span))
{
updated = true;
return true;
}

i.e. "identifier", "user types"

I know of no language, which doesn't have an "identifier". So it is very probable that any DSL will not work with the plugin.

The funny thing is, that the plugin somehow managed to creep into power productivity tools 2012, and since everyone uses those, they also use the plugin.

We had to change our DSL in order to continue using the plugin..

The plugin should only support only languages which do support this feature natively, than trying to invoke "find symbol definitions" for all languages which happen to export an "identifier" token.

Noah Richards August 24 2013
| Edit |
Delete

Sadly, there wasn't a non-hacky way to implement the extension, and there's no way to determine which languages "support this feature natively". Since Go To Definition wasn't designed as a queryable command, the extension had to use some broad guessing at what has definitions, and it actually under guesses for certain scenarios (I remember one or two in VB, at least).

I'd be happy to at least modify this standalone version to avoid loading for documents that use your DSL language type and you could file a Connect bug to get it integrated back into the PPT extension . Fee free to either add a Q&A comment here or a github bug (https://github.com/noahric/gotodef/issues) with the details, or make the modifications yourself and send me a pull request on github.

by Code Buddha | August 07 2013

This made my day. You're awesome. Thanks!

by uonun | August 04 2013

by Petr Škaloud | May 15 2013

Exactly what I need :) Thanks a lot, it is great job.

by lioncall | December 22 2012

Great...thank you.

Having the option to open in Preview Tab would be wonderful!

1 - 20 of 59 Items   
Sign in to start a discussion


  • Bug in implementation wich conflicts with word selection
    2 Posts | Last post October 29, 2012
    • Hi, 
      
      I believe there is a bug in implementation which causes this extension to conflict with word select functionality of the editor - i.e. when CTRL is pressed, mouse selection is automatically extended to words. I guess operator "&&" should be replaced by "||" in this method
      
              private bool InDragOperation(Point anchorPoint, Point currentPoint)
              {
                  // If the mouse up is more than a drag away from the mouse down, this is a drag
                  return Math.Abs(anchorPoint.X - currentPoint.X) >= SystemParameters.MinimumHorizontalDragDistance &&
                         Math.Abs(anchorPoint.Y - currentPoint.Y) >= SystemParameters.MinimumVerticalDragDistance;
              }
      
      i.e. current code detects only 'diagonal' drags, but it should work if drag is done along X or Y axis too.
      
      Thanks for this extension, BTW :).
      
    • Looks like a bug indeed :) Funny thing is that I'm pretty sure that code looks nearly identical to the drag/drop mouse handler built in to VS. I'll update the code shortly (and the extension at some point after that; that may take a little while). Thanks!
      
      -Noah
  • Go To Implementation?
    2 Posts | Last post September 28, 2012
    • I am using Resharper, which provides Go To Implementation in the context menu, which is very useful, as we use interfaces heavily.
      
      I'd love to be able to override the Ctrl+Click behaviour to go to the implementation instead, which is far more common usage than going to the interface.  I suspect you might not be able to pull it off though if it's only built into Resharper?
    • Assuming they register it as a command, you could modify the extension to call that command in DispatchGoToDef:
      https://github.com/NoahRic/GoToDef/blob/master/GoToDefMouseHandler.cs#L340
      
              bool DispatchGoToDef()
              {
                  Guid cmdGroup = VSConstants.GUID_VSStandardCommandSet97;
                  int hr = _commandTarget.Exec(ref cmdGroup,
                                               (uint)VSConstants.VSStd97CmdID.GotoDefn,
                                               (uint)OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT,
                                               System.IntPtr.Zero,
                                               System.IntPtr.Zero);
                  return ErrorHandler.Succeeded(hr);
              }
  • Please rebuild to also target Visual Studio 11 Beta
    2 Posts | Last post April 26, 2012
    • Some of the Productivity Power Tools extension for VS2010 are already included in VS11, but Ctrl+Click is not one of them.
      
      How hard would it be for you to have your "Go To Definition" extension also target VS11 Beta?
    • You can do it yourself.
      1. Download this extension.
      2. Rename GoToDef.vsix to GoToDef.zip
      3. Extract all the files in GoToDef.zip
      4. Open up the extension.vsixmanifest
      5. Change the <VisualStudio Version="10.0"> to <VisualStudio Version="11.0">
      6. Save
      7. Zip all the files (GoToDef.zip)
      8. Rename the GoToDef.zip to GoToDef.vsix
      9. Install the vsix
      10. Enjoy
  • Please add option to address Go To Definition to Object Browser instead of metadata
    2 Posts | Last post January 29, 2012
    • SEE:
      http://connect.microsoft.com/VisualStudio/feedback/details/667889/allow-addressing-go-to-definition-to-object-browser-rather-than-metadata#tabs
    • Overriding the GoToDefinition command behavior is orthogonal to this extension. If you want an example of how to write a command handler, take a look at the FixCtrlBackspace source here: https://github.com/NoahRic/Random/blob/master/FixCtrlBackspace.cs
  • Similar Navigate for custom control onclick
    1 Posts | Last post December 30, 2011
    • This is a great tool!  If I have a custom server control with a onclick event.  How can I add this functionality to my custom control to jump to subroutine?  Thanks.
      Brent
  • Navigate to previous statement
    3 Posts | Last post December 25, 2011
    • When press Ctrl + Click, this will jump to the method's definition, this is very helpful.
      
      I am very appreciate if you can add "Jump back" function to this addin (like Shift + click method's name).
      
      Thanks in advance.
    • View.NavigateBackward should do the trick. It'll be bound to Ctrl+- (ctrl minus) by default, or your mouse's back button, if it has one.
      
      -Noah
    • This is a great tool!  If I have a custom server control with a onclick event.  How can I add this functionality to my custom control?  Thanks.
  • combination Shift + Click
    2 Posts | Last post March 24, 2011
    • It would be very useful if you use a combination of Shift + Click
    • Yeah, that is feedback I've heard before :)  I'm not really open to the idea of changing the default, but I am open (in principle) to adding an option to change the modifier.  That's a large enough bit of work that I haven't gotten around to it yet, though, and probably won't in the near future.
      
      Your best bet is to build the extension yourself.  You can grab the source on:
      
      http://github.com/noahric/GoToDef
      
      You'll want to modify GoToDefMouseHandler.cs to replace the two instances of ModifierKeys.Control with ModifierKeys.Shift. That *should* be all that's needed, though there very well may be issues you run into with the new shortcut conflicting with other mouse gestures.
      
      (Also, to build the extension, you'll need the VS2010 SDK installed).
      
      If you try to build it yourself and have any issues, let me know.  I'll try to help as best I can :)
      
      Thanks,
      -Noah
  • About the modifier
    4 Posts | Last post October 21, 2010
    • Is there any method to set the modifier which trigger the go-to-definition feature?
      
      I am used to hold the Ctrl to select multiple words as a whole. This behavior conflicts with the functionality of this extension.
      
      A selection check before triggering is fine for me.
    • Thanks Mason, that's an item to put on the backlog.  I'm mulling over how to expose it, as putting a single options page somewhere in Tools->Options just to select some combination of alt/ctrl/shift seems overkill, but there isn't really another common location to put that option.  If you have any ideas, that would be helpful, too :)
      
      -Noah
    • Hi Noah,
      
      I would really like to use this extension but I do not want to "sacrifice" my Ctrl DblClick. 
      
      The trigger customization is something that I consider as an enormous benefit for this expansion. I am even absolutely fine with specifying the trigger key manually in the .config file.
      
      Cheers 
    • Hey taras_b,
      
      Do you use ctrl-click or just double-click?  They do the same thing, and this extension (should) only affect the former.  If you are used to double-clicking to select a word, then you just need to un-train yourself to hold down control when you do it.
      
      I'll keep the .config option in mind.  Also, if you are up for it, you could try grabbing the source (http://github.com/NoahRic/GoToDef) to change it yourself.  It's unfortunately not well factored to make it a completely trivial change, but it should be about as easy as replacing all instances of ModifierKeys.Control with ModifierKeys.Alt.
      
      Thanks,
      -Noah
  • New version 2.2
    10 Posts | Last post July 02, 2010
    • Version 2.1 worked better for me. The new version does not react as I aspect. Clicking first Ctrl and then perform a mouse click does not work any more.. Now it reacts sometimes if a perform a mouse click first and then press ctrl. Is there a possibilty to get the version 2.1.
      
      Thanks,
      Chris
    • Hey Chris, I'm not quite sure what you mean :(  I generally use it by holding down the ctrl key and then clicking, which is what it sounds like you are saying doesn't work.  Could you give me a bit more information on what isn't working?
      
      To get version 2.1, you can download the source at that point (http://github.com/NoahRic/GoToDef/zipball/2.1) and build it yourself, once you've downloaded the SDK.
      
      Thanks!
      -Noah
    • Hi Noah,
      exactly that is what doesn't work. I'll give you some scenarios and what then is happen.
      
      1. Holding down ctrl and then moving the mouse to the word --> Nothing is happen
      
      2. Moving first to the word then holding down ctrl --> Color of the word is changing and the word is underlined, mouse pointer is sometimes changed
      
      3. Moving the mouse after 2. --> Mouse pointer is rechanged and will never changed back, word is sometimes still blue and underlined
      
      4. Clicking after 2. --> Nothing is happen
      
      5. Moving first to the word then clicking and holding the mouse button down and then holding the ctrl key and finally release the mouse button --> Performs as I expected on 4.
      
      
      Since version 2.1 works fine for me, I will use this version again.
      
      Thanks,
      Chris
      
    • Do you have any other extensions installed (like the pro power tools)?  It's possible there could be something conflicting there.  I still can't repro it, so there isn't much I can do to fix it for you, sorry :(
      
      -Noah
    • No problem.
      
      There are some other extensions in the extension manager:
      - DevExpress Tools
      - Enterprise Library v5 Configuration Editor
      - Go To Definition
      - Highlight all occurrences of selected word
      - PowerCommands for Visual Studio 2010
      - Regex Editor
      - Visual Studio 2010 Pro Power Tools
      
      But I find a solution so I'm happy again :-)
      
      - Chris
    • Hi Noah,
      finally I checked all extensions. Disabling 'Highlight all occurrences of selected word' let the problems disappear. But version 2.1 also fixes the problems ;-)
      
      Best regards
      Chris
      
    • Ah, I think I can repro it now.  I'll see if I can figure out what's causing the issues.
      
      Thanks!
      -Noah
    • Hey Chris, can you try out v2.3?  Let me know if it fixes the bugs you were seeing.
      
      Thanks!
      -Noah
    • Hi Noah,
      v2.3 does not solve the problem unfortunately.
      
      - Chris
    • I'm not sure what else it is, then :-/  It could be an interaction with the DX tools or Nick's highlight references extension (I didn't realize earlier that you had that extension installed; when I saw "highlight references", I assumed the built-in feature).  Unfortunately, the only ones I have source for are the pro tools (since it is a copy of this extension) and the regex editor.  While the regex editor's implementation of mouse handling is suspicious, it shouldn't be causing a problem except on lines that have "new Regex(".
      
      Sorry :(
      -Noah
  • [Suggestion] Drag-drop compatibility
    17 Posts | Last post June 22, 2010
    • By default Ctrl + drag mapped to text copy. The extension overrides this behavior. Please, fix it (at least add an option "do not navigate if click on selected text").
    • Hey Sinix,
      
      To get around it, you can select the word, start the drag operation, and *then* hit control before you let go of the mouse button when you drop.  Let me know if that works for you.
      
      -Noah
    • Noah, this is workaround and it decreases usability of the extension. Try copy with mouse hyperlink 
      in winword. It's the right behavior. Need to change your mind every time new extension appears is wrong. 
      
      The fix I've suggested (just do not navigate on click on selection) is simple. Why not implement it?
    • The fixes you suggested are not simple in this context, unfortunately.  I may try moving the logic back to handling mouse up events and deal with the other issues that crop up (as the extension worked when I first wrote it), but it isn't a simple change.  In the editor, mouse interaction is handled in a decentralized and often hard-to-debug manner, which is what makes this complicated in the first place.
      
      If you'd like, you can download the source and make the change on a private version of the extension you are running; the source can be found on github here: http://github.com/noahric/gotodef.  If it really is as simple as you say, it should be easy for you to fix.
      
      In the meantime, if I get some time this weekend I'll take a look at fixing this.
      
      Thanks!
      -Noah
       
    • Sorry, forgot to add: the hard part of the fixes you mentioned ("fix it", and "add an option") are the mouse interaction for the first part (as I describe in my previous post) and adding an option page (involves adding a package   options page   some hackery for WPF options pages).  Just changing it to not navigate when clicking on the selection wouldn't be difficult, but I don't think that's the right default behavior.  However, it should be pretty easy to make that change in a private copy and run that on your own machine.
      
      Thanks!
      -Noah
    • May be it'll best to align with all links/buttons behavior and navigate on mouse up.
      However, there is cludge (done in 5 mins; not debugged yet but seems to work). 
      
      Just one line:
      //  Now, check for valid classification type.  C# and C   (at least) classify the things we are interested
      // in as either "identifier" or "user types" (though "identifier" will yield some false positives).  VB, unfortunately,
      // doesn't classify identifiers.
      foreach (var classification in _aggregator.GetClassificationSpans(extent.Span))
      {
        var name = classification.ClassificationType.Classification.ToLower();
        if ((name.Contains("identifier") || name.Contains("user types")) 
    • Sorry, text seems to be trimmed.
      
      if ((name.Contains("identifier") || name.Contains("user types")) 
    • hmm.. Ok. Just added this exactly after last if (delete other posts if possible, please).
      if (!_view.Selection.SelectedSpans.Contains(classification.Span))
    • Yeah, as I said in my last post, though, I don't want to make that change by default ("Just changing it to not navigate when clicking on the selection wouldn't be difficult, but I don't think that's the right default behavior.")  The hard part is fixing it without introducing that behavior or introducing that behavior as an option.
      
      Thanks!
      -Noah
    • Agreed.
    • Second this one.
    • How about just using a shift/click as an option?
    • Bob, the right design is to align behavior with common rule: buttons and links are clicked on mouse up. After that, it's quite simple to ensure that mouse moved out of drag-drop threshold and do not navigate.
    • Here is what I get when the extension is installed:
      
      Highlight the element.
      Hold control key down (underlines).
      Mouse-down on the highlighted/underlined text.
      Goes right to definition (does not wait for mouse up).
      
      When the extension is not installed, BTW, I am not able to copy drag anyway.  Holding the control key down simply extends the highlighting when the mouse is clicked and dragged.  Is this a bug or a "feature" in 2010???
      
      Thx.
    • Bob, when I said "the right design..." i meant "how things should be done". Sorry if mislead you.
      
      Confirmed - when extension disabled or uninstalled, ctrl should be pressed after mouse key. "Feature", I think.
    • Oh, silly me.  I didn't realize that the decades-old convention on copy/drag had been changed in VS2010.
      
      Thx,
      Bob
    • Bob - it didn't change in VS2010, though this extension conflicted with it.
      
      Bob and Sinix - could you guys give 2.2 a try, if you are still interested in using the extension?  I've updated it to work with mouse up and worked around some of the original issues I ran into, so this should now work more sensibly with word selection and drag/drop.
      
      Thanks!
      -Noah
11 - 20 of 26 Items