Keyboard Shortcuts in Visual Studio for faster coding - visual-studio

Visual Studio autocompletes brackets and tags and then shifts the cursor inside a bracket/tag upon creation.
I usually have to hit END then ENTER to continue past the tag, it would be really useful to 'jump' over the closing tag/bracket and possibly to the next line.
Is there a fundamental keyboard shortcut I'm missing here in order to accomplish this?
Can't find this in the MSDN VS Keyboard Shortcut manual either.

The keyboard shortcut you are looking for is Ctrl + Shift + Enter.
Pressing this will take you to the next line instead of inserting an enter, allowing you to move the cursor outside of the tag.

Related

Does Visual Studio have a begin selection/set mark command like Emacs?

In Emacs, one can begin a selection (more accurately "set the mark") by pressing Ctrl-Space. Then, one can navigate around the file, e.g. by pressing End to go to the end of the current line, and the selection will follow the caret.
There is more to the Emacs mark than that, but my question is:
Does Visual Studio 2013 have a way to begin a selection at the caret and have the selection follow the caret until ESC is pressed, or something similar? Visual Studio has a command called "Edit.EmacsSetMark", but it does not seem to work for me.
I only know of SHIFT + cursor keys (including PgUp/PgDn, Home/End, and most of them also with Ctrl). Could take a bit of practice in your case, but very convenient IMO. The selection is cleared as soon as you use a cursor key with SHIFT released.
Even rectangular selections are supported if you also press ALT.
Then there is also the mouse of course. With variations by using SHIFT (extend selection) and ALT (rectangular).
Not that I know of for 2013, but you could do it in 2010 with this...a link

Visual Studio - move cursor to out of closing brace keyboard shortcut?

Given the following code example
someMethod(②someArgument①);③
I know moving the cursor from position ①->② shortcut is CTRL+], is there a ①->③ shortcut.
Is there a keyboard shortcut that escapes the brace when cursor is just left of brace (Not with End key).
In Eclipse, It can easily work with Tab key.
(In Visual Studio) - Try Ctrl+Shift+] - That seems to select text to where you might need to be, but if you press the ] again, by itself, it deselects, but leaves the cursor where you appear to want it.
Is that what you're looking for?

How to navigate to a closing bracket with ReSharper?

Say you have a large amount of C# code in an if statement. If you place your carat next to the opening bracket, is there a hotkey or something in ReSharper that will automatically take you to the closing bracket?
VS offers this shortcut, regardless of whether you have R# installed.
Ctrl + ] will take you to the opening brace. Subsequent presses will jump between the RHS/LHS of the scope.
See Go to Matching Brace in Visual Studio? (now as an answer as requested!)
ReSharper assigns the shortcut (Control + ´ - I have german keyboard) to a different command. In order to restore it go to Tools - Options - Environment - Keyboard, search for Edit.GotoBrace and enter the desired shortcut key.
See to what command it is currently assigned and then remove it for this command first by searching this command and clicking Remove. Then again search for Edit.GotoBrace and assign the shortcut.
Directly assigning without Removing it first didn´t work.
Visual Studio's shortcut is (under the IntelliJ shortcut set): Control + ] when your cursor is on the opening brace goes to the ending brace. The inverse is also true.

How to navigate back to the last cursor position in Visual Studio?

What is the keyboard shortcut navigate back to the last cursor position in Visual Studio?
It Will not work for red color (-) key. For me it only works for blue color combination.
According to Visual C# 2008 Keybinding Reference Poster it is Ctrl + -. The name of the specific keybinding is View.NavigateBackward.
PS: While researching I also found that Ctrl + . is the same as Shift + Alt + F10. Nice!
ctrl + - (dash) navigates backward.
ctrl + shift + - (dash) navigates forward.
These settings can be found under Environment -> Keyboard:
For Changing the setting in Visual Studio 2019:
Search for view.navigate
CHOOSE "Text Editor" from the "Use new shortcut in:" drop down menu
Select your shortcut
Global doesn't catch for this.
For new VS Code(1.28.2)
Back: Ctrl+Alt+- (dash)
Forward: Ctrl+Shift+- (dash)
The most generic answers is: there is no working default and you need to define your own keyboard shortcuts for View.NavigateBackward and View.NavigateForward.
Why? For most keyboards, the default shortcut is a broken, unusuable combination because VS badly handles the shift and altGr modifiers. MS did not pay attention to portability and internationalisation so much when they redeveloped VS after version 6, and this is still true today. This bug has been there for way more than a decade, nearly two decades. At this rate, it will never be fixed. And yes, I have filled a bug report, and I'm certainly not the only one.
However, their "VSCode" product line does have better keyboard handling as it doesn't depend on the shift or altGr modifiers to identify the key. For example, when you are in text writing mode and press the key that has the dash symbol, without using shift nor altGr, let's say it writes something else, like number 6. To VSCode when it comes to shortcut handling, that's still the dash key for its purpose. As long as a key has the symbol written on it, whether this is painted as the 1st, 2nd or 3rd level doesn't matter, it just that key.
Of course, it's never a good thing to make the default shortcuts use non-alphanumeric symbols, that's always confusing, whether it works or not. The good mature text editors have known that for a long time and should be taken as examples of things done right. In some ways, VS learned a few good things from emacs with shortcuts that are a sequence of two letters, but ultimately screwed up on other parts with the choice of non-alphanumeric bindings, combined with a broken low-level keyboard handling.
This works for me in Visual Code
Navigate backward Alt+←
Navigate forward Alt+→

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