Hi, > Hi all, > > After givin to the subject some thought, and seeing that this item has > been onn the wishlist for some time now, I've drafted a simple > proposal for implementing code completion in GtkSourceView. > > The draft is written here: > http://devel.emmanuelebassi.net/papers/gtk-source-completion-engine.html > > And in Wiki form here: > http://wiki.emmanuelebassi.net/index.php?GtkSourceCompletionEngine > Nice to see someome is working on it. > +++ > > Since knowing how to complete code is something that it's bound to > each language (e.g. in C you could just match each word under the > cursor, optionally opening each #included file - but in Java you have > to scan through the packages and match the namespace before the point; > the same in Perl, but matching the double colon), we cannot implement > a code completion for each language. Plus, code completion could > require language introspection, or metadata handling; thus, code > completion is a tricky and per-language thing. > > Basically, the idea is to create a base class, and let each user > implement its own code completion method (with a basic "string match" > for a start); we could also offer a standard UI for showing the > alternatives. > > I plan to write up some preliminary code this weekend. If anyone has > suggestions or objections, I'd like to hear those (here on the list or > on the wiki). :-) I think you are right about the fact that gtksourceview should be language agnostic and so the real code completion algorithm must be implemented by the gtksourceview users. I have read your specification but I'm unable to comment on it since I have not understood how your GtkSourceCompletionEngine is going to interact with GtkSourceBuffer. Could you please try to be more clear about this really important aspect? Why complete takes two GtkTextIter as parameters and can_complete does not? I'm not sure that complete should return a list of strings. I think you should return some more complex object. For example, you would have to show the user the visibility (public/private/protected) of the function you are going to complete and eventually some form of documentation. I gave the problem of displaying an autocompletion list some thought last year and I should have a prototype on one of my PC... I will send you it if I will be able to find it. Ciao, Paolo
Attachment:
signature.asc
Description: This is a digitally signed message part