forked from qt-creator/qt-creator
ClangCodeModel: Fix access type categorization with clangd
... in "Find References".
This was broken in d6acd21fc0.
Change-Id: I0a185a8440bd5260b7cc18a87cefb450be71e77f
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -683,7 +683,8 @@ public:
|
||||
: q(q), settings(CppTools::ClangdProjectSettings(project).settings()) {}
|
||||
|
||||
void findUsages(TextEditor::TextDocument *document, const QTextCursor &cursor,
|
||||
const QString &searchTerm, const Utils::optional<QString> &replacement);
|
||||
const QString &searchTerm, const Utils::optional<QString> &replacement,
|
||||
bool categorize);
|
||||
void handleFindUsagesResult(quint64 key, const QList<Location> &locations);
|
||||
static void handleRenameRequest(const SearchResult *search,
|
||||
const ReplacementData &replacementData,
|
||||
@@ -880,7 +881,8 @@ void ClangdClient::findUsages(TextEditor::TextDocument *document, const QTextCur
|
||||
const TextDocumentIdentifier docId(DocumentUri::fromFilePath(document->filePath()));
|
||||
const TextDocumentPositionParams params(docId, Range(cursor).start());
|
||||
SymbolInfoRequest symReq(params);
|
||||
symReq.setResponseCallback([this, doc = QPointer(document), cursor, replacement]
|
||||
const bool categorize = CppTools::codeModelSettings()->categorizeFindReferences();
|
||||
symReq.setResponseCallback([this, doc = QPointer(document), cursor, replacement, categorize]
|
||||
(const SymbolInfoRequest::Response &response) {
|
||||
if (!doc)
|
||||
return;
|
||||
@@ -893,7 +895,7 @@ void ClangdClient::findUsages(TextEditor::TextDocument *document, const QTextCur
|
||||
const SymbolDetails &sd = list->first();
|
||||
if (sd.name().isEmpty())
|
||||
return;
|
||||
d->findUsages(doc.data(), cursor, sd.name(), replacement);
|
||||
d->findUsages(doc.data(), cursor, sd.name(), replacement, categorize);
|
||||
});
|
||||
sendContent(symReq);
|
||||
}
|
||||
@@ -938,10 +940,11 @@ CppTools::ClangdSettings::Data ClangdClient::settingsData() const { return d->se
|
||||
|
||||
void ClangdClient::Private::findUsages(TextEditor::TextDocument *document,
|
||||
const QTextCursor &cursor, const QString &searchTerm,
|
||||
const Utils::optional<QString> &replacement)
|
||||
const Utils::optional<QString> &replacement, bool categorize)
|
||||
{
|
||||
ReferencesData refData;
|
||||
refData.key = nextJobId++;
|
||||
refData.categorize = categorize;
|
||||
if (replacement) {
|
||||
ReplacementData replacementData;
|
||||
replacementData.oldSymbolName = searchTerm;
|
||||
|
||||
Reference in New Issue
Block a user