Terminal Titanium: A Tern(js) for the Better

What is ternjs?
Tern is an indiegogo backed project
that “…is a stand-alone, editor-independent JavaScript analyzer that can be used to improve the
JavaScript integration of existing editors.”1
In a nutshell, it analyses your code and provides auto-completion, hints, documentation and more. Even better is that
it is editor-independent so it can fit in with the way you work.

If you want more details follow the links above. In this post we will look at getting it working with Titanium.


See the tern documentation for the how to set it up for your favourite editor. There are
links for vim, sublime, emacs and brackets. (For those using vim see this guide
to set it up with YouCompleteMe and this stackoverflow question
if you want it all to play nice with UltiSnips.)


Recently @x-cray wrote a perl script to generate the Tern definition file for Titanium from the Appcelerator API documentation
files. Clone the repo if you want to generate the definition file yourself.
Alternatively, here is one I just generated using the script against master branch (2014-01-02) – titanium.json.

You can either copy the file to your project root or to the defs/ folder in the tern install directory.

After that you need to add a .tern-project definition file to your project. Here is one example for a classic project:

    "libs": [
    "plugins": {
        "requirejs": {
            "baseURL": "./Resources",
            "paths": {}

After that you are good to go.

Here are some examples of what you see (using vim):

Screen Shot 2014-01-06 at 12.30.12 pm

Screen Shot 2014-01-02 at 1.40.17 pm

David Bankier leads YY Digital, a company that builds integrated mobile, tablet and server side applications for enterprise. He has used Titanium for mobile dev since 2010 and uses a mix of Node and Scala on the backend. TCE, Titan, OSS dev and he likes to CodeFast