From 8f5109b6eee4d61207474916404621fb6a675811 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 12 May 2020 09:20:01 +0200 Subject: LSP: Robustify open documents Use Client::openDocument if you just want to open a document and activate it if it is not already used in another client. Use LanguageClientManager::openDocumentWithClient if you want to make sure a document is opened _and_ activated for a specific client. Change-Id: I6b790f15e17335ce2dc8981a04d2cd571b22b66b Reviewed-by: Christian Stenger --- src/plugins/python/pythonutils.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/plugins/python/pythonutils.cpp') diff --git a/src/plugins/python/pythonutils.cpp b/src/plugins/python/pythonutils.cpp index de52e9413a..bae86fb4e1 100644 --- a/src/plugins/python/pythonutils.cpp +++ b/src/plugins/python/pythonutils.cpp @@ -289,7 +289,7 @@ private: m_future.reportFinished(); if (exitStatus == QProcess::NormalExit && exitCode == 0) { if (Client *client = registerLanguageServer(m_python)) - LanguageClientManager::reOpenDocumentWithClient(m_document, client); + LanguageClientManager::openDocumentWithClient(m_document, client); } else { Core::MessageManager::write( tr("Installing the Python language server failed with exit code %1").arg(exitCode)); @@ -338,7 +338,7 @@ static void setupPythonLanguageServer(const FilePath &python, { document->infoBar()->removeInfo(startPylsInfoBarId); if (Client *client = registerLanguageServer(python)) - LanguageClientManager::reOpenDocumentWithClient(document, client); + LanguageClientManager::openDocumentWithClient(document, client); } static void enablePythonLanguageServer(const FilePath &python, @@ -349,7 +349,7 @@ static void enablePythonLanguageServer(const FilePath &python, LanguageClientManager::enableClientSettings(setting->m_id); if (const StdIOSettings *setting = PyLSConfigureAssistant::languageServerForPython(python)) { if (Client *client = LanguageClientManager::clientForSetting(setting).value(0)) { - LanguageClientManager::reOpenDocumentWithClient(document, client); + LanguageClientManager::openDocumentWithClient(document, client); PyLSConfigureAssistant::updateEditorInfoBars(python, client); } } @@ -406,7 +406,7 @@ void PyLSConfigureAssistant::handlePyLSState(const FilePath &python, if (state.state == PythonLanguageServerState::AlreadyConfigured) { if (const StdIOSettings *setting = languageServerForPython(python)) { if (Client *client = LanguageClientManager::clientForSetting(setting).value(0)) - LanguageClientManager::reOpenDocumentWithClient(document, client); + LanguageClientManager::openDocumentWithClient(document, client); } return; } @@ -456,7 +456,7 @@ void PyLSConfigureAssistant::updateEditorInfoBars(const FilePath &python, Client for (TextEditor::TextDocument *document : instance()->m_infoBarEntries.take(python)) { instance()->resetEditorInfoBar(document); if (client) - LanguageClientManager::reOpenDocumentWithClient(document, client); + LanguageClientManager::openDocumentWithClient(document, client); } } -- cgit v1.2.1