简体   繁体   English

在 Visual Studio 中禁用 CSS 自动格式化(尤其是 11)

[英]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.我需要在 Visual Studio 11 中禁用 CSS 自动格式。这简直让我抓狂,太可怕了。 I remember in version 2010 there was an option to disable auto formatting for any language, but now I can't find it anymore.我记得在 2010 版中有一个选项可以禁用任何语言的自动格式设置,但现在我找不到了。 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).最合适的格式样式是 Compact rules 样式,但它在冒号后添加了一个空格,并将左括号紧跟在选择器之后(我将所有括号对齐到一个公共列)。

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.我建议您在连接站点上提出问题或向Visual Studio 用户语音站点添加一个条目。

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

One way around this (using Visual Studio 2010) is not to use the HTML editor.解决此问题的一种方法(使用 Visual Studio 2010)是不使用 HTML 编辑器。 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.这样做似乎缺少的唯一一件事(除了拆分和设计视图)是 CSS 的语法着色。 HTML is still syntax colored, and Intellisense still seems to work for both CSS and HTML. HTML 仍然是语法着色的,而且 Intellisense 似乎仍然适用于 CSS 和 HTML。

Also, this is something that they have fixed for VS2013:此外,这是他们为 VS2013 修复的问题:

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

Here is how with SCSS.这是如何使用 SCSS。 I belive it will be a similar process with CSS.我相信这将是一个与 CSS 类似的过程。

In my case I am using Asterisk AEL which is a custom script from Asterisk.就我而言,我使用的是 Asterisk AEL,它是来自 Asterisk 的自定义脚本。 Ael looks like this https://wiki.asterisk.org/wiki/display/AST/AEL+Loops Ael 看起来像这样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.无论如何,我首先必须通过转到选项然后搜索文件扩展名来将.ael文件扩展名格式化为 SCSS。

在此处输入图片说明

Because AEL code is not SCSS I then searched for SCSS on options and disabled mostly everything as:因为 AEL 代码不是 SCSS,所以我在选项上搜索了 SCSS 并禁用了大部分内容:

在此处输入图片说明

Now visual studio will not mark errors and will still format the code.现在visual studio 不会标记错误并且仍然会格式化代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将javascript拖放为html并自动格式化所有<code>and/or blocks</code> <pre> <code>and/or blocks</code> - Drop javascript in html and auto-format all <code> and/or <pre> blocks 如何使用 Angular 自动格式化电话号码 - How to auto-format phone number using Angular Visual Studio Code 不会格式化 CSS 文档 - Visual Studio Code Will Not Format CSS Document 在不同页面上启用禁用 CSS 样式,特别是 *、html、正文标签 - Enable disable CSS style on different page particularly *, html, body tags 在 Visual Studio Code 中添加自动前缀 css 变量 - Prepended auto-prefixed css variables in Visual Studio Code 使用Web编译器禁用所有css缩小(Visual Studio扩展) - Disable all css minification with Web Compiler (Visual Studio extension) 在 Visual Studio 2019 中禁用 CSS/SASS/SCSS 警告 - Disable CSS/SASS/SCSS warning in Visual Studio 2019 visual studio中的自定义格式文档选项。 格式化CSS标记 - Custom format document option in visual studio. Formatting CSS tags 在Visual Studio 2012中使用CSS Media Queries格式化文档错误 - Format Document bug with CSS Media Queries in Visual Studio 2012 Netbeans CSS 自动格式 - Netbeans CSS auto format
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM