forked from qt-creator/qt-creator
LanguageClient: More verbose logging when clearing token data
Change-Id: I3f9883858fa2f23dff00cda9f556f0f4bbff127a Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -206,6 +206,10 @@ void SemanticTokenSupport::reloadSemanticTokens(TextDocument *textDocument)
|
||||
const TextDocumentIdentifier docId(DocumentUri::fromFilePath(filePath));
|
||||
auto responseCallback = [this, filePath, documentVersion = m_client->documentVersion(filePath)](
|
||||
const SemanticTokensFullRequest::Response &response) {
|
||||
if (const auto error = response.error()) {
|
||||
qCDebug(LOGLSPHIGHLIGHT)
|
||||
<< "received error" << error->code() << error->message() << "for" << filePath;
|
||||
}
|
||||
handleSemanticTokens(filePath, response.result().value_or(nullptr), documentVersion);
|
||||
};
|
||||
/*if (supportedRequests.testFlag(SemanticRequestType::Range)) {
|
||||
@@ -251,6 +255,10 @@ void SemanticTokenSupport::updateSemanticTokens(TextDocument *textDocument)
|
||||
request.setResponseCallback(
|
||||
[this, filePath, documentVersion](
|
||||
const SemanticTokensFullDeltaRequest::Response &response) {
|
||||
if (const auto error = response.error()) {
|
||||
qCDebug(LOGLSPHIGHLIGHT) << "received error" << error->code()
|
||||
<< error->message() << "for" << filePath;
|
||||
}
|
||||
handleSemanticTokensDelta(filePath,
|
||||
response.result().value_or(nullptr),
|
||||
documentVersion);
|
||||
@@ -408,6 +416,9 @@ void SemanticTokenSupport::handleSemanticTokens(const Utils::FilePath &filePath,
|
||||
m_tokens[filePath] = {*tokens, documentVersion};
|
||||
highlight(filePath);
|
||||
} else {
|
||||
qCDebug(LOGLSPHIGHLIGHT)
|
||||
<< "no data in reply to full semantic tokens request, clearing tokens"
|
||||
<< m_client->name() << filePath;
|
||||
m_tokens.remove(filePath);
|
||||
}
|
||||
}
|
||||
@@ -476,8 +487,10 @@ void SemanticTokenSupport::handleSemanticTokensDelta(
|
||||
tokens.setData(newData);
|
||||
tokens.setResultId(tokensDelta->resultId());
|
||||
} else {
|
||||
qCDebug(LOGLSPHIGHLIGHT)
|
||||
<< "no data in reply to semantic tokens delta request, clearing tokens"
|
||||
<< m_client->name() << filePath;
|
||||
m_tokens.remove(filePath);
|
||||
qCDebug(LOGLSPHIGHLIGHT) << "Data cleared";
|
||||
return;
|
||||
}
|
||||
highlight(filePath);
|
||||
|
||||
Reference in New Issue
Block a user