简体   繁体   中英

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).

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.

到目前为止,在 RC 中只有您指出的紧凑型,选项卡很烦人,但至少它停止将大括号放在类下方。

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

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.

在此处输入图片说明

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

在此处输入图片说明

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM