Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Auto Format: Move Bracket

I'd like Visual Studio to format this

if (itRains){
   teleportToSahara(myPapyrus);
}

like this

if (itRains) 
{
   teleportToSahara(myPapyrus);
}

Is there a way to set the format? I read https://msdn.microsoft.com/en-us/library/999b219z(v=vs.71).aspx but it doesn't say.

like image 364
m2z Avatar asked Apr 30 '26 13:04

m2z


1 Answers

Just retype the closing brace }

Make sure you have the following option ticked:

Tools/Options/Text Editor/C#/Formatting/General/Automatically format completed block on }

And this one should be unticked to get the look you want:

Tools/Options/Text Editor/C#/Formatting/Indentation/Indent open and close braces

like image 164
ib11 Avatar answered May 02 '26 20:05

ib11



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!