I'm trying Eclipse (with JavaEE and Web Development plugins) as a JavaEE/GoogleAppEngine IDE. In HTML editor if I put a <script ... src="..." />
in <head>
I automatically get content assist for JavaScript in the referenced file. I was wondering if it was possible to obtain content assist for other JavaScript files (e.g. jQuery or homebrew js library) inside JavaScript editor.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
As a complement to the other answers I strongly recommend installing the Eclipse JSHint plugin. You can configure it via project preferences and it works like a charm. It shows additional warnings in the JavaScript editor.
I would also recommend writing jsDoc above your functions as this will help Eclipse (
@memberOf
, you can use Ctrl+o to navigate).You may also move to TypeScript as Eclipse support is now mature (2015), TypeScript is typed and an IDE can reap the benefits (autocompletion works like a charm with Palantir).
For Aptana Studio 3: (plugin for Eclipse tested)
Find a library you are interested in...Save it to your disk, and then drag it into your project. It does not matter where in the project it sits, so you can create a new folder for files like this if you like.
!! The project must be some type of web project: Web, PHP, Python, Ruby, Rails.
http://wiki.appcelerator.org/display/tis/Using+JavaScript+Libraries
I just figured out how to obtain js content assist in Eclipse JavaScript editor (without Aptana plugins):
If the project type doesn't natively contain JavaScript Support: open Web (or JavaScript) perspective, right-click on the project and select Web Development Support > Add JavaScript Support (this won't hurt if JavaScript support is already present)
then right-click JavaScript Support within the project and select Properties, in the JavaScript section go to JavaScript library and then select Source tab: here you can add folders and files to be scanned by content assist for the current project
In Aptana Studio (as an eclipse plugin but I suppose the standalone version is almost the same): open any js or html file, show References window (or open Aptana perspective in eclipse) and drag-drop js files you want to add to JavaScript scope (it is possible to build and activate different scope profiles with different JavaScript files and resources: just click add profile in the window toolbar)
Enabling Javascript validation for Aptana Studio 3.2:
I tried and failed at many suggestions. About to give up I came across this:
Finally, right?!