jQuery支持在html中起作用,但在.js中不起作用?

问题描述:

尝试使用komodo来构建jquery ui小部件..我启用了jquery api参考,并在.html文件中运行良好..然后打开我的widget.js文件并输入;

Trying out komodo to build a jquery ui widget.. I enabled the jquery api reference and in a .html file it works great.. I then open my widget.js file and type in;

(function($) {

之后

$.

我希望在这里得到智能,但我得到:

I would expect to get intellisense here, but instead I get:

未找到完成项. (确定完成情况时出错)

No completions found. (Error determining completions)

这是文件扩展名吗?只是不支持jQuery ui小部件吗?

Is this a file extension thing? Are jquery ui widgets just unsupported?

来自科莫多的人;

问题是科莫多不知道匿名用户的上下文 函数调用-换句话说,Komodo不够聪明,无法知道 在这种情况下,"jQuery" =="$".

The problem is that Komodo doesn't know the context of the anonymous function call - in other words Komodo is not smart enough to know that "jQuery" == "$" in this case.

但是一切并没有丢失,您可以通过告诉Komodo哪些内容可以帮助他们. 在这种情况下就是类型.这是使用jsDoc帮助的示例 定义"$"的类型:

But all is not lost, you can help out Komodo by telling it what the type is in such cases. Here is the example that uses jsDoc to help define the type of "$":

   (/** @param {jQuery} $ */function($) {
       $. // will show jQuery completions now
   })(jQuery)

;