LanguageClient: postpone outline update until documents are opened

Skip the outline update in the initialize callback since no documents
are opened at that point in time and
LanguageClientOutlineWidgetFactory::supportsEditor will always return
false. The update will be triggered in
Client::activateDocument instead.

Change-Id: Ib26115c2344f7a424c31ce09b751a1d711a93aae
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
David Schulz
2022-08-23 10:57:11 +02:00
parent 662528675c
commit aeb5f90d71
2 changed files with 9 additions and 11 deletions

View File

@@ -131,8 +131,11 @@ void LanguageClientManager::clientFinished(Client *client)
client->log(
tr("Unexpectedly finished. Restarting in %1 seconds.").arg(restartTimeoutS));
QTimer::singleShot(restartTimeoutS * 1000, client, [client]() { client->start(); });
for (TextEditor::TextDocument *document : clientDocs)
for (TextEditor::TextDocument *document : clientDocs) {
client->deactivateDocument(document);
if (Core::EditorManager::currentEditor()->document() == document)
TextEditor::IOutlineWidgetFactory::updateOutline();
}
return;
}
qCDebug(Log) << "client finished unexpectedly: " << client->name() << client;
@@ -401,8 +404,9 @@ void LanguageClientManager::openDocumentWithClient(TextEditor::TextDocument *doc
client->openDocument(document);
else
client->activateDocument(document);
} else if (Core::EditorManager::currentEditor()->document() == document) {
TextEditor::IOutlineWidgetFactory::updateOutline();
}
TextEditor::IOutlineWidgetFactory::updateOutline();
}
void LanguageClientManager::logJsonRpcMessage(const LspLogMessage::MessageSender sender,