简体   繁体   English

如何在Visual Studio 2008中禁用疯狂的Javascript / HTML格式?

[英]How to disable crazy Javascript/HTML formatting in Visual Studio 2008?

The formatting of HTML and Javascript is just crazy. HTML和Javascript的格式化很疯狂。 It actively works against you. 它积极对你不利。 Does anybody know how to turn this off completely? 有人知道怎么完全关掉它吗? (I Do not speak about the HTML designer, I speak about what happens when you press ctrl-k,d in HTML view or when you press ; in a javascript block). (我不谈论HTML设计师,我说的是当你在HTML视图中按ctrl-k,d时或按下javascript块时会发生什么)。

可以在工具→选项→文本编辑器→JScript→格式化中禁用Javascript格式。

Goto Tools -> options -> Text Editor -> HTML and set option as per requirement. 转到工具 - >选项 - >文本编辑器 - > HTML并根据要求设置选项。

See following for more details: 有关详细信息,请参阅以下
Turn off auto formatting in Visual Studio 在Visual Studio中关闭自动格式
How do I turn off Visual Studio's formatting options? 如何关闭Visual Studio的格式选项?

The crazy formatting is called 'K&R style bracketing', you can read about it if you search for that term. 疯狂的格式称为“K&R样式包围”,如果您搜索该术语,可以阅读它。

Michael's answer is good, but it can be refined a little: 迈克尔的答案很好,但可以稍微改进一下:

Javascript formatting can be disabled in Tools → Options → Text Editor → JScript → Formatting -> new lines -> 'Place open brace on new line for functions and classes', check to remove K&R style formatting. 可以在工具→选项→文本编辑器→JScript→格式化 - >新行 - >'在功能和类的新行上放置左大括号'中禁用Javascript格式,检查以删除K&R样式格式。

You might want to change it a few other places too, such as css: Tools → Options → Text Editor → CSS -> Advanced -> formatting -> brace positions, set to 'Expanded' to remove K&R style formatting. 您可能还想将其更改为其他几个位置,例如css:工具→选项→文本编辑器→CSS - >高级 - >格式化 - >大括号位置,设置为'扩展'以删除K&R样式格式。

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

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