forked from qt-creator/qt-creator
CMakeToolManager: Add static readFirstParagraphs()
Reuse it in CMakeEditor and CMakeFileCompletionAssistProvider.
Amends d04585b519
Change-Id: I8dbd59c815e017404ff215ca1ff68740d6653e91
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
committed by
Cristian Adam
parent
cbc6809b28
commit
4e90ca1b59
@@ -167,6 +167,21 @@ void CMakeToolManager::updateDocumentation()
|
||||
Core::HelpManager::registerDocumentation(docs);
|
||||
}
|
||||
|
||||
QString CMakeToolManager::readFirstParagraphs(const FilePath &helpFile)
|
||||
{
|
||||
static QMap<FilePath, QString> map;
|
||||
if (map.contains(helpFile))
|
||||
return map.value(helpFile);
|
||||
|
||||
auto content = helpFile.fileContents(1024).value_or(QByteArray());
|
||||
const QString firstParagraphs
|
||||
= QString("```\n%1\n```").arg(QString::fromUtf8(content.left(content.lastIndexOf("\n"))));
|
||||
|
||||
map[helpFile] = firstParagraphs;
|
||||
return firstParagraphs;
|
||||
}
|
||||
|
||||
|
||||
QList<Id> CMakeToolManager::autoDetectCMakeForDevice(const FilePaths &searchPaths,
|
||||
const QString &detectionSource,
|
||||
QString *logMessage)
|
||||
|
||||
Reference in New Issue
Block a user