forked from qt-creator/qt-creator
LSP: Set client working directory to project directory
If the server settings specify that a server is to be started "per project". This fixes e.g. running the haskell-language-server Fixes: QTCREATORBUG-26115 Change-Id: If10af71d60786826a9218b4b98818df8d9710adf Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -557,16 +557,22 @@ bool BaseSettings::isValid() const
|
||||
}
|
||||
|
||||
Client *BaseSettings::createClient()
|
||||
{
|
||||
return createClient(nullptr);
|
||||
}
|
||||
|
||||
Client *BaseSettings::createClient(ProjectExplorer::Project *project)
|
||||
{
|
||||
if (!isValid() || !m_enabled)
|
||||
return nullptr;
|
||||
BaseClientInterface *interface = createInterface();
|
||||
BaseClientInterface *interface = createInterfaceWithProject(project);
|
||||
QTC_ASSERT(interface, return nullptr);
|
||||
auto *client = createClient(interface);
|
||||
client->setName(Utils::globalMacroExpander()->expand(m_name));
|
||||
client->setSupportedLanguage(m_languageFilter);
|
||||
client->setInitializationOptions(initializationOptions());
|
||||
client->setActivateDocumentAutomatically(true);
|
||||
client->setCurrentProject(project);
|
||||
return client;
|
||||
}
|
||||
|
||||
@@ -733,10 +739,12 @@ Utils::CommandLine StdIOSettings::command() const
|
||||
Utils::CommandLine::Raw);
|
||||
}
|
||||
|
||||
BaseClientInterface *StdIOSettings::createInterface() const
|
||||
BaseClientInterface *StdIOSettings::createInterfaceWithProject(ProjectExplorer::Project *project) const
|
||||
{
|
||||
auto interface = new StdIOClientInterface;
|
||||
interface->setCommandLine(command());
|
||||
if (project)
|
||||
interface->setWorkingDirectory(project->projectDirectory().toString());
|
||||
return interface;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user