Please, raise your hand if you'd like...

Alexander Dymo adymo at mksat.net
Thu Mar 10 20:12:06 UTC 2005


On Thursday 10 March 2005 16:09, Adam Treat wrote:
> Please, raise your hand if you’d like:
> * Color syntax highlighting in KDevelop’s code completion?
> * Icons in the entry list corresponding to the entry type … ctor, dtor,
> method, member, etc, etc?
I want those too.

> * Some sorting by entry type so all ctor’s come first, dtor’s next, etc,
> etc?
> * The ability to specify what parts of the entry are “completeable” eg, if
> I’m completing a method decl I don’t necessarily want to key the return
> type?
This means we want control over columns in the completion view.

> If so, then the following changes will need to be made to KTE Completion
> interfaces:
> * KTE::CompletionEntry needs methods for specifying an icon to go with the
> entry and comparison operator overloads to allow sorting by entry type. It
> also needs some way of specifying that a prefix/postfix should be inserted
> upon completion, but not part of the actual keying.
> * KTE::CodeCompletionInterface needs methods for determining if the current
> completion box isvisible and hiding methods.
<skip>
> The color syntax highlighting could be done in a couple different ways.
<skip>

A brief look at Qt4 classes shows that we can implement the features we want
more easily without having complicated completion interface.
Qt4 uses model-view architecture therefore we can feed the text editor
with a model (subclass of QAbstractListModel). This way we will get control
over columns in completion view and would be able to display icons.
And also we can pass a delegate to paint completion items (subclass of 
QAbstractItemDelegate). Our delegate will of course know how to paint our
model. This way we can implement colored syntax highlighting.

That approach will require only one method:
KTextEditor::CodeCompletionInterface::showCompletion(QAbstractItemModel 
*completionModel, QAbstractItemDelegate *completionDelegate);

-- 
Alexander Dymo
ICST Department, National University of Shipbuilding, Mykolayiv, Ukraine




More information about the KDevelop-devel mailing list