LanguageClient: Re-highlight also on empty deltas

This is needed for e.g. ClangdClient, which may need to update even if
the highlighting delta from the server is empty.

Task-number: QTCREATORBUG-26183
Change-Id: I38398c9563fa7a6a1906c5cb57fd1cbcd444cbd9
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-09-06 17:02:36 +02:00
parent c8bc0eb512
commit 847a03786c
5 changed files with 1 additions and 16 deletions

View File

@@ -1432,7 +1432,6 @@ ClangdTestCompletion::ClangdTestCompletion()
void ClangdTestCompletion::initTestCase()
{
ClangdTest::initTestCase();
client()->forceHighlightingOnEmptyDelta();
startCollectingHighlightingInfo();
}

View File

@@ -1016,13 +1016,6 @@ void Client::setSemanticTokensHandler(const SemanticTokensHandler &handler)
m_tokenSupport.setTokensHandler(handler);
}
#ifdef WITH_TESTS
void Client::forceHighlightingOnEmptyDelta()
{
m_tokenSupport.forceHighlightingOnEmptyDelta();
}
#endif
void Client::setSymbolStringifier(const LanguageServerProtocol::SymbolStringifier &stringifier)
{
m_symbolStringifier = stringifier;

View File

@@ -195,10 +195,6 @@ public:
void log(const LanguageServerProtocol::ResponseError<Error> &responseError) const
{ log(responseError.toString()); }
#ifdef WITH_TESTS
void forceHighlightingOnEmptyDelta();
#endif
signals:
void initialized(const LanguageServerProtocol::ServerCapabilities &capabilities);
void capabilitiesChanged(const DynamicCapabilities &capabilities);

View File

@@ -387,8 +387,7 @@ void SemanticTokenSupport::handleSemanticTokensDelta(
} else if (auto tokensDelta = Utils::get_if<SemanticTokensDelta>(&result)) {
QList<SemanticTokensEdit> edits = tokensDelta->edits();
if (edits.isEmpty()) {
if (m_highlightOnEmptyDelta)
highlight(filePath);
highlight(filePath);
return;
}

View File

@@ -81,7 +81,6 @@ public:
// void setAdditionalTokenModifierStyles(const QHash<int, TextEditor::TextStyle> &modifierStyles);
void setTokensHandler(const SemanticTokensHandler &handler) { m_tokensHandler = handler; }
void forceHighlightingOnEmptyDelta() { m_highlightOnEmptyDelta = true; }
private:
LanguageServerProtocol::SemanticRequestTypes supportedSemanticRequests(
@@ -107,7 +106,6 @@ private:
SemanticTokensHandler m_tokensHandler;
QStringList m_tokenTypeStrings;
QStringList m_tokenModifierStrings;
bool m_highlightOnEmptyDelta = false;
};
} // namespace LanguageClient