Using JSDT #4 : Adding Third Party Library

I’m documenting my experiences using the Eclipse JSDT.

In this post I will add a 3rd party library.  I will describe a success (mooTools) and a failure (jQuery).

Update: There is improved information in this post: Adding Third Party Library Redux.

Previously

Adding mooTools Library

MooTools is one JavaScript library I’ve been playing with lately.

First download the uncompressed version (mooTools-1.2.4-core-nc.js) and save it somewhere.

Now in Preferences, add the library. Make sure after adding the library, you also add the mooTools .js file you previously downloaded.  It should look like this:

MooTools Content Assist

Now create a Static Web Project.

  • Expand the project in Project Explorer and right click on JavaScript Resources and select Properties.
  • From this dialog, you can add MooTools.
  • Add JavaScript LibraryUser LibraryNext – Select moo Library you already added.  Finish.

You should see this in Explorer:

Content Assist

Now create a JavaScript file in your project and try some Content Assist.
Ah it can see the Cookie constructor!
And variables and functions that start with $:
And members:

MooTools Problems

I should mention that I could not get this to work in a workspace I had been working in for awhile.  In fact I spent many hours trying to get it to work and finally determined the workspace I was working had been corrupted somehow.  From the .log, I had experienced several crashes, some related to AST parsing, in that workspace.  And no amount of removing user libraries and creating fresh projects would allow me to see MooTools Content Assist.

Supposedly, if your 3rd party library uses jsDoc, the editor functionality is more robust.  MooTools does not seem to document with jsDoc.

jQuery Failure

Update: I’ve added bug 324416 for this problem.
I followed the same steps to add jQuery (1.4.2 uncompressed from the download page) as a user library. However, after adding it and opening it in Explorer, it seems that parsing has failed.  The AST is confused.
According to Explorer, it seems to know about the jQuery variable though.  But when I try to get some CA for jQuery, even though the jQuery variable is listed, I get none.  Same for _load, add, etc.  Nada.


Dojo? Prototype? YUI?

I’m wondering what experiences others have had adding 3rd party libraries or their own libraries.

Next: Adding Third Party Library Redux

Advertisements

4 comments so far

  1. […] Using JSDT #4 : Adding Third Party Library […]

  2. JS on

    Hi,

    I’ve been going through the same steps after installing Helios. I thought I’d give jsdt a try. So far I’ve been using the Spket over Aptana combo and it’s been working fine.

    Adding Ext-js gives some result, but certainly not anything usable so far. I can see some of the classes in the JavaScript Resources, but only part of them.

    Also content assist is either broken or uncomplete. For example typing “Ext.” gives no assist (whereas Ext is a “singleton” with some functions attached to it). Typing “var foo = new Ext.” does work though, and proposes all the classes under Ext AND under the namespaces it contains. Which would give a lot of entries if the parser got everything (but it didn’t).

    So, either I’m doing something wrong, or this is still not usable enough 😦 I was hoping I could drop the aptana+spket combo but apparently not. Spket reads jsb files instead of js, and seems to pull classes without a problem.

    Cheers,
    J

  3. […] #4: Adding a 3rd party Library […]

  4. JSDT versus NetBeans « Eclipsed on

    […] #4: Adding a 3rd party Library […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: