Appcelerator Developer Blog

Titanium Mobile TextMate Bundle

This weekend, esteemed community member Thomas Aylott (a.k.a subtleGradient) published his TextMate bundle for Titanium Mobile! This is a must have for any Mobile developer working on the Mac (and using TextMate of course). Installing his bundle is easy – you’ll probably want to install via git, so you can update the bundle via a simple git pull:

  1. EDIT: As per Jeff’s note below, make sure the Ruby JSON gem is installed: sudo gem install json
  2. cd /Users/[your username]/Library/Application\ Support/TextMate/Bundles
  3. git clone git://github.com/subtleGradient/JavaScript-Appcelerator-Titanium-Mobile.tmbundle.git
  4. reload your bundles or restart TextMate

To see the magic happen, simply start typing in a Titanium namespace:

At any point while typing a Titanium function, hit option+escape to bring up the code completion window. Once you’ve selected your function, hit the tab key to switch to the next argument:

There are some other goodies packed in there as well – typing “inc” then tab will create a Ti.include statement, and d+tab will output a Ti.API.debug statement. I definitely encourage you to check out this awesome TM Bundle, follow new developments in the project, and to shower praise and adulation on it’s author. Thanks for an outstanding contribution!

16 Responses to “Titanium Mobile TextMate Bundle”

  1. Gaurav says:

    You need to have ruby, gems and the json gem installed in order to use this.

  2. Volante says:

    Awesome! I would also recommend everyone to use JSLint. Here’s a textmate bundle http://github.com/johnmuhl/javascript-tools-tmbundle

  3. ben says:

    Also… need to have git installed. ;)

    http://code.google.com/p/git-osx-installer/downloads/list

    Looks great – excellent addition.

  4. Gaurav says:

    @Volante: Thanks for the update about JSLint.

  5. Tony says:

    I followed all instructions and did “sudo gem install json” but when I type “Ti.” I get nothing…. Any other help would be great!

  6. Jeff Haynie says:

    make sure you reload the bundles or restart textmate.

  7. mstearne says:

    Coda code completion support would be great!

  8. Richard James says:

    Not sure if it’s me, textmate or the bundle but it does not fire everytime you type the DOT, in fact it seems to have a mind of it’s own. The there a way to make it manually fire… like for eclipse CTRL and SPACE ? Also the properties information window disappears when you move the mouse… is there anyway to make it hang around longer :-)

  9. Tony says:

    I both reloaded bundles and restarted text mate.

    I selected Titanium Mobile as the type

    Typed: Ti.

    and I get nothing.

    Any other suggestions?

  10. Tony says:

    WOW! Got it working! COMPLETELY MISSED THE “option+escape” part!

    Thanks

  11. Ryan says:

    If you get this errror:

    ERROR: could not find json locally or in a repository

    type:

    sudo gem update –system
    sudo gem install json

    Thanks!

  12. Ryan says:

    Sorry the above should have two dashes on system.

    sudo gem update –system

  13. The ‘Ti.’ completion only comes up when you use the titanium mobile JavaScript language syntax. Select it from the popup thing in the status bar.

    Option-escape works everywhere on anything that starts with ‘Ti.’ or ‘Titanium.’ e.g. ‘Ti.UI.create{OPT-ESC}’ will give you the completions popup for everything thatmatches that.

    Also, this article never mentioned the contextual tooltip help thing. Itworks by itself too! Simply hit ‘option-F1′ when your caret is on anything beginning with ‘Ti.’ or Titanium. It even works inside the parens! Try it all over the place to get a feel for it.

    This was only possible because of the excellent API.json file that the Titanium team published.

    Give me an API.json file and I’ll give you codecompletion for anything!

  14. Oh yeah… Be sure to check out my other bundles too. I have a JavaScript.tmBundle that includes autocomplete for browser specific API. It includes tooltips taken from quirksmode.org with permission from PPK!

    Also, SelectStuff.tmBundle is an absolute essential!

  15. Richard James says:

    Thanks Tony, the “option+escape” was exactly what I was looking for :-)

  16. Jared says:

    Anyone else getting a Ruby error?

    /Applications/TextMat.app/Contents/SharedSupport/Support/lib/ui.rb:130:in `reopen’: can’t change access mode from “w” to “r” (ArgumentError)

    Then it’s a stack trace