简体   繁体   English

Visual Studio 2010中的JavaScript格式

[英]JavaScript formatting in Visual Studio 2010

I want: 我想要:

if (window.XMLHttpRequest)
{
       //do some
}

but after formatting I get: 但是格式化后我得到:

if (window.XMLHttpRequest) {

}

how can I correct it? 我该如何纠正?

  • Tools -> Options 工具->选项
  • Text Editor -> JScript -> Formatting 文本编辑器-> JScript->格式化
  • Place open brace on new line for control blocks 在新行上放置用于控制块的撑杆

Visual Studio选项对话框

This is probably not what you want, but I suggest keeping it as is. 这可能不是您想要的,但是我建议保持原样。

It is also recommended by the Google Javascript Style Formatting Guide Google Javascript样式格式指南也建议您这样做

In the menu: 在菜单中:

Tools -> Options -> Text Editor -> JScript -> Formatting -> New Lines 工具->选项->文本编辑器-> JScript->格式->新行

However, I agree with epoch - it's probably better to just follow the style guide. 但是,我同意时代-最好遵循样式指南。

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

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