为什么 VSDoc IntelliSense 不能在 jQuery 无冲突包装器内工作?
/// <reference path="jquery-1.5.vsdoc.js" />
// IntelliSense works here.
function ($, window, document, undefined) { /// <param name="$" type="jQuery" />
// IntelliSense does not work here.
}(jQuery, this, document);
Visual Studio 2008 有解决方法吗? SP1 修补程序已应用,这就是 IntelliSense 在无冲突包装器外部工作但在内部没有 bueno 的原因。有些人说添加 param
注释,但是,唉,这对我来说也不起作用。
/// <reference path="jquery-1.5.vsdoc.js" />
// IntelliSense works here.
function ($, window, document, undefined) { /// <param name="$" type="jQuery" />
// IntelliSense does not work here.
}(jQuery, this, document);
Is there a workaround for Visual Studio 2008? The SP1 hotfix has been applied and is the reason the IntelliSense works outside of the no-conflict wrapper but, inside, no bueno. Some have said to add the param
annotation but, alas, that doesn't work either for me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是因为该函数的定义不知道 jQuery 在其内部表示美元。以此为例:
您的函数无法知道您传入的内容的定义。由您的函数来弄清楚并确保您的参数有效。
函数的定义和函数的执行是两个独立的事情。您不会获得函数定义内的函数参数的智能感知。
It's because the definition of the function doesn't know that jQuery means dollar inside of it. Take this for example:
Your function cannot know the definition of what you are passing in. It is up to your function to figure that out and make sure your arguments are valid.
The definition of the function and the execution of the function are two separate things. You will not get intellisense for function arguments inside of the function definition.
这在 Visual Studio 2010 中适用于我,其中包含 NuGet 包(当前为 1.6.1)中的 jQuery IntelliSense 文档。有一个 hack,但这是一个示例 jQuery 插件,具有 jQuery 实例的完整 IntelliSense。
This works for me in Visual Studio 2010 with the jQuery IntelliSense documentation included from the NuGet package (currently 1.6.1). There is one hack, but this is an example jQuery plugin with full IntelliSense of the jQuery instance.