summaryrefslogtreecommitdiff
path: root/src/plugins/python/pythonlanguageclient.cpp
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2022-03-23 07:40:20 +0100
committerDavid Schulz <david.schulz@qt.io>2022-03-28 09:29:15 +0000
commit64170a788ad76d36fc081fa68601cf9a3fe2f5fd (patch)
tree9cb16559c4780a90b55fb79c24ee16917ad9cb30 /src/plugins/python/pythonlanguageclient.cpp
parentff686f567900ac45860556253c397425edc05cfc (diff)
downloadqt-creator-64170a788ad76d36fc081fa68601cf9a3fe2f5fd.tar.gz
Python: extract pythonProjectForFile function to utils
Change-Id: I4055527302cab09f55cd4b06bfd3896accb4832a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/python/pythonlanguageclient.cpp')
-rw-r--r--src/plugins/python/pythonlanguageclient.cpp13
1 files changed, 1 insertions, 12 deletions
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<PythonProject *>(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;