Multilang code completion

Milian Wolff mail at milianw.de
Mon Aug 2 19:23:37 UTC 2010


Hello,

I'd like some feedback on how I should implement multi language code 
completion in a single file. Right now I see more or less two possible ways:

1) Listen to cursorChanged signals in KDevelop::CodeCompletion and then use

    DUChainUtils::languageForContext(top->findContextAt(newPosition)

The problem with this imo is that it would require that lookup everytime the 
cursor is changed and afaik that signal is emitted for every cursor someone 
inserts. Since text editing is sluggish even now (at least compared to plain 
Kate imo) I don't want to waste more time there. So maybe this approach is 
better:

2) have one "master" model registered to the text document and let it delegate 
to the proper model from inside completionInvoked.

3) similar to 2) we could also simply register all models all the time and 
filter the correct ones in the completionInvoked method. Of course more 
overhead than 2) albeit far less changes required.

What do you think?
-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20100802/26b3923a/attachment.sig>


More information about the KDevelop-devel mailing list