Friday, March 16, 2012

Ruby: Staying "In The Zone" With Code Completion

Nothing breaks my flow of thought like a bunch of compiler errors -- or worse, subtle runtime errors -- because I misspelled an identifier name somewhere in my code.

As dynamic languages like Ruby have gained in popularity, we've often had to choose between robust, Intellisense-sporting environments like Visual Studio and the dynamic languages we really love.

Out of the box, Sublime Text 2 (OSX, Windows, Linux; $59; free unlimited evaluation of Sublime Text 2 during its prolonged beta period) has some excellent code completion for identifier names and built-in language constructs. There's an important shortcoming, however: the editor only "knows" about identifier names that appear elsewhere within the current file. A variable declared in File1.rb is invisible to the editor in File2.rb.

SublimeCodeIntel is a promising attempt to fix that shortcoming in Sublime Text 2. Based on my simple, initial tests, it works. There still appears to be work to be done, as the code completion dropdown randomly fails to appear at times.

Another alternative for IDE-like Ruby development is JetBrains' RubyMine (OSX, Windows, Linux; $69), now on version 4.02. RubyMine aims for the full IDE experience, as opposed to the smart-and-extensible-text-editor approach of Sublime Text 2.

And then there's the venerable TextMate (OSX only) which may or may not see itself replaced by TextMate 2 if the author ever gets around to it. While I love TextMate, I've never found the code completion to be particularly useful.

While I like Sublime Text 2 the best for Ruby code completion, the saga of TextMate's pseudo-abandonment makes me awfully wary. Like TextMate, Sublime Text 2 is largely (if not entirely) the work of a single developer. What happens if he tires of the project, or other life circumstances prevent him from devoting himself to it?

This is by no means an exhaustive list. Please let me know if you've got a favorite of your own.


No comments:

Post a Comment