the blog
Back to -Blog

Evaluating Ruby IntelliSense

Put Your IDE To The Test...
by Huw Collingbourne
Friday 13 April 2007.

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.

An IntelliSense system must be capable of displaying appropriate completion lists (that is, only those methods which are available to objects of a specific type) for both variables and literals. Here, for example, we have a completion lists showing array methods for an array literal. Notice we also have automatic tooltip help for each selected method.

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.

At the very least, any IDE that offers even the most basic type of code completion should be able to provide lists of methods (and only those methods) relating to your own custom classes.

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.

Things get more complicated when you start dealing with ’mixed in’ modules. Here, the ob object is created from class C inside the M3 module. Bu this class includes (mixes in) two other modules, M1 and M2, each of which contains another method, m1_method and m2_method. Notice that the completion list of the ob object correctly shows the mixed in methods.

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.

Ruby’s scoping rules all complications for IntelliSense. Here we fire a completion list with two colons, ::, after the X class. This correctly shows that we have access to the Y class and to the x1 method (plus some other standard Ruby methods for a class), but it does not show the ’nested’ class, Z, or the instance methods, x2, p and q.

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.

Summary

IntelliSense features provided by Ruby In Steel include:


- Member completion lists
- Keyword completion lists
- Parameter completion lists
- Globals completion
- Variables completion
- Intelligent Type Inference
- Optional type assertion of method return
- Optional type assertion of arguments
- Auto-expand snippets
- Auto-surround snippets
- Dedicated Ruby Snippet Editor
- RDoc display in tooltips
- Tooltip Help over Completion Lists
- Navigation bars (drop-down Lists) In Editor

Our IntelliSense also include parameter info in tooltips to show the names and types of arguments. Using our optional ’type assertions’ you can even add more type information than is available in the Ruby code itself.

For more information, see:
- IntelliSense Overview
- IntelliSense screencasts
- 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

Bookmark and Share   Keywords:  ide

intellisense_tests.zip

Use these code files to test a few simple IntelliSense fetures.


3.6 kb
© SapphireSteel Software 2013
buy lumigan nuvigil 150mg clomiphene amlodipine besylate for sale malegra 100mg buy sildigra online buy caverta online buy flonida 5% buy valif 20mg femalegra 100mg buy testosterone undecanoate diclofenac natamet buy fluka 150mg tadalista for sale buy pletoz online buy sildigra xl plus 150mg garlic himalaya lasuna buy generic malegra professional buy flutivate cream 0.05% vardenafil 20mg orlistat 120mg sustanon tadalafil buy generic caberlin buy viagra buy generic rifagut buy irovel 150mg buy generic lithosun sr buy modalert online lasix buy generic soranib buy generic tizan calutide 50mg melanocyl for sale order penegra buy generic super kamagra buy revlimid 5mg order finpecia bactrim d.s 160/800mg order memantine avagra avanafil buy mirtazepine omeprazole for sale erlotinib 150mg aldactone 25 mg buy isotretinion order azithromycin buy generic arcalion sulbutiamine armod armodafinil quinine sulphate 300mg buy arpizol online buy viread 300mg viagra buy generic tenofovir + emtricitabine buy generic flagyl sildenafil citrate 100mg buy modafinil online buy qutipin online buy malegra dxt 100/30mg buy zhewitra buy generic tadaga x-vir amitryn amitriptyline buy urimax online buy generic eriacta buy testosterone gel buy generic levipil generic imatinib for sale buy zocor online buy acamprosate online buy naltrexone 50mg buy sildenafil citrate 100mg buy testosterone undecanoate online buy stendra 100mg diflucan nizonide for sale attentrol 10mg buy bupron sr online order kamagra oral jelly oraxyl 100mg buy amlodac avana for sale mestilon mesterolone buy pelosta online buy generic malegra fxt order esomeprazole order imatib buy generic a-ret gel buy doxycycline buy vidalista online buy tadalafil biduret sildenafil citrate 100mg buy topirol 100mg order vega buy hostacycline online order piracetam buy generic generic ampicillin prosteride ciplactin 15mg buy clomiphene 100mg buy veenat buy sildenafil citrate 100mg generic femara quetiapine buy enalapril maleate 5mg xtane exemestane buy armodafinil online order super p force buy baclofen tadora tadalafil buy conjugated estrogens 0.625mg bortenat bortezomib buy rizact online sildenafil citrate jelly for sale ranitidine zantac tadalafil jelly buy rogaine shampoo anastrazole bupropion for sale buy modvigil 200mg buy fincar 5mg buy generic buspin buy testosterone undecanoate cialis 20mg buy generic duprost ciprofloxacin 500mg ketasma for sale vardenafil lipitor 20mg buy amisulpride rasalect 1mg calaptin snovitra 20mg buy olanzapine online buy fludrocortisone online buy tadalafil super active baclof for sale buy normabrain buy dilantin online order generic sirolimus sildenafil citrate prednisolone 40mg waklert armodafinil buy viraday online buy generic admenta tadalafil sildisoft geftinat metronidazole flagyl vardenafil 20mg order poxet buy terbicip online tadacip 20mg rapacan 1mg buy tadasoft generic viagra order careprost naltima 50mg buy fluticasone online buy tadarise pro 20mg