简体   繁体   中英

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
  • 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

In the menu:

Tools -> Options -> Text Editor -> JScript -> Formatting -> New Lines

However, I agree with epoch - it's probably better to just follow the style guide.

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