diff options
author | David Schulz <david.schulz@qt.io> | 2020-05-14 08:15:39 +0200 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2020-05-14 09:46:55 +0000 |
commit | f3407bb0ca5ca06a2b64e993c9d270774facfebc (patch) | |
tree | 27a8ab03f4ede8afac7a5887bc6023a3fd176232 /src/plugins/languageclient/languageclientcompletionassist.cpp | |
parent | 32d29f5a11d38324ae0a1f82e874c8f1c8d6b250 (diff) | |
download | qt-creator-f3407bb0ca5ca06a2b64e993c9d270774facfebc.tar.gz |
LSP: fix codeassists running check
Since MessageId is always valid (needs to be fixed separately)
use an optional to store whether we have a request running.
Change-Id: I7a1f136a09d776b33509bc914247d11076abeaa5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/languageclient/languageclientcompletionassist.cpp')
-rw-r--r-- | src/plugins/languageclient/languageclientcompletionassist.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/languageclient/languageclientcompletionassist.cpp b/src/plugins/languageclient/languageclientcompletionassist.cpp index a5d0c9774f..0bccccbff6 100644 --- a/src/plugins/languageclient/languageclientcompletionassist.cpp +++ b/src/plugins/languageclient/languageclientcompletionassist.cpp @@ -285,7 +285,7 @@ private: QPointer<QTextDocument> m_document; QPointer<Client> m_client; - MessageId m_currentRequest; + Utils::optional<MessageId> m_currentRequest; int m_pos = -1; }; @@ -353,15 +353,15 @@ IAssistProposal *LanguageClientCompletionAssistProcessor::perform(const AssistIn bool LanguageClientCompletionAssistProcessor::running() { - return m_currentRequest.isValid(); + return m_currentRequest.has_value(); } void LanguageClientCompletionAssistProcessor::cancel() { if (running()) { - m_client->cancelRequest(m_currentRequest); + m_client->cancelRequest(m_currentRequest.value()); m_client->removeAssistProcessor(this); - m_currentRequest = MessageId(); + m_currentRequest.reset(); } } @@ -370,7 +370,7 @@ void LanguageClientCompletionAssistProcessor::handleCompletionResponse( { // We must report back to the code assistant under all circumstances qCDebug(LOGLSPCOMPLETION) << QTime::currentTime() << " : got completions"; - m_currentRequest = MessageId(); + m_currentRequest.reset(); QTC_ASSERT(m_client, setAsyncProposalAvailable(nullptr); return); if (auto error = response.error()) m_client->log(error.value()); |