visual studio fast typing string inside brackets - visual-studio

In Visual Studio
while i am typing a string inside braces
what is the hotkey to go to ending bracket ] without pressing end
item["i am typing here..."] //i want an hotkey to jump here
if it's not possible
how can i jump out of current box which i am typing in?
namespace{
class{
method(){
lambda->({(jump out of this box)});
}
}
}

according to this https://www.dofactory.com/reference/visual-studio-shortcuts you should use end button to go to ending bracket and you can see all of hotkeys in this link.

You are looking for Ctrl-]. From the documentation:
Moves the cursor to the matching brace in the document. If the cursor is on an opening brace, this will move to the corresponding closing
brace and vice versa
At the bottom line - it will bring you to the end of your current braces-scope (or to the beginning of it if you are on the closing brace )

I did this trick after starting to type inside quotes ("")
press tab then press ]
It's much better than pressing end
Sometimes this won't work and will print /t character
I don't know how to deal with that
Still, there should be a better answer to this!

Related

Jump to matching brace in Xcode

In Xcode, if the cursor is on one brace (or bracket or parenthesis) of a matched pair, what keyboard shortcut will jump to the matching brace? Or how can I create such a shortcut?
An example of the feature I'm after is the "goto brace" shortcut in Visual Studio.
There is a Balance Delimiters menu command. So simply assign it any keyboard shortcut you prefer (all commands have customizable key bindings). You can also double-click the first delimiter to perform the same action.
A partial solution is to use code folding. For example, to jump from the opening brace to the closing brace:
Put the cursor just after the opening brace.
Fold with ⌥⌘←.
Arrow the cursor right to just before the closing brace.
Unfold with ⌥⌘←.
Since Xcode now has Vim mode you can use that and just hit %.
(Adding this answer for completeness - I understand it kind of amounts to "just use Vim".)

VS 2013 Brace Completion

I just started using Visual Studio 2013. I liked the auto brace completion feature. But in C#, when I press enter after entering {, no extra line to write our code is formed, like in eclipse. Instead the cursor will be at the left side of the }. Did anybody notice that? Is there a way to fix it.
When I press Enter key after putting brace, the editor is like this:
class Example {
|}
(The cursor is where the pipeline character is..)
EDIT:
I just found that in Visual C++ 2013, the braces work as expected.
class Example {
|
}
(The cursor is where the pipeline character is..)
Check within Options on the Text Editor/All Langauges/General page. Select "Automatic brace completion."
By the way in 2013 you can search for words like "brace" at the top of the treeview control in Options to find all the pages were "brace" is found.
Answer taken from here.
Try typing
class
then press Tab.
Same goes for interface, if blocks, etc.
If you want to write a property, type
prop
then press Tab.
You can press Ctrl-Enter and it will reposition the closing brace as you expected. Because Ctrl-Enter makes a new line above the current line.

Get outside parentheses in Visual Studio 2013

All right, this is stupid, but I have no clue how people deal with this and I'm hoping I'm missing something...
When I write something like this:
if (n == 0)
...The closing parenthesis gets added as soon as I type the opening one. The only way I know of to get out of them now is to reach over and tap the End key or something, which kind of ... Damages my shui, you know? And yet apparently they thought this feature was a cool idea, so...
What do you normally do to tell the IDE that you're done with this bit and you're ready to move on to the next? Same question applies to automatic quotes and stuff in the XAML editor, I guess.
Just keep typing - if you type your own ) when the cursor is just before the automatic one, it should not create another ), but just move the cursor over it.
(Disclaimer: I'm not certain this works on a vanilla Visual Studio - I have a bunch of extensions installed)
You can press Ctrl + Shift + Enter to open a new line below the current one without moving the cursor to the end of the line.
To add to this, Tab is another option and I find it easier:
In your example, type the logic, press Tab to skip passed the end bracket.
If you are inside auto quotes, type your text, then press Tab twice.
Like the other answer, it only applies when first being typed, so if you go back to edit something, you are left using the End and Arrow keys.
In Visual Studio 2015 with Productivity Power Tools installed (probably works earlier as well), when being inside an auto-complete block (quotes or braces):
end goes to line end ( typically slow to type/find)
"/) typing same key as auto-complete already inserted will simply replace the auto-inserted character
tab jumps over end of auto-complete (e. g. braces or quotes)
shift+enter adds ; at end of line, goes to new line (often what you want)
ctrl+shift+enter goes to new line
There is a short key in VS - "Edit.LineEnd" - pressing "End" you get to the end of the current line. I've re-assigned it (for me the best variant was "Alt-Enter") and use it to get outside of parentheses and quotes.
Hit the enter key when you are done typing.

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.

Jump to the start of next statement

Say that I'm writing a test and my caret is here (indicated by "|"):
[ExpectedException(typeof(InvalidOperationException|))]
In Visual Studio 2010, I'd like to press some shortcut that would take me to the next line so that I could start typing "public void Etc()".
Right now, I need to press
Right arrow
Right arrow
Right arrow
Enter
Edit: It can be
End
Enter
But that wouldn't work well if the next statement was on the same line. I'm still looking for a generic command to jump to next statement (or maybe language token should I say).
Is there a VS2010 / ReSharper shortcut to aid this?
In VS2k8 it is Edit.LineOpenBelow = Ctrl+Shift+Enter? Don't know if the same is in VS2k10.
"End" key on your keyboard then "Return" for a newline?

Resources