LanguageClient: fix todo

Change-Id: Ia6b3b5fe6e595c32a8b8a13b869f3178afb37ed8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
David Schulz
2022-06-03 13:50:31 +02:00
parent 5693c518bc
commit 2029fe8c99
6 changed files with 14 additions and 14 deletions

View File

@@ -188,7 +188,7 @@ private:
TemporaryDirectory m_workspaceDir = TemporaryDirectory("QtCreator-jls-XXXXXX"); TemporaryDirectory m_workspaceDir = TemporaryDirectory("QtCreator-jls-XXXXXX");
}; };
LanguageClient::BaseClientInterface *JLSSettings::createInterface() const LanguageClient::BaseClientInterface *JLSSettings::createInterface(ProjectExplorer::Project *) const
{ {
auto interface = new JLSInterface(); auto interface = new JLSInterface();
CommandLine cmd{m_executable, arguments(), CommandLine::Raw}; CommandLine cmd{m_executable, arguments(), CommandLine::Raw};

View File

@@ -42,7 +42,8 @@ public:
void fromMap(const QVariantMap &map) final; void fromMap(const QVariantMap &map) final;
LanguageClient::BaseSettings *copy() const final; LanguageClient::BaseSettings *copy() const final;
LanguageClient::Client *createClient(LanguageClient::BaseClientInterface *interface) const final; LanguageClient::Client *createClient(LanguageClient::BaseClientInterface *interface) const final;
LanguageClient::BaseClientInterface *createInterface() const final; LanguageClient::BaseClientInterface *createInterface(
ProjectExplorer::Project *project) const final;
Utils::FilePath m_languageServer; Utils::FilePath m_languageServer;

View File

@@ -581,7 +581,7 @@ Client *BaseSettings::createClient(ProjectExplorer::Project *project) const
{ {
if (!isValid() || !m_enabled) if (!isValid() || !m_enabled)
return nullptr; return nullptr;
BaseClientInterface *interface = createInterfaceWithProject(project); BaseClientInterface *interface = createInterface(project);
QTC_ASSERT(interface, return nullptr); QTC_ASSERT(interface, return nullptr);
auto *client = createClient(interface); auto *client = createClient(interface);
client->setName(Utils::globalMacroExpander()->expand(m_name)); client->setName(Utils::globalMacroExpander()->expand(m_name));
@@ -592,6 +592,11 @@ Client *BaseSettings::createClient(ProjectExplorer::Project *project) const
return client; return client;
} }
BaseClientInterface *BaseSettings::createInterface(ProjectExplorer::Project *) const
{
return nullptr;
}
Client *BaseSettings::createClient(BaseClientInterface *interface) const Client *BaseSettings::createClient(BaseClientInterface *interface) const
{ {
return new Client(interface); return new Client(interface);
@@ -772,7 +777,7 @@ Utils::CommandLine StdIOSettings::command() const
return Utils::CommandLine(m_executable, arguments(), Utils::CommandLine::Raw); return Utils::CommandLine(m_executable, arguments(), Utils::CommandLine::Raw);
} }
BaseClientInterface *StdIOSettings::createInterfaceWithProject(ProjectExplorer::Project *project) const BaseClientInterface *StdIOSettings::createInterface(ProjectExplorer::Project *project) const
{ {
auto interface = new StdIOClientInterface; auto interface = new StdIOClientInterface;
interface->setCommandLine(command()); interface->setCommandLine(command());

View File

@@ -105,13 +105,8 @@ public:
virtual void fromMap(const QVariantMap &map); virtual void fromMap(const QVariantMap &map);
protected: protected:
// TODO: remove in Qt Creator 6 and rename createInterfaceWithProject back to it virtual BaseClientInterface *createInterface(ProjectExplorer::Project *) const;
virtual BaseClientInterface *createInterface() const { return nullptr; }
virtual Client *createClient(BaseClientInterface *interface) const; virtual Client *createClient(BaseClientInterface *interface) const;
virtual BaseClientInterface *createInterfaceWithProject(ProjectExplorer::Project *) const
{
return createInterface();
}
BaseSettings(const BaseSettings &other) = default; BaseSettings(const BaseSettings &other) = default;
BaseSettings(BaseSettings &&other) = default; BaseSettings(BaseSettings &&other) = default;
@@ -141,7 +136,7 @@ public:
Utils::CommandLine command() const; Utils::CommandLine command() const;
protected: protected:
BaseClientInterface *createInterfaceWithProject(ProjectExplorer::Project *project) const override; BaseClientInterface *createInterface(ProjectExplorer::Project *project) const override;
StdIOSettings(const StdIOSettings &other) = default; StdIOSettings(const StdIOSettings &other) = default;
StdIOSettings(StdIOSettings &&other) = default; StdIOSettings(StdIOSettings &&other) = default;

View File

@@ -480,8 +480,7 @@ public:
TemporaryDirectory m_extraPythonPath; TemporaryDirectory m_extraPythonPath;
}; };
BaseClientInterface *PyLSSettings::createInterfaceWithProject( BaseClientInterface *PyLSSettings::createInterface(ProjectExplorer::Project *project) const
ProjectExplorer::Project *project) const
{ {
auto interface = new PyLSInterface; auto interface = new PyLSInterface;
interface->setCommandLine(command()); interface->setCommandLine(command());

View File

@@ -84,7 +84,7 @@ public:
LanguageClient::Client *createClient(LanguageClient::BaseClientInterface *interface) const final; LanguageClient::Client *createClient(LanguageClient::BaseClientInterface *interface) const final;
private: private:
LanguageClient::BaseClientInterface *createInterfaceWithProject( LanguageClient::BaseClientInterface *createInterface(
ProjectExplorer::Project *project) const override; ProjectExplorer::Project *project) const override;
static QJsonObject defaultConfiguration(); static QJsonObject defaultConfiguration();