Commit 77402547 authored by Mark Nauwelaerts's avatar Mark Nauwelaerts
Browse files

lspclient: make servermanager proxy logMessage and showMessage notification signals

parent 3c38133e
......@@ -637,6 +637,9 @@ private:
} else {
showMessage(i18n("Started server %2: %1", cmdline.join(QLatin1Char(' ')), serverDescription(server.data())),
KTextEditor::Message::Positive);
using namespace std::placeholders;
server->connect(server.data(), &LSPClientServer::logMessage, this, std::bind(&self_type::onMessage, this, true, _1));
server->connect(server.data(), &LSPClientServer::showMessage, this, std::bind(&self_type::onMessage, this, false, _1));
}
serverinfo.settings = serverConfig.value(QStringLiteral("settings"));
serverinfo.started = QTime::currentTime();
......@@ -858,6 +861,18 @@ private:
info->changes.push_back({oldrange, text});
}
}
void onMessage(bool isLog, const LSPLogMessageParams &params)
{
// determine server description
auto server = dynamic_cast<LSPClientServer *>(sender());
auto message = params.message;
if (isLog) {
Q_EMIT serverLogMessage(server, params);
} else {
Q_EMIT serverShowMessage(server, params);
}
}
};
QSharedPointer<LSPClientServerManager> LSPClientServerManager::new_(LSPClientPlugin *plugin, KTextEditor::MainWindow *mainWin)
......
......@@ -71,6 +71,9 @@ public:
Q_SIGNALS:
void serverChanged();
void showMessage(KTextEditor::Message::MessageType level, const QString &msg);
// proxy server signals in case those are emitted very early
void serverShowMessage(LSPClientServer *server, const LSPShowMessageParams &);
void serverLogMessage(LSPClientServer *server, const LSPShowMessageParams &);
};
class LSPClientRevisionSnapshot : public QObject
......
Markdown is supported
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