From 8b040192701475ec8f0652b162f90b6ad1c5ea57 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Thu, 17 Oct 2019 10:14:48 +0200 Subject: Python: Fix opening document in wrong pyls The document was always opened in the first of the configured python language servers. Change-Id: If33cb4a08884b93047016be1d8cf5c27ea7950d9 Reviewed-by: Christian Stenger --- src/plugins/python/pythonutils.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/plugins/python') diff --git a/src/plugins/python/pythonutils.cpp b/src/plugins/python/pythonutils.cpp index acb78ef4c3..0af6d5fd5a 100644 --- a/src/plugins/python/pythonutils.cpp +++ b/src/plugins/python/pythonutils.cpp @@ -328,8 +328,15 @@ void updateEditorInfoBar(const FilePath &python, TextEditor::TextDocument *docum { const PythonLanguageServerState &lsState = checkPythonLanguageServer(python); - if (lsState.state == PythonLanguageServerState::CanNotBeInstalled - || lsState.state == PythonLanguageServerState::AlreadyConfigured) { + if (lsState.state == PythonLanguageServerState::CanNotBeInstalled) + return; + if (lsState.state == PythonLanguageServerState::AlreadyConfigured) { + if (const LanguageClient::StdIOSettings *setting = languageServerForPython(python)) { + if (LanguageClient::Client *client + = LanguageClient::LanguageClientManager::clientForSetting(setting).value(0)) { + LanguageClient::LanguageClientManager::reOpenDocumentWithClient(document, client); + } + } return; } -- cgit v1.2.1