VS 2010 Javascript Intellisense 不工作
我正在编写使用 jQuery 的 javascript 代码,不幸的是,当我使用以下内容创建 .js 文件时:
/// <reference path="jquery-1.4.2.js" />
(function($) {
// use $ here
})(jQuery);
我没有得到任何 $ 的智能感知。但是,如果我使用“jQuery”,我仍然可以获得智能感知。这对我来说似乎是一个疏忽,因为 Visual Studio 应该认识到我正在创建一个匿名函数并立即使用传入的 jQuery 执行它。
有人有解决方法/修复吗?
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 $. 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,除了这样做之外,我不知道有什么解决方法:
我在将其作为构建的一部分剥离
$ = jQuery;
时执行此操作(如果我在文件中非常需要智能感知) 。我希望 Visual Studio 团队在 SP1 中修复这个问题,但我还没有看到任何消息说他们已经修复了。 查看 Michaud 的博客,其中引用了 VS 团队关于问题。Unfortunately there's no work-around I'm aware of, except doing this:
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.