Normally, to create a new bracket block I would type:
"{" then enter
This produces:
{
}
however, (I have seen this on two different machines so far, it might be the default setting) if like me, you like to keep shift held down, or accidentally keep it down and instead press shift + enter, it creates a new line underneath.
{ }
//current cursor position
Leaving the un-formatted brackets behind!
This is really annoying as I nearly always do this, and have to fiddle around for a little second to get the brackets back to where I want them. What can I do to change the behavior of shift + enter?
Go to Options > Environment > Keyboard
If it doesn't work try restarting Visual Studio.
Update: This issue is fixed in Visual Studio 2015 Update 1 - SmartBreakLine works as expected.
We stumbled on this thread and it felt like we could make a nice improvement here to Shift+Enter (SmartBreakLine).
So, in cases where a block was opened { }
and if shift
was held down intentionally or unintentionally, we now do this:
{
|
}
instead of
{ }
|
this way people who are used to using shift+enter to complete the line (in C#, it adds a semicolon to the end of line if needed, formats the line, adds a new line after current line) do not have to lose those functionalities by remapping the shortcut to BreakLine.
See: https://github.com/dotnet/roslyn/pull/5790
this should make it in the next update of Vs2015 and we hope you like it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With