C++ editor: Try to find a help item if there is a syntax error

Task-number: QTCREATORBUG-2674
This commit is contained in:
Leandro Melo
2011-01-17 16:29:57 +01:00
parent 51c4740266
commit bcaf20319d
6 changed files with 87 additions and 62 deletions

View File

@@ -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