views:

1076

answers:

6

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.

+5  A: 

Tools -> Options -> Text Editor -> C# -> Formatting -> New Lines -> New Line Options for braces -> Uncheck all boxes.

FlySwat
+12  A: 

Tools menu -> Options ...

Then go to Text Editor -> C# -> Fromatting -> new lines and there check when you want new lines with brackets

for css:

almost the same, but less options

Stormenet
A: 

/EDIT: I stand corrected.

Konrad Rudolph
+2  A: 

For CSS you'll need the 'Semi Expanded' option.

Huppie
+2  A: 

Actually, @ajmastrean, you are wrong, they are not.

The official MS guidelines 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]

Seb Nilsson
A: 

The one that gets me is when Visual Studio takes upon itself as I write the code to change the formatting. I now it'll be a setting somewhere, but I feel as if I'm wrestling with the IDE. I shouldn't really single out Visual Studio, all autoformatting IDEs do it to a certain extent.

Bernard