问题
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.
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.
How can I make eclipse recognize methods of js libraries that I include?
回答1:
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.
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.
来源:https://stackoverflow.com/questions/7429776/whats-the-benefit-of-javascript-resources-in-eclipse