Merge remote-tracking branch 'origin/6.0'

Change-Id: I773141d47e3f2b773da51f2e26ef53b93bb28f90
This commit is contained in:
hjk
2021-11-22 13:17:33 +01:00
41 changed files with 177 additions and 129 deletions

View File

@@ -1623,14 +1623,20 @@ void ClangdClient::Private::handleFindUsagesResult(quint64 key, const QList<Loca
for (const Location &loc : locations)
refData->fileData[loc.uri()].rangesAndLineText << qMakePair(loc.range(), QString());
for (auto it = refData->fileData.begin(); it != refData->fileData.end(); ++it) {
const QStringList lines = SymbolSupport::getFileContents(it.key().toFilePath());
for (auto it = refData->fileData.begin(); it != refData->fileData.end();) {
const Utils::FilePath filePath = it.key().toFilePath();
if (!filePath.exists()) { // https://github.com/clangd/clangd/issues/935
it = refData->fileData.erase(it);
continue;
}
const QStringList lines = SymbolSupport::getFileContents(filePath);
it->fileContent = lines.join('\n');
for (auto &rangeWithText : it.value().rangesAndLineText) {
const int lineNo = rangeWithText.first.start().line();
if (lineNo >= 0 && lineNo < lines.size())
rangeWithText.second = lines.at(lineNo);
}
++it;
}
qCDebug(clangdLog) << "document count is" << refData->fileData.size();

View File

@@ -398,7 +398,7 @@ bool ClangdTextMark::addToolTipContent(QLayout *target) const
return c && c->reachable() && c->hasDiagnostic(DocumentUri::fromFilePath(fp), diag);
};
target->addWidget(ClangDiagnosticWidget::createWidget({m_diagnostic},
ClangDiagnosticWidget::ToolTip, canApplyFixIt, "clangd"));
ClangDiagnosticWidget::ToolTip, canApplyFixIt, m_client ? m_client->name() : "clangd"));
return true;
}

View File

@@ -636,7 +636,7 @@ void ClangdTestTooltips::test()
helpItem = h;
loop.quit();
};
connect(client(), &ClangdClient::helpItemGathered, handler);
connect(client(), &ClangdClient::helpItemGathered, &loop, handler);
QTextCursor cursor(doc->document());
const int pos = Utils::Text::positionInText(doc->document(), line, column);