开发者

Change JavaScript text spacing formatting in Visual Studio?

Is there any way to tweak some of the spacing settings for JScript that aren't explicitly spelled out in Options:Text Editor:JScript:Formatting?

I like having I like having my JavaScript code pass JSLint on "The Good Parts". I also enjoy doing JS in Visual Studio 2010. Unfortunately, I cannot seem to keep the auto-formatting in Visual Studio from breaking one of the JSLint rules when it shuffles things around.

If I write a self-executing function in a JS file that passes JSLint (for extending jQuery, in this case), and then have Visual Studio format it (either automatically or via CTRL+K, CTRL+D), Visual Studio inserts a space between the closing } and the (jQuery) parameter.

(function ($) {
  // ...
}(jQuery));

becomes...

(function ($) {
  // ...
} (jQuery));
开发者_如何学Python

After the auto-format, JSLint gets upset at the last line:

Problem at line X character Y: Unexpected space between '}' and '('.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜