[Qt-creator] QML/JS autocompletion

Adam Nalepka adam.nalepka at gmail.com
Tue Mar 3 11:33:25 CET 2015


Hi Qt Creator team,

We have questions regarding QMLJS autocompletion. We are developing
QtCreator plugin that is used to extend QML application. As it is possible
to edit QML/JS code within the plugin's editor, we would like to have
QML/JS autocompletion feature there. Best option for us would be to reuse
autocompletion feature that is already available in QmlJSEditor plugin.

We found out that if QmlJSCompletionAssistInterface symbol is exported from
QmlJSEditor plugin we be could have autocompletion using a code like:

QmlJSEditor::Internal::QmlJSCompletionAssistInterface *interface    =
        new QmlJSEditor::Internal::QmlJSCompletionAssistInterface(...)
QObject *object = ExtensionSystem::PluginManager::getObjectByClassName(

StringLiteral("QmlJSEditor::Internal::QmlJSCompletionAssistProvider");
CompletionAssistProvider *completionAssistProvider =
        qobject_cast<CompletionAssistProvider *>(object)
IAssistProcessor *processor = cas->createProcessor();
IAssistProposal *proposal = processor->perform(interface);

Would you mind to make QmlJSEditor autocompletion publicly available?
This could be benefitial for QmlDesigner plugin as well, since there is no
autocompletion there too.

Best Regards,
Adam Nalepka

---
 src/plugins/qmljseditor/qmljscompletionassist.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/plugins/qmljseditor/qmljscompletionassist.h
b/src/plugins/qmljseditor/qmljscompletionassist.h
index b68d794..9cc2c92 100644
--- a/src/plugins/qmljseditor/qmljscompletionassist.h
+++ b/src/plugins/qmljseditor/qmljscompletionassist.h
@@ -117,7 +117,7 @@ private:
 };


-class QmlJSCompletionAssistInterface : public
TextEditor::DefaultAssistInterface
+class QMLJSEDITOR_EXPORT QmlJSCompletionAssistInterface : public
TextEditor::DefaultAssistInterface
 {
 public:
     QmlJSCompletionAssistInterface(QTextDocument *textDocument,
-- 
1.8.2.2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20150303/be67a654/attachment.html>


More information about the Qt-creator mailing list