IntelliSense is a feature in the Visual Studio IDE that saves you a hell of a lot of typing and makes APIs discoverable. A common question/concern/phobia among .NET developers is how can Ruby development be productive without this feature? I am currently making the transition to Ruby myself. I have found that the combination of the powerful features of TextMate, quick feedback from the IRB, and the Ruby language reduce your dependence on IntelliSense. In this first post I discuss TextMate.
Some Ruby IDEs such as JetBrains RubyMine do have Visual Studio style IntelliSense, but the majority of Ruby developers use TextMate as their primary editor. This has two features that give you 50% of what IntelliSense does: Completion and Snippets. (Other popular Ruby editors such as Emacs and Vim have similar features.)
Completion works as follows: if you start typing a word and press the ESC key, TextMate will attempt to complete the word if it has appeared previously in the file. For example if I have a Ruby file like the following:
Pressing ESC again will cycle through other potential matches. This is simplistic compared to auto-complete in Visual Studio (as TextMate lacks any type information about the code) but it does save a lot of typing.
Snippets generate commonly used Ruby and API structures quickly. Typically you type the first 3 letters of a structure and then press TAB. For example, pressing def and TAB will generate a function definition:
You can install Bundles (TextMate extension packages) to add snippets for popular frameworks such as Rails or RSpec. For example, typing vl and TAB generates the following Rails code:
validates_length_of :attribute, :within => 3..20, :message => "must be present"
This is neat as it also helps you discover information about the API.
TextMate also has a help shortcut (CTRL + H) that looks up the API documenation on any method you highlight. Code Navigation is pretty powerful too. You can jump around files in a project (CMD + T) and between methods in a file (CMD + SHIFT + T) easily. RubyAMP is a powerful TextMate bundle that expands the Completion feature to include all the files in a project.
Next time I will discuss how the Ruby language itself, the APIs, and the IRB further lessen the dependence on IntelliSense.