From 0117b1669b879b25759c440dd4acde44cdb6f162 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 24 Oct 2023 11:19:51 +0200 Subject: [PATCH] Python: use correct python language server after installation Change-Id: Ie5e26eedffc51e8916d849121fa60ea3d56e5a66 Reviewed-by: Christian Stenger --- src/plugins/python/pythonlanguageclient.cpp | 16 +++++----------- src/plugins/python/pythonlanguageclient.h | 2 -- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/plugins/python/pythonlanguageclient.cpp b/src/plugins/python/pythonlanguageclient.cpp index 750ab333826..b13aef42077 100644 --- a/src/plugins/python/pythonlanguageclient.cpp +++ b/src/plugins/python/pythonlanguageclient.cpp @@ -301,10 +301,13 @@ void PyLSConfigureAssistant::installPythonLanguageServer(const FilePath &python, auto install = new PipInstallTask(python); connect(install, &PipInstallTask::finished, this, [=](const bool success) { + const QList additionalDocuments = m_infoBarEntries.take(python); if (success) { - if (document) { - if (PyLSClient *client = clientForPython(python)) + if (PyLSClient *client = clientForPython(python)) { + if (document) LanguageClientManager::openDocumentWithClient(document, client); + for (TextEditor::TextDocument *additionalDocument : additionalDocuments) + LanguageClientManager::openDocumentWithClient(additionalDocument, client); } } install->deleteLater(); @@ -375,15 +378,6 @@ void PyLSConfigureAssistant::handlePyLSState(const FilePath &python, } } -void PyLSConfigureAssistant::updateEditorInfoBars(const FilePath &python, Client *client) -{ - for (TextEditor::TextDocument *document : instance()->m_infoBarEntries.take(python)) { - instance()->resetEditorInfoBar(document); - if (client) - LanguageClientManager::openDocumentWithClient(document, client); - } -} - void PyLSConfigureAssistant::resetEditorInfoBar(TextEditor::TextDocument *document) { for (QList &documents : m_infoBarEntries) diff --git a/src/plugins/python/pythonlanguageclient.h b/src/plugins/python/pythonlanguageclient.h index 82a4a73ea4f..41b559a0427 100644 --- a/src/plugins/python/pythonlanguageclient.h +++ b/src/plugins/python/pythonlanguageclient.h @@ -53,8 +53,6 @@ class PyLSConfigureAssistant : public QObject public: static PyLSConfigureAssistant *instance(); - static void updateEditorInfoBars(const Utils::FilePath &python, - LanguageClient::Client *client); static void openDocumentWithPython(const Utils::FilePath &python, TextEditor::TextDocument *document);