[Qt-creator] NimPlugin: autocompletion

Ziller Eike Eike.Ziller at theqtcompany.com
Fri May 22 08:30:37 CEST 2015


> On May 22, 2015, at 12:46 AM, Filippo Cucchetto <filippocucchetto at gmail.com> wrote:
> 
> Hi,
> i'm developing a QtCreator plugin for the Nim programming language here (https://github.com/filcuc/QtCreatorNimEditor). Actually i've syntax highlighting and indentation and i would like to start adding auto completion.
> The Nim programming language already provides a server app (nimsuggest)
> to which i can request suggestions/info passing the current file and cursor position. This means that i don't need to create a Nim parser and AST. 
> What are the minimum steps for showing up the QtCreator completion popup and for filling in the the menu entries?
> I've already gave a look to both the QmlEditor and CppEditor plugins so what i need is just the list of classes i should implement and the most important functions (maybe with an overall vision about how they relate to each other).
> 
> Thank you :)
> 

The simplest example that you can find, is probably ProFileEditor, which provides completion simply based on a fixed list of keywords.

In ProFileEditorFactory constructor:

     ProFileCompletionAssistProvider *pcap = new ProFileCompletionAssistProvider;
    setCompletionAssistProvider(pcap);

ProFileCompletionAssistProvider is a
 class ProFileCompletionAssistProvider : public TextEditor::CompletionAssistProvider

and mainly provides an instance of
 class TEXTEDITOR_EXPORT KeywordsCompletionAssistProcessor : public IAssistProcessor

which gets the information about the document and position through an “AssistInterface” and in turn provides an instance of
 class TEXTEDITOR_EXPORT GenericProposal : public IAssistProposal

which mainly consists of a list of AssistProposalItems

:D

Br, Eike

> -- 
> Filippo Cucchetto
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator

-- 
Eike Ziller, Senior Software Engineer - The Qt Company GmbH
 
The Qt Company GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B



More information about the Qt-creator mailing list