forked from qt-creator/qt-creator
Disable the QML black magic thingie when working on JS files.
This commit is contained in:
@@ -787,6 +787,10 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
|||||||
const QFileInfo currentFileInfo(fileName);
|
const QFileInfo currentFileInfo(fileName);
|
||||||
const QString currentFilePath = currentFileInfo.absolutePath();
|
const QString currentFilePath = currentFileInfo.absolutePath();
|
||||||
|
|
||||||
|
bool isQmlFile = false;
|
||||||
|
if (currentFileInfo.suffix() == QLatin1String("qml"))
|
||||||
|
isQmlFile = true;
|
||||||
|
|
||||||
const QIcon componentIcon = iconForColor(Qt::yellow);
|
const QIcon componentIcon = iconForColor(Qt::yellow);
|
||||||
const QIcon symbolIcon = iconForColor(Qt::darkCyan);
|
const QIcon symbolIcon = iconForColor(Qt::darkCyan);
|
||||||
|
|
||||||
@@ -840,7 +844,10 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set up the current scope chain.
|
// Set up the current scope chain.
|
||||||
Interpreter::ObjectValue *scope = interp.newObject(/* prototype = */ 0);
|
Interpreter::ObjectValue *scope = interp.globalObject();
|
||||||
|
|
||||||
|
if (isQmlFile) {
|
||||||
|
scope = interp.newObject(/* prototype = */ 0);
|
||||||
|
|
||||||
AST::UiObjectMember *declaringMember = 0;
|
AST::UiObjectMember *declaringMember = 0;
|
||||||
AST::UiObjectMember *parentMember = 0;
|
AST::UiObjectMember *parentMember = 0;
|
||||||
@@ -899,6 +906,7 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
|||||||
|
|
||||||
if (parentItem)
|
if (parentItem)
|
||||||
scope->setProperty(QLatin1String("parent"), parentItem);
|
scope->setProperty(QLatin1String("parent"), parentItem);
|
||||||
|
}
|
||||||
|
|
||||||
// Search for the operator that triggered the completion.
|
// Search for the operator that triggered the completion.
|
||||||
QChar completionOperator;
|
QChar completionOperator;
|
||||||
@@ -995,6 +1003,7 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isQmlFile) {
|
||||||
if (completionOperator.isNull()
|
if (completionOperator.isNull()
|
||||||
|| completionOperator.isSpace()
|
|| completionOperator.isSpace()
|
||||||
|| completionOperator == QLatin1Char('{')
|
|| completionOperator == QLatin1Char('{')
|
||||||
@@ -1004,6 +1013,7 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
|||||||
updateSnippets();
|
updateSnippets();
|
||||||
m_completions.append(m_snippets);
|
m_completions.append(m_snippets);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! m_completions.isEmpty())
|
if (! m_completions.isEmpty())
|
||||||
return m_startPosition;
|
return m_startPosition;
|
||||||
|
|||||||
Reference in New Issue
Block a user