Tiborg
Tiborg

Reputation: 2305

Disable CSS auto-format in Visual Studio (particularly 11)

I need to disable the CSS auto format in Visual Studio 11. It simply drives me nuts, it's horrible. I remember in version 2010 there was an option to disable auto formatting for any language, but now I can't find it anymore. Whenever I write a line and press enter it messes up my code.

The most appropriate formatting style is the Compact rules style, but it adds a space after the colon, and also it puts the opening bracket immediately after the selector (I align all brackets to a common column).

Upvotes: 10

Views: 3190

Answers (4)

Tono Nam
Tono Nam

Reputation: 36070

Here is how with SCSS. I belive it will be a similar process with CSS.

In my case I am using Asterisk AEL which is a custom script from Asterisk. Ael looks like this https://wiki.asterisk.org/wiki/display/AST/AEL+Loops

Anyways I first had to format .ael file extension as SCSS by going to Options then searching for file extensions.

enter image description here

Because AEL code is not SCSS I then searched for SCSS on options and disabled mostly everything as:

enter image description here

Now visual studio will not mark errors and will still format the code.

Upvotes: 2

Dave Cousineau
Dave Cousineau

Reputation: 13218

One way around this (using Visual Studio 2010) is not to use the HTML editor. Rather, choose Open With... and go with the Source Code Editor instead. Doing this the only thing it seems to be missing (well aside from the split and design views) is syntax coloring for CSS. HTML is still syntax colored, and Intellisense still seems to work for both CSS and HTML.

Also, this is something that they have fixed for VS2013:

https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3549819-allow-turning-the-css-auto-formatting-off-completl

Upvotes: 0

likestoski
likestoski

Reputation: 1911

So far in the RC there is only the compact as you pointed out, the tab is annoying but at least it stops putting the braces below the class.

Upvotes: 0

Richard Banks
Richard Banks

Reputation: 12546

It doesn't look like there's an option. I checked through the registry settings being accessed and couldn't see anything there for it either.

I'd suggest you raise an issue on the connect site or add an entry to the Visual Studio User Voice site.

Upvotes: 2

Related Questions