forked from qt-creator/qt-creator
LanguageClient: deactivate documents on client shutdown
Change-Id: I0a3aa89b1390f3cb7d5816bb85d9fd538fb3f90b Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -879,6 +879,7 @@ void Client::deactivateDocument(TextEditor::TextDocument *document)
|
|||||||
TextEditor::TextEditorWidget *widget = textEditor->editorWidget();
|
TextEditor::TextEditorWidget *widget = textEditor->editorWidget();
|
||||||
widget->removeHoverHandler(&d->m_hoverHandler);
|
widget->removeHoverHandler(&d->m_hoverHandler);
|
||||||
widget->setExtraSelections(TextEditor::TextEditorWidget::CodeSemanticsSelection, {});
|
widget->setExtraSelections(TextEditor::TextEditorWidget::CodeSemanticsSelection, {});
|
||||||
|
updateEditorToolBar(editor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,10 +199,10 @@ void LanguageClientManager::shutdownClient(Client *client)
|
|||||||
if (!client)
|
if (!client)
|
||||||
return;
|
return;
|
||||||
qCDebug(Log) << "request client shutdown: " << client->name() << client;
|
qCDebug(Log) << "request client shutdown: " << client->name() << client;
|
||||||
// reset the documents for that client already when requesting the shutdown so they can get
|
// reset and deactivate the documents for that client by assigning a null client already when
|
||||||
// reassigned to another server right after this request to another server
|
// requesting the shutdown so they can get reassigned to another server right after this request
|
||||||
for (TextEditor::TextDocument *document : managerInstance->m_clientForDocument.keys(client))
|
for (TextEditor::TextDocument *document : managerInstance->m_clientForDocument.keys(client))
|
||||||
managerInstance->m_clientForDocument.remove(document);
|
openDocumentWithClient(document, nullptr);
|
||||||
if (client->reachable())
|
if (client->reachable())
|
||||||
client->shutdown();
|
client->shutdown();
|
||||||
else if (client->state() != Client::Shutdown && client->state() != Client::ShutdownRequested)
|
else if (client->state() != Client::Shutdown && client->state() != Client::ShutdownRequested)
|
||||||
@@ -409,6 +409,7 @@ void LanguageClientManager::openDocumentWithClient(TextEditor::TextDocument *doc
|
|||||||
Client *currentClient = clientForDocument(document);
|
Client *currentClient = clientForDocument(document);
|
||||||
if (client == currentClient)
|
if (client == currentClient)
|
||||||
return;
|
return;
|
||||||
|
managerInstance->m_clientForDocument.remove(document);
|
||||||
if (currentClient)
|
if (currentClient)
|
||||||
currentClient->deactivateDocument(document);
|
currentClient->deactivateDocument(document);
|
||||||
managerInstance->m_clientForDocument[document] = client;
|
managerInstance->m_clientForDocument[document] = client;
|
||||||
|
|||||||
Reference in New Issue
Block a user