4

如何在 Visual Studio 中设置设计以在我的 javascript 函数后放置一个空格?

目前,当我按下返回键时,我得到了这个

var myfunc = function() { .... };

当我想要这个

var myfunc = function () { .... };

知道它在某个地方的设置但找不到它 - 将有助于我的 JSlinting!

4

2 回答 2

3

In VS 2010 you can't.

The options you have are found at "Options-> Text Editor -> JScript -> Formatting", but that is not one of the options available.

Here's the options you have:

  • Automatic Formatting
    • Format completed line on Enter
    • Format completed statement on ;
    • Format completed block on }
    • Format on paste
  • New lines
    • Place open brace on new line for functions
    • Place open brace on new line for control blocks
  • Spacing - section that would have what you're after
    • Insert space after comma delimiter
    • Insert space after semicolon in 'for' statement
    • Insert space before and after binary operators
    • Insert space after keywords in control flow statements
于 2010-10-25T01:16:10.777 回答
1

You can't do it with VS. I am using VS 2010 and it permit you to write formatting rules going on Tools -> Options and then select Text Editor in the list on the left.

You can define rules like the one you want for languages like C# but not for javascript.

于 2010-10-25T01:14:33.320 回答