Evaluating Ruby IntelliSense
In the time that we’ve been developing Ruby In Steel, we’ve come to realise that there is a widespread misunderstanding about what IntelliSense actually is. Many IDEs offer some kind of simple code-completion, whereby methods can be selected from a drop-down list. Very few IDEs indeed, offer anything approximating to IntelliSense.
To the best of our knowledge, Ruby In Steel’s IntelliSense for Ruby is unrivalled by any other IDE. If anyone can find another IDE that does as good a job or better, please let us know and we’ll do everything in our power to make our Intellisense better still.
In order to help you understand IntelliSense and to test out the capabilities of Ruby In Steel and other IDEs, I’ve written this short guide. We’ve also supplied a few files from our IntelliSense test suite which we invite you to use with Ruby In Steel and any other editor or IDE of your choice. We actually have many hundreds of files in our internal IntelliSense test suite which we use to test even the most bizarre combinations of code constructs. The sample download we’ve provide here, however, contains just 6 files to illustrate a few of the more obvious problems which any real IntelliSense system has to solve. Download the test files at the bottom of this article. Instructions are provided in comments in the code.
Ruby IntelliSense is integrated into Ruby In Steel Developer, including the 30-Day Trial Edition. It is not included in the free Personal Edition.
What Is IntelliSense Anyway?
The IntelliSense engine analyses code as it is entered in order to ’work out’ which methods belong to any given variable, taking into account methods that have been inherited from ancestor classes, the visibility of methods due to scoping rules or other factors (e.g. does a method belong to a class or an object? Is it a singleton - a special one-off variation of a class? - or has a method been ’mixed in’ to the current class using a Ruby ’include’?)
Note that Ruby In Steel provides IntelliSense in response not only to a dot after a variable name [ . ] but also to a double-colon [ :: ], which is used with classes and modules.
|NOTE: Before working with IntelliSense in Ruby In Steel, you may want to disable the display of Object methods. By default, Ruby In Steel displays all methods throughout a class’s ancestry up to and including the base class, Object. While this may be useful when coding, the sheer number of methods provided by Object make it difficult to see how the IntelliSense works. To disable the display of Object methods, select: Tools, Options, Text Editor, Ruby, IntelliSense and ensure that the ’Display Object methods’ option is not checked. The exception is when using the test file, object_methods.rb, which requires that Object methods be shown.|
In some circumstances, inferring the type of an object is, even in principle, impossible. Far example, a method can take untyped parameters and its return type may be unspecified or ambiguous. In such cases you can create extra IntelliSense by asserting the expected types in a comment block. These types will then be displayed in ’parameter hints’. The type_assertions.rb file shows a simple example of this. Refer to the Ruby In Steel manual for a more detailed explanation.
IntelliSense features provided by Ruby In Steel include:
Member completion lists
Keyword completion lists
Parameter completion lists
Intelligent Type Inference
Optional type assertion of method return
Optional type assertion of arguments
Dedicated Ruby Snippet Editor
RDoc display in tooltips
Tooltip Help over Completion Lists
Navigation bars (drop-down Lists) In Editor
For more information, see:
IntelliSense and Parsing Ruby
IntelliSense (phase 1)
IntelliSense in depth
Ruby IntelliSense – the finer points
Ruby IntelliSense – scoping fun
Filling out IntelliSense
Ruby Variable Completion - The Challenges Of Code Analysis