diff --git a/src/plugins/qmljseditor/qmlcodecompletion.cpp b/src/plugins/qmljseditor/qmlcodecompletion.cpp index 78b6249643da84490cac459ce4de75b0d45f0f79..10dedc173d453146639e53b52adef5ae1b4f4444 100644 --- a/src/plugins/qmljseditor/qmlcodecompletion.cpp +++ b/src/plugins/qmljseditor/qmlcodecompletion.cpp @@ -616,9 +616,8 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) m_completions.clear(); - QmlJS::Snapshot snapshot = m_modelManager->snapshot(); - SemanticInfo semanticInfo = edit->semanticInfo(); + const QmlJS::Snapshot snapshot = semanticInfo.snapshot; Document::Ptr qmlDocument = semanticInfo.document; if (qmlDocument.isNull()) return -1; diff --git a/src/plugins/qmljseditor/qmlhoverhandler.cpp b/src/plugins/qmljseditor/qmlhoverhandler.cpp index 79165eafbcc6266ccd32333c0c18515cce8bee39..44b5e8184d4c08fafee62a8deb988c80e4e71246 100644 --- a/src/plugins/qmljseditor/qmlhoverhandler.cpp +++ b/src/plugins/qmljseditor/qmlhoverhandler.cpp @@ -140,8 +140,8 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in if (!edit) return; - const Snapshot snapshot = m_modelManager->snapshot(); - SemanticInfo semanticInfo = edit->semanticInfo(); + const SemanticInfo semanticInfo = edit->semanticInfo(); + const Snapshot snapshot = semanticInfo.snapshot; Document::Ptr qmlDocument = semanticInfo.document; if (qmlDocument.isNull()) return; @@ -181,13 +181,7 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in QmlExpressionUnderCursor expressionUnderCursor; QmlJS::AST::ExpressionNode *expression = expressionUnderCursor(tc); - AST::UiObjectMember *declaringMember = 0; - - foreach (const Range &range, semanticInfo.ranges) { - if (pos >= range.begin.position() && pos <= range.end.position()) { - declaringMember = range.ast; - } - } + AST::UiObjectMember *declaringMember = semanticInfo.declaringMember(pos); Interpreter::Engine interp; Interpreter::ObjectValue *scope = Bind::scopeChainAt(qmlDocument, snapshot, &interp, declaringMember);