Commit ea6514b2 authored by Nikolai Kosjar's avatar Nikolai Kosjar

C++: Show virtual functions menu only if resolving was requested

That is, if the user does Ctrl+LeftClick or (Ctrl+E,) F2, but not on
hover.

The described bug in the report occurred because we immediately jump to
an item if there is only one, e.g. in case of no overrides. That could
also happen on hover, which lead to the undesired effect.

Change-Id: I79f6fa1f90d37ea209da022d55d48aab2c13c21a
Task-number: QTCREATORBUG-12986
Reviewed-by: default avatarDavid Schulz <david.schulz@digia.com>
parent 51a18c84
......@@ -669,33 +669,33 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
if (Symbol *symbol = result.declaration()) {
Symbol *def = 0;
// Consider to show a pop-up displaying overrides for the function
Function *function = symbol->type()->asFunctionType();
VirtualFunctionHelper helper(*typeOfExpression, scope, doc, snapshot, symbolFinder);
if (helper.canLookupVirtualFunctionOverrides(function)) {
VirtualFunctionAssistProvider::Parameters params;
params.function = function;
params.staticClass = helper.staticClassOfFunctionCallExpression();
params.typeOfExpression = typeOfExpression;
params.snapshot = snapshot;
params.cursorPosition = cursor.position();
params.openInNextSplit = inNextSplit;
if (m_virtualFunctionAssistProvider->configure(params)) {
m_widget->invokeAssist(TextEditor::FollowSymbol,
m_virtualFunctionAssistProvider);
m_virtualFunctionAssistProvider->clearParams();
}
if (resolveTarget) {
// Consider to show a pop-up displaying overrides for the function
Function *function = symbol->type()->asFunctionType();
VirtualFunctionHelper helper(*typeOfExpression, scope, doc, snapshot, symbolFinder);
if (helper.canLookupVirtualFunctionOverrides(function)) {
VirtualFunctionAssistProvider::Parameters params;
params.function = function;
params.staticClass = helper.staticClassOfFunctionCallExpression();
params.typeOfExpression = typeOfExpression;
params.snapshot = snapshot;
params.cursorPosition = cursor.position();
params.openInNextSplit = inNextSplit;
if (m_virtualFunctionAssistProvider->configure(params)) {
m_widget->invokeAssist(TextEditor::FollowSymbol,
m_virtualFunctionAssistProvider);
m_virtualFunctionAssistProvider->clearParams();
}
// Ensure a valid link text, so the symbol name will be underlined on Ctrl+Hover.
Link link;
link.linkTextStart = beginOfToken;
link.linkTextEnd = endOfToken;
return link;
}
// Ensure a valid link text, so the symbol name will be underlined on Ctrl+Hover.
Link link;
link.linkTextStart = beginOfToken;
link.linkTextEnd = endOfToken;
return link;
}
if (resolveTarget) {
Symbol *lastVisibleSymbol = doc->lastVisibleSymbolAt(line, column);
def = findDefinition(symbol, snapshot, symbolFinder);
......
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