ClangdClient: Consolidate the job counter variables

We need only one of these.

Change-Id: Icb50890981fa1465e091abb42a52afc1b810fbf0
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-06-02 16:32:54 +02:00
parent 76cf6ce983
commit d6d2d18373

View File

@@ -632,10 +632,7 @@ public:
Utils::optional<SwitchDeclDefData> switchDeclDefData;
Utils::optional<LocalRefsData> localRefsData;
Utils::optional<QVersionNumber> versionNumber;
quint64 nextFindUsagesKey = 0;
quint64 nextFollowSymbolId = 0;
quint64 nextSwitchDeclDefId = 0;
quint64 nextLocalRefsId = 0;
quint64 nextJobId = 0;
bool isFullyIndexed = false;
bool isTesting = false;
};
@@ -728,7 +725,7 @@ void ClangdClient::findUsages(TextEditor::TextDocument *document, const QTextCur
return;
ReferencesData refData;
refData.key = d->nextFindUsagesKey++;
refData.key = d->nextJobId++;
if (replacement) {
ReplacementData replacementData;
replacementData.oldSymbolName = searchTerm;
@@ -1005,7 +1002,7 @@ void ClangdClient::followSymbol(
qCDebug(clangdLog) << "follow symbol requested" << document->filePath()
<< cursor.blockNumber() << cursor.positionInBlock();
d->followSymbolData.emplace(this, ++d->nextFollowSymbolId, cursor, editorWidget,
d->followSymbolData.emplace(this, ++d->nextJobId, cursor, editorWidget,
DocumentUri::fromFilePath(document->filePath()),
std::move(callback), openInSplit);
@@ -1053,7 +1050,7 @@ void ClangdClient::switchDeclDef(TextEditor::TextDocument *document, const QText
qCDebug(clangdLog) << "switch decl/dev requested" << document->filePath()
<< cursor.blockNumber() << cursor.positionInBlock();
d->switchDeclDefData.emplace(++d->nextSwitchDeclDefId, document, cursor, editorWidget,
d->switchDeclDefData.emplace(++d->nextJobId, document, cursor, editorWidget,
std::move(callback));
// Retrieve AST and document symbols.
@@ -1089,7 +1086,7 @@ void ClangdClient::findLocalUsages(TextEditor::TextDocument *document, const QTe
qCDebug(clangdLog) << "local references requested" << document->filePath()
<< (cursor.blockNumber() + 1) << (cursor.positionInBlock() + 1);
d->localRefsData.emplace(++d->nextLocalRefsId, document, cursor, std::move(callback));
d->localRefsData.emplace(++d->nextJobId, document, cursor, std::move(callback));
const QString searchTerm = d->searchTermFromCursor(cursor);
if (searchTerm.isEmpty()) {
d->localRefsData.reset();