diff --git a/src/plugins/languageclient/semantichighlightsupport.cpp b/src/plugins/languageclient/semantichighlightsupport.cpp index 444cb23439c..905ab0169af 100644 --- a/src/plugins/languageclient/semantichighlightsupport.cpp +++ b/src/plugins/languageclient/semantichighlightsupport.cpp @@ -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);