forked from qt-creator/qt-creator
Introduced Document::isQmlDocument() and Document::isJSDocument().
This commit is contained in:
@@ -703,10 +703,16 @@ int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
||||
}
|
||||
|
||||
// add qml extra words
|
||||
if (document && document->qmlProgram()) {
|
||||
if (isQmlFile) {
|
||||
static QStringList qmlWords;
|
||||
if (qmlWords.isEmpty())
|
||||
qmlWords << "property" << "readonly" << "signal";
|
||||
|
||||
if (qmlWords.isEmpty()) {
|
||||
qmlWords << QLatin1String("property")
|
||||
<< QLatin1String("readonly")
|
||||
<< QLatin1String("signal")
|
||||
<< QLatin1String("import");
|
||||
}
|
||||
|
||||
foreach (const QString &word, qmlWords) {
|
||||
TextEditor::CompletionItem item(this);
|
||||
item.text = word;
|
||||
|
||||
@@ -1354,12 +1354,7 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source)
|
||||
if (! doc) {
|
||||
snapshot = source.snapshot;
|
||||
doc = snapshot.documentFromSource(source.code, source.fileName);
|
||||
|
||||
// ### This doesn't really work: what if snapshot doesn't have the doc?
|
||||
if (snapshot.document(source.fileName)->qmlProgram())
|
||||
doc->parseQml();
|
||||
else if (snapshot.document(source.fileName)->jsProgram())
|
||||
doc->parseJavaScript();
|
||||
doc->parse();
|
||||
}
|
||||
|
||||
SemanticInfo semanticInfo;
|
||||
|
||||
Reference in New Issue
Block a user