开发者

VS 2010 Javascript Intellisense not working

I am writing javascript code which uses jQuery and unfortunately when I create a .js file with the following:

/// <reference path="jquery-1.4.2.js" />
(function($) {

  // use $ here

})(jQuery);

I don't get any intellisense for 开发者_C百科$. However I still get intellisense if I use "jQuery". This seems like an oversight to me because Visual Studio should recognise that I am creating an anonymous function and immediately executing it with jQuery passed in.

Does anyone have a workaround / fix?


Unfortunately there's no work-around I'm aware of, except doing this:

(function($) {
  $ = jQuery; //remove or comment this before it goes to the minifier
  // use $ here

})(jQuery);

I do this when strip that out $ = jQuery; as part of the build (if I need intellisense that badly in the file). I'm hoping the Visual Studio team fixes this in SP1, but I also haven't seen any news saying they have yet. Check out Michaud's blog here with a few quotes from the VS team on the issue.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜