Copilot: start the client in the delayed initialize phase

Change-Id: I4470491f5f0a2b1d88ed5b2e23444bf3a28d8256
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
David Schulz
2023-08-31 08:15:34 +02:00
parent 70f5d18fe9
commit 270a9839e2
2 changed files with 10 additions and 4 deletions

View File

@@ -57,10 +57,6 @@ void cycleSuggestion(TextEditor::TextEditorWidget *editor, Direction direction)
void CopilotPlugin::initialize()
{
restartClient();
connect(&settings(), &AspectContainer::applied, this, &CopilotPlugin::restartClient);
QAction *requestAction = new QAction(this);
requestAction->setText(Tr::tr("Request Copilot Suggestion"));
requestAction->setToolTip(
@@ -151,6 +147,15 @@ void CopilotPlugin::initialize()
ProjectPanelFactory::registerFactory(panelFactory);
}
bool CopilotPlugin::delayedInitialize()
{
restartClient();
connect(&settings(), &AspectContainer::applied, this, &CopilotPlugin::restartClient);
return true;
}
void CopilotPlugin::restartClient()
{
LanguageClient::LanguageClientManager::shutdownClient(m_client);

View File

@@ -19,6 +19,7 @@ class CopilotPlugin : public ExtensionSystem::IPlugin
public:
void initialize() override;
bool delayedInitialize() override;
void restartClient();
ShutdownFlag aboutToShutdown() override;