Trying to get my css / C# functions to look like this:
body {
color:#222;
}
instead of this:
body
{
color:#222;
}
when I auto-format the code.
Trying to get my css / C# functions to look like this:
body {
color:#222;
}
instead of this:
body
{
color:#222;
}
when I auto-format the code.
Tools -> Options -> Text Editor -> C# -> Formatting -> New Lines -> New Line Options for braces -> Uncheck all boxes.
There is a specific formatting setting in VS 2008/2010 to keep the open brace on the same line:
Click Tools->Options
Select 'CSS' within 'Text Editor' tree node
Select 'Formatting' under 'CSS' node
Click 'Semi-expanded' radio button
You will see a preview what the various radio buttons avail will do to the formatting
Go to
Tools -> Options -> Text Editor -> CSS -> Formatting
. Click "Semi-expanded," which matches the style you defined.The official MS guidelines (at the time in 2008) tells you to have the curly brace on the same line as the method/property/class and many other things which are not enforced in Visual Studio.
You can change all these auto-text settings under:
Tools -> Options -> Text Editor -> [The language you want to change]
UPDATE: This was based on the book "Framework Design Guidelines" written by some of the core-people from the .NET-team. If you look at the source-code for the likes of ASP.NET MVC, this is no longer accurate.
For CSS you'll need the 'Semi Expanded' option.
If you're looking for this option within Visual Studio 2014, then it's under advanced and is now a 'Brace positions' drop down box: