Using CoffeeScript in RubyMine 3

The other day I was looking for a way to see the output of the CoffeeScript compiler from within RubyMine, and I saw a mention of CoffeeBrew, which is an alternative syntax highlighting plugin to coffeescript-idea.

As an aside, when I moved to RubyMine 3, coffeescript-idea wouldn’t install for me, so I had to manually copy the plugin .jar file from RubyMine 2 to RubyMine 3.

CoffeeBrew has a couple of advantages over coffeescript-idea:

  • block comments!
  • matching brace highlighting

At the moment it has a problem with highlighting interpolated expressions within strings, but the author is looking into a fix. The plugin can be installed from RubyMine.

Back to showing the CoffeeScript compiler output in RubyMine:

  • Open Settings and go to External Tools
  • Add a new tool with these parameters:

    • Program: coffee
    • Parameters: -c -o public/javascripts --watch app/scripts (I store *.coffee files in app/scripts and compiled JavaScript goes into public/javascripts)
    • Working directory: $ProjectFileDir$
  • Start the tool from the Tools menu, and you will get a window that shows the output of the compiler. The compiler will run every time you save changes to a *.coffee file in the watched directory.

Next on my wishlist: support for CoffeeScript navigation (such as going to class declaration).