forked from qt-creator/qt-creator
LanguangeClient: Use more FilePath
Change-Id: Ic849da11da646feb804717550d2a8a60d61f332d Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -59,7 +59,7 @@ public:
|
|||||||
JLSSettingsWidget(const JLSSettings *settings, QWidget *parent);
|
JLSSettingsWidget(const JLSSettings *settings, QWidget *parent);
|
||||||
|
|
||||||
QString name() const { return m_name->text(); }
|
QString name() const { return m_name->text(); }
|
||||||
QString java() const { return m_java->filePath().toString(); }
|
FilePath java() const { return m_java->filePath(); }
|
||||||
QString languageServer() const { return m_ls->filePath().toString(); }
|
QString languageServer() const { return m_ls->filePath().toString(); }
|
||||||
QString workspace() const { return m_workspace->filePath().toString(); }
|
QString workspace() const { return m_workspace->filePath().toString(); }
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ JLSSettingsWidget::JLSSettingsWidget(const JLSSettings *settings, QWidget *paren
|
|||||||
|
|
||||||
mainLayout->addWidget(new QLabel(tr("Java:")), ++row, 0);
|
mainLayout->addWidget(new QLabel(tr("Java:")), ++row, 0);
|
||||||
m_java->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
m_java->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||||
m_java->setPath(QDir::toNativeSeparators(settings->m_executable));
|
m_java->setFilePath(settings->m_executable);
|
||||||
mainLayout->addWidget(m_java, row, 1);
|
mainLayout->addWidget(m_java, row, 1);
|
||||||
|
|
||||||
mainLayout->addWidget(new QLabel(tr("Java Language Server:")), ++row, 0);
|
mainLayout->addWidget(new QLabel(tr("Java Language Server:")), ++row, 0);
|
||||||
@@ -106,7 +106,7 @@ JLSSettings::JLSSettings()
|
|||||||
m_languageFilter.mimeTypes = QStringList(Constants::JAVA_MIMETYPE);
|
m_languageFilter.mimeTypes = QStringList(Constants::JAVA_MIMETYPE);
|
||||||
const FilePath &javaPath = Utils::Environment::systemEnvironment().searchInPath("java");
|
const FilePath &javaPath = Utils::Environment::systemEnvironment().searchInPath("java");
|
||||||
if (javaPath.exists())
|
if (javaPath.exists())
|
||||||
m_executable = javaPath.toString();
|
m_executable = javaPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JLSSettings::applyFromSettingsWidget(QWidget *widget)
|
bool JLSSettings::applyFromSettingsWidget(QWidget *widget)
|
||||||
@@ -192,8 +192,7 @@ private:
|
|||||||
LanguageClient::BaseClientInterface *JLSSettings::createInterface() const
|
LanguageClient::BaseClientInterface *JLSSettings::createInterface() const
|
||||||
{
|
{
|
||||||
auto interface = new JLSInterface();
|
auto interface = new JLSInterface();
|
||||||
CommandLine cmd{FilePath::fromString(m_executable)};
|
CommandLine cmd{m_executable, arguments(), CommandLine::Raw};
|
||||||
cmd.addArgs(arguments(), CommandLine::Raw);
|
|
||||||
cmd.addArgs({"-data", interface->workspaceDir()});
|
cmd.addArgs({"-data", interface->workspaceDir()});
|
||||||
interface->setCommandLine(cmd);
|
interface->setCommandLine(cmd);
|
||||||
return interface;
|
return interface;
|
||||||
|
@@ -715,7 +715,7 @@ bool StdIOSettings::isValid() const
|
|||||||
QVariantMap StdIOSettings::toMap() const
|
QVariantMap StdIOSettings::toMap() const
|
||||||
{
|
{
|
||||||
QVariantMap map = BaseSettings::toMap();
|
QVariantMap map = BaseSettings::toMap();
|
||||||
map.insert(executableKey, m_executable);
|
map.insert(executableKey, m_executable.toVariant());
|
||||||
map.insert(argumentsKey, m_arguments);
|
map.insert(argumentsKey, m_arguments);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
@@ -723,7 +723,7 @@ QVariantMap StdIOSettings::toMap() const
|
|||||||
void StdIOSettings::fromMap(const QVariantMap &map)
|
void StdIOSettings::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
BaseSettings::fromMap(map);
|
BaseSettings::fromMap(map);
|
||||||
m_executable = map[executableKey].toString();
|
m_executable = Utils::FilePath::fromVariant(map[executableKey]);
|
||||||
m_arguments = map[argumentsKey].toString();
|
m_arguments = map[argumentsKey].toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -734,9 +734,7 @@ QString StdIOSettings::arguments() const
|
|||||||
|
|
||||||
Utils::CommandLine StdIOSettings::command() const
|
Utils::CommandLine StdIOSettings::command() const
|
||||||
{
|
{
|
||||||
return Utils::CommandLine(Utils::FilePath::fromUserInput(m_executable),
|
return Utils::CommandLine(m_executable, arguments(), Utils::CommandLine::Raw);
|
||||||
arguments(),
|
|
||||||
Utils::CommandLine::Raw);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseClientInterface *StdIOSettings::createInterfaceWithProject(ProjectExplorer::Project *project) const
|
BaseClientInterface *StdIOSettings::createInterfaceWithProject(ProjectExplorer::Project *project) const
|
||||||
@@ -975,16 +973,16 @@ StdIOSettingsWidget::StdIOSettingsWidget(const StdIOSettings *settings, QWidget
|
|||||||
mainLayout->addWidget(m_executable, baseRows, 1);
|
mainLayout->addWidget(m_executable, baseRows, 1);
|
||||||
mainLayout->addWidget(new QLabel(tr("Arguments:")), baseRows + 1, 0);
|
mainLayout->addWidget(new QLabel(tr("Arguments:")), baseRows + 1, 0);
|
||||||
m_executable->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
m_executable->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||||
m_executable->setPath(QDir::toNativeSeparators(settings->m_executable));
|
m_executable->setFilePath(settings->m_executable);
|
||||||
mainLayout->addWidget(m_arguments, baseRows + 1, 1);
|
mainLayout->addWidget(m_arguments, baseRows + 1, 1);
|
||||||
|
|
||||||
auto chooser = new Utils::VariableChooser(this);
|
auto chooser = new Utils::VariableChooser(this);
|
||||||
chooser->addSupportedWidget(m_arguments);
|
chooser->addSupportedWidget(m_arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString StdIOSettingsWidget::executable() const
|
Utils::FilePath StdIOSettingsWidget::executable() const
|
||||||
{
|
{
|
||||||
return m_executable->filePath().toString();
|
return m_executable->filePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString StdIOSettingsWidget::arguments() const
|
QString StdIOSettingsWidget::arguments() const
|
||||||
|
@@ -124,7 +124,7 @@ public:
|
|||||||
StdIOSettings() = default;
|
StdIOSettings() = default;
|
||||||
~StdIOSettings() override = default;
|
~StdIOSettings() override = default;
|
||||||
|
|
||||||
QString m_executable;
|
Utils::FilePath m_executable;
|
||||||
QString m_arguments;
|
QString m_arguments;
|
||||||
|
|
||||||
bool applyFromSettingsWidget(QWidget *widget) override;
|
bool applyFromSettingsWidget(QWidget *widget) override;
|
||||||
@@ -204,7 +204,7 @@ public:
|
|||||||
explicit StdIOSettingsWidget(const StdIOSettings* settings, QWidget *parent = nullptr);
|
explicit StdIOSettingsWidget(const StdIOSettings* settings, QWidget *parent = nullptr);
|
||||||
~StdIOSettingsWidget() override = default;
|
~StdIOSettingsWidget() override = default;
|
||||||
|
|
||||||
QString executable() const;
|
Utils::FilePath executable() const;
|
||||||
QString arguments() const;
|
QString arguments() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -225,7 +225,7 @@ const StdIOSettings *PyLSConfigureAssistant::languageServerForPython(const FileP
|
|||||||
static Client *registerLanguageServer(const FilePath &python)
|
static Client *registerLanguageServer(const FilePath &python)
|
||||||
{
|
{
|
||||||
auto *settings = new StdIOSettings();
|
auto *settings = new StdIOSettings();
|
||||||
settings->m_executable = python.toString();
|
settings->m_executable = python;
|
||||||
settings->m_arguments = "-m pyls";
|
settings->m_arguments = "-m pyls";
|
||||||
settings->m_name = PyLSConfigureAssistant::tr("Python Language Server (%1)")
|
settings->m_name = PyLSConfigureAssistant::tr("Python Language Server (%1)")
|
||||||
.arg(pythonName(python));
|
.arg(pythonName(python));
|
||||||
|
Reference in New Issue
Block a user