I’ve been spending some time playing around with Appcelerator Titanium Mobile recently, and been doing most of it using Titanium Studio, which is an IDE built on top of Aptana, which in turn is built on top of Eclipse.
Although I’m a big fan of Eclipse and all the work they’ve done for the development community, I’ve found myself recently moving towards the JetBrains suite of products, specially due to their amazing integration with all the major languages and frameworks. Stuff just works!
Unfortunately getting code completion and documentation lookup working for Titanium in IntelliJ was harder that it should be due to the Titanium API being exposed through JSON in a proprietary format called JSCA. I’m guessing the reason for this is due to the various programming languages that they support for Titanium, and maintaining the API documentation for all the different languages in a manner supported for each of the languages would turn into a nightmare pretty quickly. However for my purposes all I needed was a properly annotated JavaScript file that I can use with IntelliJ. Since this wasn’t readily available, I resorted to creating my own by parsing the Titanium JSON API.
You can find the utilities I used to convert the JSON JSCA API under my GitHub account here, along with the resulting Titanium Mobile JavaScript file. Unfortunately some of the identifiers used in Titanium do not convert to valid JavaScript, but nonetheless I found the generated file quite useful. I simply added this file as a JavaScript module in IntelliJ and got pretty good completion and documentation working in the projects I was playing around with.
Credit:
I got the idea of generating this JavaScript after reading about a similar converter in my good friend Amit Kothari’s blog post. The script was written in PHP by James Low. Unfortunately this script changes some the identifiers to get around the problem of invalid JavaScript identifiers and the documentation uses ScriptDoc tags, both of which doesn’t work very well with IntelliJ.
