diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2022-05-20 15:27:32 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2022-05-23 08:31:53 +0000 |
commit | 2c24dc03acb59cec2c62eb994892e468703427fa (patch) | |
tree | c7ef7aced8af369900311f599fb09f3fe2704f2e | |
parent | b05fc053ef08352a951baa4667b215ddc98620cc (diff) | |
download | qt-creator-2c24dc03acb59cec2c62eb994892e468703427fa.tar.gz |
LanguageClient: Request semantic tokens right away on document save
There's a good argument to be made that a doument save should bypass the
usual waiting period for requesting new semantic tokens.
Fixes: QTCREATORBUG-27403
Change-Id: I8355147116bccdcbcd4f6689b4d9c7a282d324be
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
-rw-r--r-- | src/plugins/languageclient/client.cpp | 7 | ||||
-rw-r--r-- | src/plugins/languageclient/client.h | 3 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/languageclient/client.cpp b/src/plugins/languageclient/client.cpp index a89ef2a821..bd2c85e191 100644 --- a/src/plugins/languageclient/client.cpp +++ b/src/plugins/languageclient/client.cpp @@ -482,12 +482,13 @@ void Client::openDocument(TextEditor::TextDocument *document) } } -void Client::sendMessage(const JsonRpcMessage &message, SendDocUpdates sendUpdates) +void Client::sendMessage(const JsonRpcMessage &message, SendDocUpdates sendUpdates, + Schedule semanticTokensSchedule) { QTC_ASSERT(m_clientInterface, return); QTC_ASSERT(m_state == Initialized, return); if (sendUpdates == SendDocUpdates::Send) - sendPostponedDocumentUpdates(Schedule::Delayed); + sendPostponedDocumentUpdates(semanticTokensSchedule); if (Utils::optional<ResponseHandler> responseHandler = message.responseHandler()) m_responseHandlers[responseHandler->id] = responseHandler->callback; QString error; @@ -749,7 +750,7 @@ void Client::documentContentsSaved(TextEditor::TextDocument *document) TextDocumentIdentifier(DocumentUri::fromFilePath(document->filePath()))); if (includeText) params.setText(document->plainText()); - sendMessage(DidSaveTextDocumentNotification(params)); + sendMessage(DidSaveTextDocumentNotification(params), SendDocUpdates::Send, Schedule::Now); } void Client::documentWillSave(Core::IDocument *document) diff --git a/src/plugins/languageclient/client.h b/src/plugins/languageclient/client.h index 80a6f3144f..2f1661a6f4 100644 --- a/src/plugins/languageclient/client.h +++ b/src/plugins/languageclient/client.h @@ -102,7 +102,8 @@ public: enum class SendDocUpdates { Send, Ignore }; void sendMessage(const LanguageServerProtocol::JsonRpcMessage &message, - SendDocUpdates sendUpdates = SendDocUpdates::Send); + SendDocUpdates sendUpdates = SendDocUpdates::Send, + Schedule semanticTokensSchedule = Schedule::Delayed); void cancelRequest(const LanguageServerProtocol::MessageId &id); |