Update the ranges also for recovered ASTs.

This commit is contained in:
Roberto Raggi
2010-01-26 12:09:07 +01:00
parent 521c69a744
commit fbd624d170

View File

@@ -535,26 +535,30 @@ void QmlJSTextEditor::onDocumentUpdated(QmlJS::Document::Ptr doc)
m_idsRevision = document()->revision(); m_idsRevision = document()->revision();
m_ids = updateIds(doc->qmlProgram()); m_ids = updateIds(doc->qmlProgram());
if (doc->isParsedCorrectly()) { if (doc->ast()) {
// create the ranges // got a correctly parsed (or recovered) file.
// create the ranges and update the semantic info.
CreateRanges createRanges; CreateRanges createRanges;
SemanticInfo sem; SemanticInfo sem;
sem.document = doc; sem.document = doc;
sem.ranges = createRanges(document(), doc); sem.ranges = createRanges(document(), doc);
m_semanticInfo = sem; m_semanticInfo = sem;
FindDeclarations findDeclarations; if (doc->isParsedCorrectly()) {
m_declarations = findDeclarations(doc->ast()); FindDeclarations findDeclarations;
m_declarations = findDeclarations(doc->ast());
QStringList items; QStringList items;
items.append(tr("<Select Symbol>")); items.append(tr("<Select Symbol>"));
foreach (Declaration decl, m_declarations) foreach (Declaration decl, m_declarations)
items.append(decl.text); items.append(decl.text);
m_methodCombo->clear(); m_methodCombo->clear();
m_methodCombo->addItems(items); m_methodCombo->addItems(items);
updateMethodBoxIndex(); updateMethodBoxIndex();
}
} }
QList<QTextEdit::ExtraSelection> selections; QList<QTextEdit::ExtraSelection> selections;