In Visual Studio 2008, how can I make control+click do a "Go To Definition"? - visual-studio

In the Delphi IDE, 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:
SetTitleMatchMode RegEx
#IfWinActive, .* - Microsoft Visual Studio
^LButton::Send {click}{f12}

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.

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.

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.

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

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.

Yes, both Resharper (a must have!) and Productivity Power Tools have this feature.
Interesting quirk, though.
If you just go with the defaults on both tools (if you install both tools) you can experience a frequent double-jump problem (jump to definition from where you first click and then jump again from what your cursor is above upon getting to that first definition) until you turn off one of the Ctrl-Click features of these add-ons.

Put the mouse cursor on the method name or any identifier, and press F12

Related

Visual Studio Community 2022 inline hints shortcut

What is the inline hints on/off shortcut in visual studio 2022?
I checked these checkboxes and it works but the shortcut Alt+F1 not work. (Visual Studio Community 2022 (64-bit) - Preview
Version 17.2.0 Preview 2.1)
I found your question because I was having the same issue. I think I've figured out what's going on.
Are you coding in C# or C/C++ ?
If you're doing C#, HOLDING DOWN the alt-F1 keys will TEMPORARILY show ALL the types of hints available; i.e. those you haven't told it to show all the time. When you release alt-F1 the 'extra' hints will disappear. If, as in your image, you've chosen to show almost everything all the time, holding down alt-F1 probably won't display anything different. (try diabling some of the stuff below the first line and see if there's a difference when you hold down alt-F1)
On my system it reacts rather slowly; if you just tap quickly you might not see any change.
(if that doesn't work, you might want to check to see if any extensions you're using are overriding the alt-F1 shortcut)
If you're using C/C++ the inline hints works a bit differently. Here alt-F1 or ctrl-ctrl can TOGGLE hints.
The options settings for C/C++ are located in "Text Editor/ C/C++ / IntelliSense", and the list of inline hint settings are quite a bit more limited than those listed for C#.
On vanilla Visual Studio 2022 press ctrl twice.
If you are using Visual Assist press Alt + F1

Visual Studio code completion like ctrl+k in netbeans?

My question is there code completion for Visual studio like in Netbeans where you cycle the buffer with ctrl+k, when you type something?
There's now a nice extension called Simple Autocomplete which adds one command simpleAutocomplete.next that you can map to a shortcut of your choice.
No, there isn't a similar feature in Visual Studio.
The traditional Visual Studio autocomplete is using intellisense.
When you start typing, intellisense may bring up a drop down with suggestions. In that case you can tab to complete using the current suggestion or use the arrow keys to choose another.
Ctrl-Space (or Alt-Right arrow) will bring up this intellisense menu if it's not up.
I find it does a pretty good job overall.
Some extensions like Resharper or Visual Assist offer their own code completion or other similar features (like Suggestion List for Visual Assist).
I know it's been ages since I asked this question but I found the next best thing to do this. What I would suggest is to use VsVim extension and to use Vim's anyword completion; however, in order for this work, what must be resolved is the keyboard shortcuts that conflict:
Go to "Tools options" in Visual Studio.
Then go to VsVim category(alternatively you can search "VsVim" and
should bring the options) and click keyboard.
As far as I know vim deals with this type of completion with these keys
CTRL+P and CTRL+N so what we do is to let Visual Studio give up
these keybindings and let VsVim deal with it by Selecting from the drop
down of the keys(CTRL+P and CTRL+N) and let it be "Handled by VsVim".
I hope this has helped someone out.

Is there a way to "bind" my Mouse4 button to "Navigate Backwards" in visual studio?

The title pretty much explains the whole question. I'm using Visual Studio 2010 Premium, I like the Navigate Backward command for when I right click on something and do go to definition and then I want to go back to where I was Navigate Backward works. But I'm so used to my mouse button button doing that, I've noticed I've starting using it in Visual Studio and expecting it to go back but it doesn't. I know how to change the command to a different key press, but is there a way to make it work on a mouse button?
This seems to be a (pointless) Limitation of the C++ IDE in Visual Studio. In C# the mouse buttons work as expected, but not in C++.
There are several Addins for Visual Studio to cover this functionality, I'll point you to the one that I found in this answer:
http://www.codeproject.com/Articles/57119/Forward-Backward-Code-Navigation-with-the-Mouse-Th
This Add-In worked for me. I could also upgrade it to Visual Studio 2012 by simply changing the Version-Tag in the Addin-file to "11.0".

Coderush express seems doesn't work

I installed Coderush express and I can see that it is installed. (I can see that Camel Case Navigation works). But I can see any other feature works. Based on this page: http://community.devexpress.com/blogs/markmiller/archive/2009/06/25/coderush-xpress-for-c-and-visual-basic-2008.aspx
I cannot see any of these feature to works:
Tab to Next Reference : no effect when I put caret on a variable and press tab ( a tab inserted at the middle of my variable name!)
Highlight All References: pressing ctrl+alt +u add a ascii character to source code.
Quick Navigation: Ctrl +Shift + Q has no effect.
Quick File Navigation : Ctrl +Alt +F brings up F# interactive
Selection Increase and Selection Reduce doesn't work: generate a beep
Declare: ctrl +` has no effect.
and ...
Any idea why this is happening? I am using VS2010.
Presumably due to your using a different version of Visual Studio.
The page you linked to is pretty clear about it being for Visual Studio 2008, but you've included the visual-studio-2010 tag.
CodeRush Xpress fully supports all language features of Visual Basic and C# in Visual Studio 2008.
Edit
Version of Visual Studio wasn't the problem after all.
It appears to just be that the tool makes very little visible change to the Visual Studio user interface, so it looks like it hasn't loaded.
It seems that your installation is corrupt. I would recommend you contact DevExpress Support directly. The support team is better equipped to resolve any issues you face with their products. They offer a very short response time and high qualification. I would also recommend that you reinstall the product.
The features you are asking about, were removed on purpose from VS2010 version of Coderush XPress. More info here:
Experience with Coderush XPress and Visual Studio 2010?

Navigating backward and forward with the mouse in Visual Studio 2008

My install of Visual Studio 2008 does not support IE style back and forward navigation withe the mouse in the C# code editor.
Searches show that multiple people have run into this problem but I have yet to find a correct solution.
There's even a VS add-in hack just to work around the "bug".
Any idea why this functionality fails for some users and how to fix it?
You can mitigate the problem by AutoHotKey tool (free, open source).
Let's assume your Visual Studio 2008 has these editor commands and their respective shortcuts:
View.NavigateBackward = Ctrl+-
View.NavigateForward = Ctrl+Shift+-
You should be able to verify these shortcuts in keyboard options. Verified? Let's proceed.
So will you be just fine if your mouse will send these keyboard shortcuts if the Visual Studio's main window is active?
Then install the tool and add the following two mappings:
XButton1::^-
XButton2::^+-
These correspond to above keyboard shortcuts: ^ = Ctrl, + = Shift, - = -
Using AutoHotKey icon in notification area, reload definition file you just updated. Now your mouse buttons should produce the above shortcuts. Test them.
If they work for you in Visual Studio editor, you can limit them only to Visual Studio main window, otherwise they work across the entire desktop:
SetTitleMatchMode, RegEx
#IfWinActive, .*- Microsoft Visual Studio
XButton1::^-
XButton2::^+-
#IfWinActive
Feel free to adjust title-matching regex if needed.
Do not forget to reload definitions file to apply any changes you made.
Bonus:
And here are some other handy operations if you are holding Shift or Ctrl:
(You have those mouse buttons, let's use them... for commands across the entire desktop.)
+XButton1::^c
+XButton2::^v
^XButton1::^x
^XButton2::^z
(Letters must be lowercase, because uppercase means Shift+letter.)
(And always make sure you are running AHK elevated (as administrator.))
Enjoy!
Visual Studio 2008 is an editor and the apps built in it can also be built in any later version such as Visual Studio 2015. Not trying to be flippant, but the fix is to move to a later version of Studio. If money is a factor look into the Community version. (See Free Dev Tools - Visual Studio Community 2015)

Resources