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?
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).
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.
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.
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!
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
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.
Is the extension working in visual studio express 2012?
I use it in visual studio professional 2010 and I can't live without it!
I am trying vs express 2012, but i am not able to install gtDef, it says it's already install for all possible products...
Thanks and keep up the good work!
You can use this short autohotkey script to do this with middle mouse button. Just store this code as .ahk file and run it.
#IfWinActive, Microsoft Visual Studio Express
Hi, it seems I have found some kind of conflict with another extension: "Highlight all occurrences of selected word" (http://visualstudiogallery.msdn.microsoft.com/4b92b6ad-f563-4705-8f7b-7f85ba3cc6bb)
The extension highlights all occurrences of a selected word in the current document. My usual use case is to double-click an identifier, look at it's highlighted occurrences in the current context and then ctrl+click it to go to the definition. When I disable that highlighting extension I can navigate using ctrl+click, otherwise I get the highlighting on ctrl+click.
It is reproducible on a tiny snippet like this:
int main(int , char**)
int myint = 5;
std::cin >> myint;
myint += 1;
std::cout << myint;
I am using VS 2010 and the 2.4 version of your extension.
Could you suggest any workaround?
To be fair, I've never tested this with VS2012 (I've never used VS2012). If the classification of method names has been changed, it would stop the extension from working. It currently only matches:
if (name.Contains("identifier") || name.Contains("user types"))
If you (or anyone else) can let me know what the name is, I can add it to that list pretty easily.
I don't know an answer to your other question. Would you be able to download a trial version of VS 2012 and get the information you need?
Alternatively, could you guide me into obtaining an answer for you?
I'm not sure I remember what it is supposed to do in HTML.
If you click on something that isn't underlined but you think should be, and you press F12 (or whatever Go To Definition is bound to), does it navigate someplace? If you have the extension installed, you can do the same by ctrl-clicking, even if it isn't underlined, if that helps.
Got it. I have filed a bug report about this: https://connect.microsoft.com/VisualStudio/feedback/details/772443/pressing-f12-doesnt-take-users-to-css-definitions-based-on-ids-of-html-elements. I hope other could reproduce it, click on the "I can too" link there and also vote for the bug.
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!
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:
Guid cmdGroup = VSConstants.GUID_VSStandardCommandSet97;
int hr = _commandTarget.Exec(ref cmdGroup,
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">
7. Zip all the files (GoToDef.zip)
8. Rename the GoToDef.zip to GoToDef.vsix
9. Install the vsix
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
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.
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:
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 :)