forked from qt-creator/qt-creator
CMakeEditor: Add fallback help ID
Like we do for the BaseTextEditor. This allows users to get context help also for items that are not "commands", like various variables that have a meaning for CMake. Change-Id: Ie1af61bdffdeecb406b1dc7e6127000c17ea5a8e Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/textutils.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QTextBlock>
|
||||
@@ -71,7 +72,7 @@ void CMakeEditor::contextHelp(const HelpCallback &callback) const
|
||||
break;
|
||||
chr = characterAt(pos);
|
||||
if (chr == QLatin1Char('(')) {
|
||||
callback({});
|
||||
BaseTextEditor::contextHelp(callback);
|
||||
return;
|
||||
}
|
||||
} while (chr.unicode() != QChar::ParagraphSeparator);
|
||||
@@ -97,12 +98,13 @@ void CMakeEditor::contextHelp(const HelpCallback &callback) const
|
||||
|
||||
// Not a command
|
||||
if (chr != QLatin1Char('(')) {
|
||||
callback({});
|
||||
BaseTextEditor::contextHelp(callback);
|
||||
return;
|
||||
}
|
||||
|
||||
const QString id = "command/" + textAt(begin, end - begin).toLower();
|
||||
callback(id);
|
||||
callback(
|
||||
{{id, Utils::Text::wordUnderCursor(editorWidget()->textCursor())}, {}, HelpItem::Unknown});
|
||||
}
|
||||
|
||||
//
|
||||
|
Reference in New Issue
Block a user