diff options
author | David Schulz <david.schulz@qt.io> | 2020-05-12 09:20:01 +0200 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2020-05-14 09:51:26 +0000 |
commit | 8f5109b6eee4d61207474916404621fb6a675811 (patch) | |
tree | 1a967ebfcf7af9b9929e5846a655e7c9376c2194 /src/plugins/python/pythonutils.cpp | |
parent | f3407bb0ca5ca06a2b64e993c9d270774facfebc (diff) | |
download | qt-creator-8f5109b6eee4d61207474916404621fb6a675811.tar.gz |
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 <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/python/pythonutils.cpp')
-rw-r--r-- | src/plugins/python/pythonutils.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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); } } |