james david low

live / work / play / worship

Titanium Autocomplete Eclipse

I’ve been using Accelerator Titanium to create iPhone applications in JavaScript. One thing JavaScript is missing is really good editor with autocompletion / code completion. I recently found Aptana and wanted a way to autocomplete from the Titanium API in that. I’ve created ScriptDoc compatible JavaScript header file that does the job.

Installation
1) Install Aptana standalone or as an eclipse plugin.
2) Download the javascript header file
3) Switch to the Aptana perspective in eclipse
4) Set Aptana as the default javascript editor in preferences
5) Add the timobile.js to the references

Other points of interest:
- You can download the PHP file here that I use to create the JavaScript header file from the Titanium API JSON file.
- I’m working on an Eclipse plugin, you can view the source here.
- If you’re wondering why there are function names like Titanium_UI_Window, these are to act as dummy return types, because Aptana ScriptDoc didn’t allow me to return an Object in a name space like Titanium.UI.Window.
- Mbirth has a JSDoc code completion file here, but Adobe no longer seem to distribute JSEclipse so I’m not sure how it would work in Eclipse.


If you found any of the software useful, please consider supporting its further developement by donating.

3:24pm / May 31st / 10
« <3 Adobe Cut & Paste and Tabs in Finder »

8 Comments

    [...] plugins coming out of the woodwork for Titanium Appcelerator, which is great to see. James, over at http://jameslow.com/2010/05/31/titanium-autocomplete-eclipse/ has created what looks so far to be an excellent JS plugin for eclipse – hopefully now [...]

    8:43am / Jun 1st / 10 Titanium auto-complete plugin for Eclipse | @boydleep

    AWESOME! I’m trying this on a mac (Snow Leopard) with Aptana standalone version 2, followed your video to the tee, and don’t see the Titanium API stuff in my autocompletes that appear. Do I perhaps need to use eclipse with the aptana plugin instead?

    I see the variables that are in the JS file but I have a feeling that’s just Aptana recognizing what’s in my app.js already. Any ideas as to what I can try?

    8:27pm / Jul 15th / 10 Pete

    Hmmm not sure. I think Aptana has some settings within a project that might allow you to check which references to use.

    Aptana stand alone is pretty much eclipse down to the tee, so it shouldn’t be that, but you could always try. Did you make sure Aptana was set as the javascript editor?

    10:10pm / Jul 15th / 10 James Low

    Excellent approach, thanks a lot. I started to use this extremely helpful tool yesterday and noticed that timobile.js does not contain all objects, e.g. Titanium.Filesystem.File, Titanium.Contacts.Group, … are completely missing, at least I can’t find them. To me it seems that sometimes only top level modules are contained, while the module’s objects are not contained at all.

    Additionally, the file has errors, e.g. Titanium.Filesystem.getFile, which in fact returns Titanium.Filesystem.File, is listed with “getFile: function (path) { return {}; }” (maybe a side effect of the missing Titanium.Filesystem.File). Also, e.g. Titanium.Contacts lists only 3 out of 15 methods (also maybe a side effect).
    Will you have the chance to fix this? Would be most appreciated …

    Thanks again, Thomas

    6:05pm / Jul 30th / 10 Thomas

    Excellent work! Very useful. Thanks for sharing this.

    3:15pm / Jul 31st / 10 Michael Ferguson

    I’ll have a look at it. I wasn’t using those methods so I didn’t check, but I thought I was reading the data from the son correctly so maybe its missing from there or it was an older release.

    3:27pm / Jul 31st / 10 James Low

    Will also try to get the Ti name space working.

    3:30pm / Jul 31st / 10 James Low

    I’ve updated to version 1.4 of the API

    8:06am / Sep 7th / 10 James Low