forked from qt-creator/qt-creator
LanguageClient: Add signal to inform about WorkDoneProgressEnd
... and make use of it in the clangd client to be able tell when background indexing has finished. Change-Id: I0f3c6f9646fd66ababd08c12b2f347da5f1a3729 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -1250,6 +1250,8 @@ void Client::handleMethod(const QString &method, const MessageId &id, const ICon
|
||||
if (!params->isValid())
|
||||
logError(*params);
|
||||
m_progressManager.handleProgress(*params);
|
||||
if (ProgressManager::isProgressEndMessage(*params))
|
||||
emit workDone(params->token());
|
||||
}
|
||||
} else if (id.isValid()) {
|
||||
Response<JsonObject, JsonObject> response(id);
|
||||
|
||||
@@ -178,6 +178,7 @@ signals:
|
||||
void initialized(const LanguageServerProtocol::ServerCapabilities &capabilities);
|
||||
void capabilitiesChanged(const DynamicCapabilities &capabilities);
|
||||
void documentUpdated(TextEditor::TextDocument *document);
|
||||
void workDone(const LanguageServerProtocol::ProgressToken &token);
|
||||
void finished();
|
||||
|
||||
protected:
|
||||
|
||||
@@ -61,6 +61,11 @@ void ProgressManager::setTitleForToken(const LanguageServerProtocol::ProgressTok
|
||||
m_titles.insert(token, message);
|
||||
}
|
||||
|
||||
bool ProgressManager::isProgressEndMessage(const LanguageServerProtocol::ProgressParams ¶ms)
|
||||
{
|
||||
return Utils::holds_alternative<WorkDoneProgressEnd>(params.value());
|
||||
}
|
||||
|
||||
Utils::Id languageClientProgressId(const ProgressToken &token)
|
||||
{
|
||||
constexpr char k_LanguageClientProgressId[] = "LanguageClient.ProgressId.";
|
||||
|
||||
@@ -49,6 +49,8 @@ public:
|
||||
void setTitleForToken(const LanguageServerProtocol::ProgressToken &token,
|
||||
const QString &message);
|
||||
|
||||
static bool isProgressEndMessage(const LanguageServerProtocol::ProgressParams ¶ms);
|
||||
|
||||
private:
|
||||
void beginProgress(const LanguageServerProtocol::ProgressToken &token,
|
||||
const LanguageServerProtocol::WorkDoneProgressBegin &begin);
|
||||
|
||||
Reference in New Issue
Block a user