visual studio 2010 - jumping to method definition with the mouse - visual-studio-2010

Moving from years of work on intellij to VS2010 (with resharper ) I cant stop clicking the mouse scroll wheel in order to jump to function or variable definition (as in intellij or F12) only to find that this feature does not exist.
Is there a way to set this feature ?
Is there a diffent way to do it with the mouse ?
Thanks.
EDIT - Thanks guys - but I wanted to set the mouse scroll press

F12 will go to definition. Power productivity tools comes with a ctrl+click to go to definition.
Power productivity tools: http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef

or F12 ------------------------------------

Right Click the variable and you will have an option to see definition:-

if you're really adamant about it, you can check here http://www.codeproject.com/Articles/25369/Forward-Backward-navigation-with-the-mouse-thumb-b to put you in the track for a do-it-yourself approach

Related

Is there a keyboard shortcut to move the cursor between methods in Visual Studio 2010?

Is there any keyboard shortcut to move the cursor between methods in Visual Studio? Is there any plugins that can do the same job?
All the time when I program, I want to go at the end of the current method and if I could have a shortcut that can move the cursor at the beginning of the next method and then just have to type a couple of up arrow to be where I want would be fantastic.
Thank you.
Note: For VS <2015, the following works only for the VB.NET code editor. In VS 2015+, apparently the C# code editor is also supported.
While there are no default keyboard bindings to jump between methods, you can set them up yourself:
Go to Tools → Customize…, then Keyboard…, and do the following:
Search for the commands by typing Method in the input line at the top.
Locate the two commands Edit.NextMethod and Edit.PreviousMethod.
For each of these, select the command first, then move the input focus to the input field Press shortcut keys, enter an unassigned key combination, and press the Assign button.
(The screenshot above shows that I have previously assigned one of these commands to Ctrl+Shift+<.)
Hi another (cheaper) alternative might be the CTRL+M+M to collapse/expand the current method to it's definition, allowing you to quickly navigate to the next.
Also CTRL+M+O to collapse all members is useful, with CTRL+M+L to expand all again.
Visual Studio doesn't have such a function, but JetBrains' ReSharper does. At least is the only one that I know of to offer this functionality.
For ReSharper the shortcuts are Alt-Up and Alt-Down, for previous/next member.
Try CTRL + ALT + UP. This first takes you to the scope selector where you can select a class if applicable, then press TAB which takes you to the method selector where you can select a method from the selected scope.
Note I use In Visual Studio 2012, don't know if works in other versions.
Jason Malinowski is right on his comment. It even says the shortcut keys are Ctrl+Down Arrow and Ctrl+Up Arrow. I used to use this all the time in VB6, but when I tried it lately using recent versions of visual studio, it didn't work; it would just scroll the edit window up or down one line.
When I went into Tools -> Options, select "Environment" on the left, and then the subcategory of "Keyboard", then type "Edit.ScrollLineDown" it said Ctrl+Down Arrow. When I removed this shortcut (and the one for ScrollLineUp), the next/previous method shortcuts then worked! I'm personally very happy about this.
Obviously, if you can find the right command, you can customize your keyboard shortcuts any way you please here.
I know this is old, but looks like it was added since.
Try Alt+[ or Alt+]
In Visual Studio 2013 with the commercial Visual Assist expansion you can use ALT+M to open a list with all methods in the current file. Select one, hit ENTER and the cursor will jump to it.
do not forget about the excellent, free DPack extension, which will add Alt+m shortcut which will open a list of all methods in the current class. You can type a search string to filter, and what is also great is if you tab down and enter on a method, and then later do Alt+m again, if you tab into the window you will be on the last method you selected. DPack also has many more features, like bookmarks, but I do find that you have to setup the hotkeys, or more exactly, re-assign hotkeys from other functions to DPack: https://marketplace.visualstudio.com/items?itemName=SergeyM.DPack-16348
Its Ctrl + } - by placing the cursot to end of line - using studio 2015
Same will also bring the cursor back to bottom.
so place the cursor at end of function and press Ctrl + }
In Visual Studio 2015:
Alt + Up or Alt + Down

Disable code window undock in VS2010

I've seen cases where people are asking how to disable on double click.
But i'd like to go one further and disable the feature altogether, does anyone know how to? I don't mean all windows (Properties, Debug, Output) just code windows (Pages, Controls, other files)
I'm using VS2010 SP1 + PowerTools and I keep undocking code windows when selecting the tab if i accidently drag down and it's really frustrating!
Many thanks in advance,
Cheers,
P.
I also don't know any option to disable it, but you can restore the window to its last position by "Ctrl + Double-Click" on the tab's title bar.
Hope it helps.
These are two same question:
Turn off double-click undock in VS2010
How to disable floating tabs in Visual Studio 2010
For anyone who actually wants the answer to this, in my version of Productivity Power Tools (v10.0.20626.18) there is a way to disable this "feature".
Tools->Options->Productivity Power Tools->Document Tab Well->General->Advanced Options...
Under the "Floating Tab Well" group box, uncheck "Enable float on double-click"
http://i.stack.imgur.com/XxODT.png

After "Go to Definition", is there a command to return to where you came from?

If so, is it a stack?
That is, can I:
GoToDefinition
GoTODefinition
GoToDefinition
and then pop back up the call stack?
None of the Edit.GoTo... commands do what I am looking for.
TIA.
You can go to the last place you navigated to by doing CTRL+-
(That's the control key and the "minus" or "dash" key.)
The correct way to navigate this stack is with View.ForwardBrowseContext and View.PopBrowseContext commands. In the default C# schema they are bound to Ctrl+Shift+7 and Ctrl+Shift+8 respectively.
Tip by Brian Sullivan (Ctrl+-) works great.
You also can use a side button on your mouse (if your mouse has a side button and that button programmed for Back functionality in a browser).
If you have an MS mouse with the latest Intellipoint drivers installed, you can have program-specific commands associated with mouse buttons. Find out what the "Back" keyboard command is for your program. For VS .NET 2003/2005/2008 it is Ctrl+\ (control backslash) which is tied to View.NavigateBackward. Then go into the Control Panel for the mouse, click on the checkbox for "Enable program-specific settings" and then click on Settings.
Click on "Add" and pick your favorite Visual Studio and map Ctrl-\ to the left button.
Others programs of interest:
uVision3 IDE (the Keil compiler): Alt-Left
Adobe Reader 9.0: Alt-Left
javaw (as in Eclipse): Ctrl-F2
VB6: Ctrl-Shift-F2
Actually, the Eclipse one isn't Ctrl-F2 but is something that cannot be mapped, so I added that mapping within Eclipse and then the new mapping in the mouse driver.
Hope that helps!
In Microsoft Dev Studio it was always mapped to CTRL+* (The * on the numerical keypad) but not in C# Express, I notice. Here it's Ctrl+Shift+8, as already noted.
Navigate backward and Navigate forward is the right choice. These can be found in toolbars.
A third party tool like ReSharper would give you the functionality you require.
It is "da bomb!"
Navigation in the Solution explorer is a thing of the past.
Kindness,
Dan
I just use the back button on my mouse.
Has always worked by default for me.
The easiest way for me to do it is to add a bookmark before I go to the definition. To get back i just toggle back

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?
If you use Visual Studio 2010, you can use the free
Visual Studio 2010 Productivity Power Tools from Microsoft to achieve this.
I use visual studio 2013 and 2015, I installed Go To Definition. To install this extension navigate on TOOLS -> Extensions and Updates.
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.
Visual Assist supports Ctrl+Click as of June 2009 (build 1727). Activate Ctrl+LeftClick in VA Options | Advanced | General. (See the comment below.)
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
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!!!
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.
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!
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.
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).
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/
If you are using Visual Studio 2017, you can use Productivity Power Tools 2017
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.

F6 for compiling?

I have become accustomed to using F6 to compile the current document. A third-party install appears to have turned this function off. (F6 no longer does anything.)
Can anyone tell me how to get it back?
I'm using VS2008
Tools > Options > Keybord
This dialog lets you bind keyboard shortcuts to your heart's content. BTW this is how you bind keyboard shortcuts to custom IDE macros as well.
Thanks. The dialog: Tools > Options > Keybord
Allowed me to set the keyboard back to Visual C# 2005. So far, this seems to be what I wanted.
VMware's integrated debugging tool did this to me too. You can change this back to whatever you want, but every time you restart Visual Studio your keyboard shortcuts will be changed again.
The only way I could fix this was to remove the VMware debugging tools.
Its become a habit for me to use Ctrl + Shift + B to build my solutions. I know this doesnt answer your question, but I thought I would point it out.
Another keyboard shortcut is use constantly is Alt + Shift + F10. It opens the drop menu from the little red square under a change (the autocorrect type thing, I'm not sure what its called, also works for autocorrect in all the MS apps)

Resources