Commit 4969fe2b authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

keep server output on terminal for debug mode

parent 5c5104cf
Pipeline #193453 passed with stage
in 8 minutes and 10 seconds
......@@ -1384,7 +1384,7 @@ private:
}
public:
bool start()
bool start(bool forwardStdError)
{
if (m_state != State::None) {
return true;
......@@ -1399,7 +1399,7 @@ public:
m_sproc.setWorkingDirectory(m_root.toLocalFile());
// we handle stdout/stderr internally, important stuff via stdout
m_sproc.setProcessChannelMode(QProcess::SeparateChannels);
m_sproc.setProcessChannelMode(forwardStdError ? QProcess::ForwardedErrorChannel : QProcess::SeparateChannels);
m_sproc.setReadChannel(QProcess::QProcess::StandardOutput);
m_sproc.start(program, args);
const bool result = m_sproc.waitForStarted();
......@@ -1744,9 +1744,9 @@ const LSPServerCapabilities &LSPClientServer::capabilities() const
return d->capabilities();
}
bool LSPClientServer::start()
bool LSPClientServer::start(bool forwardStdError)
{
return d->start();
return d->start(forwardStdError);
}
void LSPClientServer::stop(int to_t, int to_k)
......
......@@ -108,7 +108,7 @@ public:
// server management
// request start
bool start();
bool start(bool forwardStdError);
// request shutdown/stop
// if to_xxx >= 0 -> send signal if not exit'ed after timeout
void stop(int to_term_ms, int to_kill_ms);
......
......@@ -775,7 +775,7 @@ private:
}
server.reset(new LSPClientServer(cmdline, root, realLangId, serverConfig.value(QStringLiteral("initializationOptions")), folders));
connect(server.data(), &LSPClientServer::stateChanged, this, &self_type::onStateChanged, Qt::UniqueConnection);
if (!server->start()) {
if (!server->start(m_plugin->m_debugMode)) {
QString message = i18n("Failed to start server: %1", cmdline.join(QLatin1Char(' ')));
const auto url = serverConfig.value(QStringLiteral("url")).toString();
if (!url.isEmpty()) {
......
......@@ -30,7 +30,7 @@ int main(int argc, char **argv)
}
};
auto conn = QObject::connect(&lsp, &LSPClientServer::stateChanged, state_h);
lsp.start();
lsp.start(true);
q.exec();
QObject::disconnect(conn);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment