Commit 53d1eba3 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Use the snapshot from the semanticinfo when processign QML/JS documents.

parent 18dd2735
...@@ -616,9 +616,8 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) ...@@ -616,9 +616,8 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
m_completions.clear(); m_completions.clear();
QmlJS::Snapshot snapshot = m_modelManager->snapshot();
SemanticInfo semanticInfo = edit->semanticInfo(); SemanticInfo semanticInfo = edit->semanticInfo();
const QmlJS::Snapshot snapshot = semanticInfo.snapshot;
Document::Ptr qmlDocument = semanticInfo.document; Document::Ptr qmlDocument = semanticInfo.document;
if (qmlDocument.isNull()) if (qmlDocument.isNull())
return -1; return -1;
......
...@@ -140,8 +140,8 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in ...@@ -140,8 +140,8 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
if (!edit) if (!edit)
return; return;
const Snapshot snapshot = m_modelManager->snapshot(); const SemanticInfo semanticInfo = edit->semanticInfo();
SemanticInfo semanticInfo = edit->semanticInfo(); const Snapshot snapshot = semanticInfo.snapshot;
Document::Ptr qmlDocument = semanticInfo.document; Document::Ptr qmlDocument = semanticInfo.document;
if (qmlDocument.isNull()) if (qmlDocument.isNull())
return; return;
...@@ -181,13 +181,7 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in ...@@ -181,13 +181,7 @@ void QmlHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
QmlExpressionUnderCursor expressionUnderCursor; QmlExpressionUnderCursor expressionUnderCursor;
QmlJS::AST::ExpressionNode *expression = expressionUnderCursor(tc); QmlJS::AST::ExpressionNode *expression = expressionUnderCursor(tc);
AST::UiObjectMember *declaringMember = 0; AST::UiObjectMember *declaringMember = semanticInfo.declaringMember(pos);
foreach (const Range &range, semanticInfo.ranges) {
if (pos >= range.begin.position() && pos <= range.end.position()) {
declaringMember = range.ast;
}
}
Interpreter::Engine interp; Interpreter::Engine interp;
Interpreter::ObjectValue *scope = Bind::scopeChainAt(qmlDocument, snapshot, &interp, declaringMember); Interpreter::ObjectValue *scope = Bind::scopeChainAt(qmlDocument, snapshot, &interp, declaringMember);
......
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