Add fallback help IDs to built-in model

Task-number: QTCREATORBUG-15959
Change-Id: I1e022450d09cb0e8565573079e412b26d09ce662
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Eike Ziller
2019-02-08 16:12:02 +01:00
parent 4420190192
commit d4415b02af

View File

@@ -26,6 +26,7 @@
#include "cpphoverhandler.h" #include "cpphoverhandler.h"
#include "cppelementevaluator.h" #include "cppelementevaluator.h"
#include "cpptoolsreuse.h"
#include <coreplugin/helpmanager.h> #include <coreplugin/helpmanager.h>
#include <texteditor/texteditor.h> #include <texteditor/texteditor.h>
@@ -56,14 +57,16 @@ void CppHoverHandler::identifyMatch(TextEditorWidget *editorWidget, int pos, Rep
tip += evaluator.diagnosis(); tip += evaluator.diagnosis();
setPriority(Priority_Diagnostic); setPriority(Priority_Diagnostic);
} }
const QStringList fallback = identifierWordsUnderCursor(tc);
if (evaluator.identifiedCppElement()) { if (evaluator.identifiedCppElement()) {
const QSharedPointer<CppElement> &cppElement = evaluator.cppElement(); const QSharedPointer<CppElement> &cppElement = evaluator.cppElement();
QStringList candidates = cppElement->helpIdCandidates; const QStringList candidates = cppElement->helpIdCandidates;
candidates.removeDuplicates(); const HelpItem helpItem(candidates + fallback, cppElement->helpMark, cppElement->helpCategory);
const HelpItem helpItem(candidates, cppElement->helpMark, cppElement->helpCategory);
setLastHelpItemIdentified(helpItem); // tool tip appended by decorateToolTip setLastHelpItemIdentified(helpItem); // tool tip appended by decorateToolTip
if (!helpItem.isValid()) if (!helpItem.isValid())
tip += cppElement->tooltip; tip += cppElement->tooltip;
} else {
setLastHelpItemIdentified({fallback, {}, HelpItem::Unknown});
} }
setToolTip(tip); setToolTip(tip);
} }