I recently joined my first Rails project. While the other two developers on the team use TextMate, I decided to try IntelliJ’s Ruby plug-in because I already owned and knew how to use IntelliJ. (I’m using IntelliJ 9.0.4. IntelliJ 10 was recently released.)

Now that I have almost everything set up and working, I like using IntelliJ, and I seem to be as productive as my colleagues who use TextMate. That being said, it was rather difficult to figure out what features were available and how to get them working.

At first, refactoring, navigation, and several other expected features didn’t work at all. It turns out that there is a bug in the 9.0 core’s handling of whitespace characters in plug-in paths. A response at the end of this bug report provides this workaround:

Close IntelliJ Rename the app so it does not contain any whitespace. For example, rename IntelliJ IDEA 9.0.3.app to IntelliJ_IDEA-9.0.3.app Move the ~/Library/Application Support/IntelliJ90/ruby folder to /Applications/ [IDEA application name] .app/plugins Re-launch IntelliJ

I also had trouble getting IntelliJ to run specs “in context” (i.e., configuring IntelliJ up to run the spec at the cursor when I pressed Ctrl-Shift-F10).

IntelliJ won’t recognize a file as a spec file unless it contains the line require 'spec' . One would expect that file names ending with _spec would be treated as specs (especially those files in module directories marked as “Test”). Requiring a helper like spec_helper doesn’t always work, either. However, once I’ve run a spec using Ctrl-Shift-F10, I can often remove the require 'spec' line.

. One would expect that file names ending with would be treated as specs (especially those files in module directories marked as “Test”). Requiring a helper like doesn’t always work, either. However, once I’ve run a spec using Ctrl-Shift-F10, I can often remove the line. The context configuration will set the file’s current directory as the “working directory”. My code assumes that the working directory is the module’s root. (If it’s not, the require statements don’t find the right files.) I fixed the problem by going to Edit Configuration => Edit Default, setting the working directory to the root of my module, and adding “ -I lib ” to the Ruby arguments. (If you are using Ruby 1.9, then require_relative may be a more convenient solution.)

statements don’t find the right files.) I fixed the problem by going to Edit Configuration => Edit Default, setting the working directory to the root of my module, and adding “ ” to the Ruby arguments. (If you are using Ruby 1.9, then may be a more convenient solution.) The “run” window was initially configured to show a lot of verbose information. There is a little “cog” icon you can click to change this default behavior. I chose “Select First Failed Test When Finished.”

There is a bug in the code that displays failures. This bug report suggests the following fix: Open the file RubyMine RM-96.552/rb/testing/patch/bdd/teamcity/spec/runner/formatter/teamcity/formatter.rb Change the contents line 201 to example, failure = args[0], args[2] from example, failure = args[0], args[1]



At this point, I’m happy enough with IntelliJ that I don’t plan to switch to TextMate; however, there are still a handful of IntelliJ features that don’t work quite right:

Refactoring doesn’t always work. Sometimes, the refactor feature simply does nothing; sometimes, IntelliJ hangs. (When you highlight an item to be refactored then select “Refactor => Rename” from the menu, a dialog box pops up. This box allows the user to specify the new name of the item. Sometimes pressing the “Refactor” button does nothing. Other times, it initializes a refactoring process that simply hangs.)

It often marks defined cucumber steps as undefined; and the set of steps it can’t find changes. I’ll be working, and suddenly my cucumber files will be full of yellow squiggly lines. The steps are defined because cucumber runs just fine.

IntelliJ occasionally freaks out and brings my machine to a standstill for a few minutes.

The debugger and Rails don’t always work well together. The rails server quits immediately when launched in debug mode. (This appears to be a known issue that won’t be fixed in IntelliJ 9.) In my Ruby-only project, I can run specs in debug mode; however, when I attempt to run specs in debug mode in my Rails project, the spec runner can’t find any test cases.

I find help difficult to use There are two Ruby products: An IntelliJ plug-in and a stand-alone IDE called RubyMine. The IntelliJ plug-in supports most, but not all RubyMine features. It is difficult to determine which features are not present in IntelliJ. I don’t know the official name of many features, thus I don’t know what phrases to search for (either in Google or IntelliJ forums). This is especially frustrating when I want to assign a keyboard shortcut to a particular feature.



My overall impression is that TextMate is less buggy than IntelliJ; however, TextMate only allows one window per project, which I find much more limiting than any of IntelliJ’s shortcomings. Also, TextMate does not integrate with any debugger. IntelliJ’s Ruby debugger is very nice (when I can get it to work). My recommendation is that those who are comfortable using TextMate should not spend the time and money to switch to IntelliJ (unless they absolutely hate the single-window-per-project limitation) and those who already have an IntelliJ licence should invest the day to two to try the Ruby plug-in.