Eclipse中的Javascript资源有什么好处? [英] What's the benefit of Javascript Resources in Eclipse?

查看:46
本文介绍了Eclipse中的Javascript资源有什么好处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在Eclipse中创建Dynamic Web Project时,它会生成 Javascript资源元文件夹在我第一次尝试使用它之前,我认为它可以工作就像 Java资源一样-如果您在此处添加源代码,IDE将为您提供Intellisense,文档和错误检查.

When I make Dynamic Web Project in Eclipse it generates Javascript Resources meta-folder; before I tried to use it at first time I thought that it works just like Java Resources - if you add your source here IDE provides you with Intellisense, documentation and error checking.

但是当我尝试在其中添加jquery.js时,却什么也没看到.是的,eclipse向我展示了它现在知道jQuery对象,但一无所知关于jQuery方法的信息(例如 jQuery.ajax(...)),并且它也无法识别 $ 快捷方式.

But when I tried to add jquery.js there, I found nothing that I was expecting to see. Yes, eclipse shows me that it's aware of jQuery object now but it knows nothing about jQuery's methods (like jQuery.ajax(...)) and it also doesn't recognize $ shortcut.

如何让eclipse识别所包含的js库的方法?

How can I make eclipse recognize methods of js libraries that I include?

推荐答案

这两件事与您的思维方式无关."JavaScript资源"节点指示所有已知的全局变量和命名的类型"及其属性,这些属性根据您设置项目的JavaScript包含路径的方式进行组织.它代表了项目中JavaScript已知的所有内容(独立的和客户端的)-这就是Content Assist能够为您提供的内容,我们希望这是一个布局合理且可浏览的结构.

The two things aren't related in the way you think. The JavaScript Resources node indicates all of the known globals and named "types", as well as their properties, organized according to the way you've set up the project's JavaScript Include Path. It represents everything that is known to the JavaScript (standalone and client-side) in your project--this is what Content Assist will be able to offer you, shown in what we hope is a nicely laid out and browseable structure.

您遇到的是jQuery比JSDT理解的更具动态性,并且在语法上可能更棘手.对jQuery和JSDT进行谷歌搜索应该可以帮助您找到一个在这方面有帮助的插件.

What you've run into is that jQuery is more dynamic, and perhaps a little trickier syntactically, than JSDT understands. Googling for both jQuery and JSDT should help you find a plug-in that helps in that regard.

这篇关于Eclipse中的Javascript资源有什么好处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆