How to open/maximize a function or class in Visual Studio using keyboard - visual-studio

We generally minimize or shrink a function or class by clicking
-
symbol on left corner of every function in Visual Studio.
I want do with keyboard instead of mouse.
How can that be done.

CTRL-M CTRL-M
Alternatively, you can open up Tools -> Options -> Environment -> Keyboard and assign "Edit.ToggleOutliningExpansion" to any keyboard combo you like.

You just hit Ctrl-M, Ctrl-M to toggle outlining.

I think you want ctrl-M, O and ctrl-M, L. These keys will close and open all regions in VS.

Ctrl M + Ctrl M does the trick

It should also be mentioned that you don't have to click on the - itself...anywhere in the vertical bar below will do it. That makes it easy to quickly shrink successive methods since the next method's vertical bar tends to come up under your mouse pointer after you shrink the one above it.

Related

Visual Studio: Is there a keyboard shortcut to jump between code editor window and find results?

I can't seem to find the exact keyboard shortcut I'm looking for.
When I do a "Find in Files" (Ctrl + Shift + F), the keyboard navigation automatically jumps to the Find results, and I can navigate the results with the arrow keys; the code editor window updates itself as I do so, and pressing Enter pops me from the Find Results Window to the code editor Window.
Now, this is great for the initial search, but what if I want to bounce back and forth, say, if I need to make changes around a few different places in my find results?
Is there a keyboard shortcut to jump back from the code editor window to the find results?
I'm using MSVS 2013, if it matters.
If you have the General Development keyboard scheme, try: Alt + F6.
This is bound to the Window.NextPane which is where you just came from, so it should take you back.
Also, Alt + F7 is Window.NextToolWindowNav which pops up a nav selection which makes it easy to move around. This nav selection is the same one for Ctrl + Tab which, once open, can be navigated up, down, left and right via arrow keys.

Can't collapse pieces of code after doing Ctrl + M, P

Ctrl + M, P expands the whole document. But after doing this I can't collapse back specific methods or pieces of code. It's not possible via shortcut keys (for example: Ctrl + M, M) neither via the menu:
As you can see, only Ctrl + M, O is possible which collapses the whole document
Also the + en - signs disappear when I do Ctrl + M, P
In VS2012 toggling outline expansion is [CTRL] + M, M. I presume this hasn't changed from previous version. Don't have VS2010 to check...
Old question, and some of this is in the comments, but I'll tie it all together in an official answer since I recently did the same thing accidentally in Visual Studio 2015 and it took me a while to figure out what I had done.
The CTRL+M, CTRL+P combination turns off outlining for the current document. It is possible to turn it back on by closing and re-opening the document as long as the "Enter outlining mode when files open" option is checked under Tools|Options|Text Editor|C#|Advanced. (there are similar options for other editor types - you can search on "outline" in the options dialog to see them all).
If you find yourself doing this often, there is a command to turn outlining back on, however, it is not assigned a keyboard shortcut by default. You can assign one though.
Open the Tools|Options|Environment|Keyboard dialog.
Enter "outli" under "Show commands containing" and look through the list below for the one named "Edit.StartAutomaticOutlining".
When you click on it, it will either show you what keys are currently assigned if a shortcut is already assigned, or will indicate nothing is assigned.
If there isn't anything listed, select "Editor" from "Use new shortcut in", then in the "Press shortcut keys" box, press the key combination you want to assign it to. For example, I used CTRL+M, CTRL+[.
Now if you accidentally hit CTRL-M, CTRL-P and turn off outlining, you can quickly re-enable outlining with CTRL-M, CTRL-[.

Keyboard shortcut for Visual Studio code editor Members and Types combos

I wonder what is the keyboard shortcut for these two combo boxs and specially the right part which list all the members of current class and is very handy for navigating a large class.
I tried to figure it out myself but I do not know the exact names to search for it.
That whole thing is called "Navigation bar" (Window.MovetoNavigationBar) and can be activated by default by pressing Ctrl + F2. There doesn't seem to be a shortcut for the right side of the navigation bar, so pressing the short cut key always takes you to the combo box on the left side. You can use Tab to jump between the combo boxes.
The keyboard shortcut is Ctrl + F2 which takes you to the left-hand combo. If you hover over each one in turn (at least in VS2k8) it shows you a tooltip which identifies the two combos as "Types" and "Members", respectively.
Pressing Tab will take you to the right-hand combo and Ctrl + ↓ will expand the combo for you.
Alternative Resharper approach #1
"Go to file member" which is "Alt+\" .
go to link for advanced features
Alternative Resharper approach #2
"Go to Next/Previous Member" with Alt+Down or Alt+Up
this one is very handy and my favorite :

Is there a shortcut in Visual Studio to move down multiple lines but keep the cursor in the same place?

CTRL+down arrow does this, but only 1 line at a time. Is there a shortcut to skip multiple lines but keep the cusor in the same place? You'd expect CTRL+page down to do it, but this just puts the cursor at the bottom of the screen.
Tools + Options, Text Editor, pick your language or use All Languages, tick "Enable virtual space". That ensures that the caret stays in the same column when you move it vertically, no matter what text is in a line. Very much my personal preference.
Tools + Macros + Record is an easy way to generate the macro you want. Tools + Customize + Keyboard to assign it a shortcut key.
No. You could define your own macro though,and link it to a shortcut:
http://msdn.microsoft.com/en-us/library/a0003t62.aspx

Visual Studio keyboard shortcut to scroll method overloads tooltips?

Does anyone know what the keyboard shortcut to scroll a method's overloads that appears in the tooltip is? I presently have to resort to using the mouse to click the ^ and v labels in the tooltip, which isn't particularly effective.
Thanks!
A little late but maybe somebody else needs it too:
Place the cursor after the first bracket
Press Ctrl + Shift + Space
What's the command to bring up the tooltip? I know the shortcut in Eclipse (Ctrl + Space) but that's Eclipse...
In VS the tooltip shows when you type the first bracket but if I would like to see the different method overloads for a method that's been implemented already, how would I do that?
Press Ctrl + Shift + Space to see the list of overloads and arguments.
See the Visual C# 2008 Keybinding Reference Poster for more keyboard shortcuts.
The arrow keys work for me...
Sometimes I have to hit escape to get rid of the intellisence popup before using the arrow keys to scroll through the overload list.
What's the command to bring up the tooltip? I know the shortcut in Eclipse (ctrl+space) but that's Eclipse...
In VS the tooltip shows when you type the first bracket but if I would like to see the different method overloads for a method that's been implemented aldready, how would I do that?
There's got to be an easier way than this:
place the cursor just after the first bracket
erase it
re-type it (tada!)
navigate the methods using up and down arrows
when you're done, press ctrl+z to undo changes.
1. To Show Overloading Suggestions
Place the cursor after the first bracket and press CTRL + SHIFT + SPACE to bring it back.
Also, Erasing the opening bracket and writing it back can do the trick too.
2. To Scroll through Overloading Suggestions/Options
if your IntelliSense options are showing then press ESC which will hide it. Now, it's time to use the Up/Down arrow keys to see the charm.
if your IntelliSense is disabled, the Up/Down arrow keys will work directly.
Ctrl + Shift + Space in the "()" method brackets brings up the method overload context menu. The UP and DOWN arrows are used to navigate through.
The Visual Studio Keybindings definition is : Displays the name, number, and
type of parameters required for the specified method.
P.S. Jasper's link to Visual C# 2008 Keybinding Reference Poster is useful, check it out.
Arrow keys are the short cut keys i suppose as they work for me.
You can type a comma after the last parameter of the function. That will bring up the intelisense menu

Resources