[Mono-dev] Completion refactoring?

Lluis Sanchez lluis at ximian.com
Mon Aug 15 10:44:25 EDT 2005

Please send MonoDevelop related mails to the monodevelop list.

El dg 14 de 08 del 2005 a les 00:00 +0100, en/na Alexandre Miguel Pedro
Gomes va escriure: 
> I've been looking into completion lately and I've a few questions,
> comments and suggestions to do.
> First thing to say is that I don't like the "new concept" of having
> completion window under MonoDevelop.Base.Gui. I do believe that is
> specific to the source editor widget.

It is not. Code completion will be useful in other contexts, completely
unrelated to the SourceEditor. For example, when adding an expression
watch to the debugger watch window.

> Secondly, there is a lot of logic code inside the Source Editor; That's
> bad! We are doing 2 things wrong in this topic, we are doing
> "C#-parsing" and we are processing the completion there too

The parsing is done by the ParserService, not by the Source Editor.

>  - I had no
> time to check, 

You should check what are you talking about, before posting suggestions
on it.

> but I suppose boo, vb.net and other completion is done
> somewhere else, where?

Language addin can provide IParser implementations, which are used by
the parser service to parse files.

> The problem is that there isn't anything better to know what and when to
> show the help the user needs than the Language Binding itself.
> So, here is my suggestion:
> 1. There should be a kind of SourceEditor Specification that states that
> it should be able to show completion windows, insight-window and even
> other 'tooltips'.

What is a "SourceEditor Specification"? A set of interfaces to be
implemented? Please be more specific.

MD is based on services. A text editor is free to use any service it
wants to do its job. Code completion is just another service.

> 2. SourceEditor should be associated with a LanguageBinding and
> interactively notify the LanguageBinding about current "iter"/caret
> position

The SourceEditor already has this kind of relation with the

> 3. Based on that data the LanguageBinding can tell the Source Editor to
> show "these completion options" or "this insight window", etc...

The logic for determining when to show the completion window is right
now in the editor. And I agree with you in this point, it should be
somewhere else (but definitely, not in LanguageBinding).

> 4. When the context is made invalid, LanguageBinding tell Source Editor
> to hide the completion/... windows
> Using this work-flow we win several things:
> 1. Better support to implement completion-information for new languages
> 2. Better abstraction enabling third-party Source Editor or, even,
> Completion Window, etc...
> 3. New helper "tools", examples for C#:
> * "Press TAB to implement event/interface/abstract class"
> * Refactoring and Templates
> * "Goto Definition"

This is completely unrelated to code completion.

> * See only fit-able properties/methods for that method param/assign (ex:
> foo (int a) would only show methods/properties/fields that return int
> when completion opens in 'foo (')
> I don't believe the current Language Binding can support that now and in
> a easy way. Maybe we need a new class to do that?

Just to be a bit more concrete: what we need is a class that the editor
can use to take a decision about when to show the code completion

It would be awesome if you can provide a patch for this. Thanks!

More information about the Mono-devel-list mailing list