From 64170a788ad76d36fc081fa68601cf9a3fe2f5fd Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 23 Mar 2022 07:40:20 +0100 Subject: Python: extract pythonProjectForFile function to utils Change-Id: I4055527302cab09f55cd4b06bfd3896accb4832a Reviewed-by: Christian Stenger --- src/plugins/python/pythonlanguageclient.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'src/plugins/python/pythonlanguageclient.cpp') diff --git a/src/plugins/python/pythonlanguageclient.cpp b/src/plugins/python/pythonlanguageclient.cpp index c4b01462ea..c49ba40426 100644 --- a/src/plugins/python/pythonlanguageclient.cpp +++ b/src/plugins/python/pythonlanguageclient.cpp @@ -452,17 +452,6 @@ void PyLSSettings::setInterpreter(const QString &interpreterId) m_executable = interpreter.command; } -static PythonProject *projectForFile(const FilePath &pythonFile) -{ - for (ProjectExplorer::Project *project : ProjectExplorer::SessionManager::projects()) { - if (auto pythonProject = qobject_cast(project)) { - if (pythonProject->isKnownFile(pythonFile)) - return pythonProject; - } - } - return nullptr; -} - class PyLSClient : public Client { public: @@ -472,7 +461,7 @@ public: using namespace LanguageServerProtocol; if (reachable()) { const FilePath documentPath = document->filePath(); - if (isSupportedDocument(document) && !projectForFile(documentPath)) { + if (isSupportedDocument(document) && !pythonProjectForFile(documentPath)) { const FilePath workspacePath = documentPath.parentDir(); if (!extraWorkspaceDirs.contains(workspacePath)) { WorkspaceFoldersChangeEvent event; -- cgit v1.2.1