diff options
author | hjk <[email protected]> | 2025-01-17 17:41:27 +0100 |
---|---|---|
committer | hjk <[email protected]> | 2025-04-29 07:12:19 +0000 |
commit | 3d6eeea5dc40702cb11afffa72a1a05b7f0dfe31 (patch) | |
tree | d32096ad3bc218c67e113377939bf39f4ee4bdcd /src/plugins/languageclient/lualanguageclient | |
parent | e21f23ed2f0fd0be489aa0b360f3afe9bf64578a (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 <[email protected]>
Diffstat (limited to 'src/plugins/languageclient/lualanguageclient')
-rw-r--r-- | src/plugins/languageclient/lualanguageclient/lualanguageclient.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/plugins/languageclient/lualanguageclient/lualanguageclient.cpp b/src/plugins/languageclient/lualanguageclient/lualanguageclient.cpp index 78ba4c18934..6328a8bdf1d 100644 --- a/src/plugins/languageclient/lualanguageclient/lualanguageclient.cpp +++ b/src/plugins/languageclient/lualanguageclient/lualanguageclient.cpp @@ -16,6 +16,7 @@ #include <extensionsystem/iplugin.h> #include <extensionsystem/pluginmanager.h> +#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/project.h> #include <projectexplorer/projectmanager.h> @@ -200,7 +201,7 @@ public: protected: Client *createClient(BaseClientInterface *interface) const final; - BaseClientInterface *createInterface(ProjectExplorer::Project *project) const override; + BaseClientInterface *createInterface(ProjectExplorer::BuildConfiguration *bc) const override; }; enum class TransportType { StdIO, LocalSocket }; @@ -452,7 +453,7 @@ public: Project *project = ProjectManager::projectForFile(document->filePath()); const auto clients = LanguageClientManager::clientsForSettingId(m_clientSettingsId); result = Utils::filtered(clients, [project](Client *c) { - return c && c->project() == project; + return c && c->project() && c->project() == project; }); } else @@ -595,21 +596,21 @@ public: return {}; } - BaseClientInterface *createInterface(ProjectExplorer::Project *project) + BaseClientInterface *createInterface(BuildConfiguration *bc) { if (m_transportType == TransportType::StdIO) { auto interface = new StdIOClientInterface; interface->setCommandLine(m_cmdLine); - if (project) - interface->setWorkingDirectory(project->projectDirectory()); + if (bc) + interface->setWorkingDirectory(bc->project()->projectDirectory()); return interface; } else if (m_transportType == TransportType::LocalSocket) { if (m_serverName.isEmpty()) return nullptr; auto interface = new LuaLocalSocketClientInterface(m_cmdLine, m_serverName); - if (project) - interface->setWorkingDirectory(project->projectDirectory()); + if (bc) + interface->setWorkingDirectory(bc->project()->projectDirectory()); return interface; } return nullptr; @@ -700,10 +701,10 @@ Client *LuaClientSettings::createClient(BaseClientInterface *interface) const return client; } -BaseClientInterface *LuaClientSettings::createInterface(ProjectExplorer::Project *project) const +BaseClientInterface *LuaClientSettings::createInterface(BuildConfiguration *bc) const { if (auto w = m_wrapper.lock()) - return w->createInterface(project); + return w->createInterface(bc); return nullptr; } |