james david low |
live / work / play / worship |
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. |
[...] 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 [...]
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?
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?
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
Excellent work! Very useful. Thanks for sharing this.
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.
Will also try to get the Ti name space working.
I’ve updated to version 1.4 of the API