Commit 926144dc authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Prefer Classes to constructors when building the `help id'

parent 8d9ccaff
...@@ -337,6 +337,14 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in ...@@ -337,6 +337,14 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
firstType = resolve(firstType, typeOfExpression.lookupContext(), firstType = resolve(firstType, typeOfExpression.lookupContext(),
&resolvedSymbol, &resolvedName); &resolvedSymbol, &resolvedName);
if (resolvedSymbol && resolvedSymbol->scope()->isClassScope()) {
Class *enclosingClass = resolvedSymbol->scope()->owner()->asClass();
if (Identifier *id = enclosingClass->identifier()) {
if (id->isEqualTo(resolvedSymbol->identifier()))
resolvedSymbol = enclosingClass;
}
}
m_helpId = buildHelpId(resolvedSymbol, resolvedName); m_helpId = buildHelpId(resolvedSymbol, resolvedName);
if (m_toolTip.isEmpty()) { if (m_toolTip.isEmpty()) {
...@@ -349,7 +357,10 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in ...@@ -349,7 +357,10 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
overview.setShowReturnTypes(true); overview.setShowReturnTypes(true);
overview.setShowFullyQualifiedNamed(true); overview.setShowFullyQualifiedNamed(true);
if (lookupSymbol && (lookupSymbol->isDeclaration() || lookupSymbol->isArgument())) { if (symbol == resolvedSymbol && symbol->isClass()) {
m_toolTip = m_helpId;
} else if (lookupSymbol && (lookupSymbol->isDeclaration() || lookupSymbol->isArgument())) {
m_toolTip = overview.prettyType(firstType, buildHelpId(lookupSymbol, lookupSymbol->name())); m_toolTip = overview.prettyType(firstType, buildHelpId(lookupSymbol, lookupSymbol->name()));
} else if (firstType->isClassType() || firstType->isEnumType() || } else if (firstType->isClassType() || firstType->isEnumType() ||
......
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