aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/python/pythonlanguageclient.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2025-01-17 17:41:27 +0100
committerhjk <hjk@qt.io>2025-04-29 07:12:19 +0000
commit3d6eeea5dc40702cb11afffa72a1a05b7f0dfe31 (patch)
treed32096ad3bc218c67e113377939bf39f4ee4bdcd /src/plugins/python/pythonlanguageclient.cpp
parente21f23ed2f0fd0be489aa0b360f3afe9bf64578a (diff)
LanguageClient: have one LanguageClient per BuildConfig
Language server behavior does not depend only on the project files but also on Kit configuration and in some cases the actual build. Change-Id: I1c26de62da9e5ee2f2f9e655f23cd2d30cfedd85 Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/python/pythonlanguageclient.cpp')
-rw-r--r--src/plugins/python/pythonlanguageclient.cpp27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/plugins/python/pythonlanguageclient.cpp b/src/plugins/python/pythonlanguageclient.cpp
index a0bf223092a..a43227a1500 100644
--- a/src/plugins/python/pythonlanguageclient.cpp
+++ b/src/plugins/python/pythonlanguageclient.cpp
@@ -218,7 +218,7 @@ void PyLSClient::openDocument(TextEditor::TextDocument *document)
if (BuildStepList *buildSteps = buildConfig->buildSteps()) {
BuildStep *buildStep = buildSteps->firstStepWithId(PySideBuildStep::id());
if (auto *pythonBuildStep = qobject_cast<PySideBuildStep *>(buildStep))
- updateExtraCompilers(project, pythonBuildStep->extraCompilers());
+ updateExtraCompilers(pythonBuildStep->extraCompilers());
}
}
} else if (isSupportedDocument(document)) {
@@ -238,22 +238,21 @@ void PyLSClient::openDocument(TextEditor::TextDocument *document)
Client::openDocument(document);
}
-void PyLSClient::projectClosed(ProjectExplorer::Project *project)
+void PyLSClient::buildConfigurationClosed(BuildConfiguration *bc)
{
- for (ProjectExplorer::ExtraCompiler *compiler : m_extraCompilers.value(project))
+ for (ExtraCompiler *compiler : m_extraCompilers)
closeExtraCompiler(compiler, compiler->targets().first());
- Client::projectClosed(project);
+ Client::buildConfigurationClosed(bc);
}
-void PyLSClient::updateExtraCompilers(ProjectExplorer::Project *project,
- const QList<PySideUicExtraCompiler *> &extraCompilers)
+void PyLSClient::updateExtraCompilers(const QList<PySideUicExtraCompiler *> &extraCompilers)
{
- auto oldCompilers = m_extraCompilers.take(project);
+ auto oldCompilers = m_extraCompilers;
for (PySideUicExtraCompiler *extraCompiler : extraCompilers) {
QTC_ASSERT(extraCompiler->targets().size() == 1 , continue);
int index = oldCompilers.indexOf(extraCompiler);
if (index < 0) {
- m_extraCompilers[project] << extraCompiler;
+ m_extraCompilers << extraCompiler;
connect(
extraCompiler,
&ExtraCompiler::contentsChanged,
@@ -265,21 +264,17 @@ void PyLSClient::updateExtraCompilers(ProjectExplorer::Project *project,
extraCompiler,
&QObject::destroyed,
this,
- [this, extraCompiler, file = extraCompiler->targets().constFirst()]() {
- for (QList<ProjectExplorer::ExtraCompiler *> &extraCompilers :
- m_extraCompilers) {
- QTC_CHECK(extraCompilers.removeAll(extraCompiler) == 0);
- }
+ [this, extraCompiler, file = extraCompiler->targets().constFirst()] {
+ QTC_CHECK(m_extraCompilers.removeAll(extraCompiler) == 0);
closeExtraCompiler(extraCompiler, file);
});
-
if (extraCompiler->isDirty())
extraCompiler->compileFile();
} else {
- m_extraCompilers[project] << oldCompilers.takeAt(index);
+ m_extraCompilers << oldCompilers.takeAt(index);
}
}
- for (ProjectExplorer::ExtraCompiler *compiler : std::as_const(oldCompilers))
+ for (ExtraCompiler *compiler : std::as_const(oldCompilers))
closeExtraCompiler(compiler, compiler->targets().first());
}