forked from qt-creator/qt-creator
C++ editor: Try to find a help item if there is a syntax error
Task-number: QTCREATORBUG-2674
This commit is contained in:
@@ -78,9 +78,15 @@ void CppHoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos)
|
||||
|
||||
CppElementEvaluator evaluator(cppEditor);
|
||||
evaluator.setTextCursor(tc);
|
||||
QSharedPointer<CppElement> cppElement = evaluator.identifyCppElement();
|
||||
if (!cppElement.isNull()) {
|
||||
setToolTip(cppElement->tooltip());
|
||||
evaluator.execute();
|
||||
if (evaluator.hasDiagnosis()) {
|
||||
setToolTip(evaluator.diagnosis());
|
||||
setIsDiagnosticTooltip(true);
|
||||
}
|
||||
if (evaluator.identifiedCppElement()) {
|
||||
const QSharedPointer<CppElement> &cppElement = evaluator.cppElement();
|
||||
if (!isDiagnosticTooltip())
|
||||
setToolTip(cppElement->tooltip());
|
||||
foreach (const QString &helpId, cppElement->helpIdCandidates()) {
|
||||
if (!Core::HelpManager::instance()->linksForIdentifier(helpId).isEmpty()) {
|
||||
setLastHelpItemIdentified(TextEditor::HelpItem(helpId,
|
||||
@@ -98,6 +104,9 @@ void CppHoverHandler::decorateToolTip()
|
||||
if (Qt::mightBeRichText(toolTip()))
|
||||
setToolTip(Qt::escape(toolTip()));
|
||||
|
||||
if (isDiagnosticTooltip())
|
||||
return;
|
||||
|
||||
const TextEditor::HelpItem &help = lastHelpItemIdentified();
|
||||
if (help.isValid()) {
|
||||
// If Qt is built with a namespace, we still show the tip without it, as
|
||||
|
||||
Reference in New Issue
Block a user