On 29 Mar 2005, at 17:35, Lothar Scholz wrote:

> Hello Adelle,
>
>> It has been said that features like "intellisense" or "autocomplete" 
>> are
>> difficult to implement for dynamic languages such as Ruby.
>>
>> I'd be happy with an IDE that let me choose a .rb file per project, 
>> let's
>> call it "environment.rb" which would usually be a list of "require"
>> statements which would establish a run-time state that would be a fair
>> approximation of what classes and methods would be available to 90% 
>> of my
>> application.
>>
>> I mean, sure, dynamic languages let us add/remove classes variable and
>> methods anytime we like, but during the first moments of my 
>> application's
>> startup I usually set up 90% of the classes that I will need during 
>> the
>> remainder of the program's execution.
>
> The difficult thing is not really gathering of information. It is the
> way how do you want to present the thousands of methods
> found in your files and the runtime library.
>
> Since type interference is quite impossible the only solution i came
> up is some kind of a smalltalk class browser and a very clever
> interface to find the right method with as less as possible shortcuts.
> So any ideas here would be very helpful.

Uh....

Where exactly does type inference come in for an auto-completion 
feature for an IDE?

Something so heavyweight as type inferencing is unnecessary for doing 
90% of the work of figuring out what the likely completions for a 
particular chunk of code you're writing.

It would be far easier to just run etags over all the files you require 
and use those for auto-completion purposes.

vim has a workable solution for this (and I'm told emacs' solution is 
nearly, if not actually, identical), it simply auto-completes words 
that have the same beginning above your current location in the text 
before switching to words from other buffers.  (So if I typed 
b-<TAB>-<TAB>-<TAB> here, I would get 'buffers' then 'before' then 
'beginning' as possible completions.)

Extending this by reading files on require lines into etags would be 
pretty easy, and you could use some weighted sorting to keep commonly 
completed words only a few presses of tab away.

While this won't get an accurate completion every time, you really 
don't care.  You'll find that 90% of the time the word you want is less 
than 3 presses of tab away.

-- 
Eric Hodel - drbrain / segment7.net - http://segment7.net
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04