Commit fb48a262 authored by Erik Verbruggen's avatar Erik Verbruggen

Added a bit more completion for the DUI editor.

parent 7e7c9446
#include "duicompletionvisitor.h"
#include "duicodecompletion.h"
#include "duieditor.h"
#include <texteditor/basetexteditor.h>
......@@ -61,6 +61,21 @@ int DuiCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
m_completions.append(item);
}
DuiDocument::Ptr duiDocument = edit->duiDocument();
if (!duiDocument.isNull()) {
QmlJS::AST::UiProgram *program = duiDocument->program();
if (program) {
DuiCompletionVisitor visitor;
foreach (const QString &word, visitor(program, m_startPosition)) {
TextEditor::CompletionItem item(this);
item.m_text = word;
m_completions.append(item);
}
}
}
return pos;
}
......
......@@ -106,6 +106,8 @@ public:
virtual void unCommentSelection();
DuiDocument::Ptr duiDocument() const { return m_document; }
public slots:
virtual void setFontSettings(const TextEditor::FontSettings &);
......
......@@ -20,7 +20,8 @@ duieditoractionhandler.h \
duicodecompletion.h \
duieditorconstants.h \
duihoverhandler.h \
duidocument.h
duidocument.h \
duicompletionvisitor.h
SOURCES += duieditor.cpp \
duieditorfactory.cpp \
......@@ -29,6 +30,7 @@ duihighlighter.cpp \
duieditoractionhandler.cpp \
duicodecompletion.cpp \
duihoverhandler.cpp \
duidocument.cpp
duidocument.cpp \
duicompletionvisitor.cpp
RESOURCES += duieditor.qrc
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment