forked from qt-creator/qt-creator
LanguageClient: Do not pop up general messages pane
General messages pane should only be opened on direct user interaction. Task-number: QTCREATORBUG-24430 Change-Id: I526659110fc67c627cb60fe56e1f709f064667c2 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -329,7 +329,7 @@ void Client::sendContent(const IContent &content)
|
||||
m_responseHandlers[responseHandler->id] = responseHandler->callback;
|
||||
QString error;
|
||||
if (!QTC_GUARD(content.isValid(&error)))
|
||||
Core::MessageManager::write(error);
|
||||
Core::MessageManager::writeFlashing(error);
|
||||
const BaseMessage message = content.toBaseMessage();
|
||||
LanguageClientManager::logBaseMessage(LspLogMessage::ClientMessage, name(), message);
|
||||
m_clientInterface->sendMessage(message);
|
||||
@@ -947,9 +947,9 @@ void Client::handleMessage(const BaseMessage &message)
|
||||
}
|
||||
}
|
||||
|
||||
void Client::log(const QString &message, Core::MessageManager::PrintToOutputPaneFlag flag)
|
||||
void Client::log(const QString &message)
|
||||
{
|
||||
Core::MessageManager::write(QString("LanguageClient %1: %2").arg(name(), message), flag);
|
||||
Core::MessageManager::writeFlashing(QString("LanguageClient %1: %2").arg(name(), message));
|
||||
}
|
||||
|
||||
const ServerCapabilities &Client::capabilities() const
|
||||
@@ -977,10 +977,9 @@ HoverHandler *Client::hoverHandler()
|
||||
return &m_hoverHandler;
|
||||
}
|
||||
|
||||
void Client::log(const ShowMessageParams &message,
|
||||
Core::MessageManager::PrintToOutputPaneFlag flag)
|
||||
void Client::log(const ShowMessageParams &message)
|
||||
{
|
||||
log(message.toString(), flag);
|
||||
log(message.toString());
|
||||
}
|
||||
|
||||
void Client::showMessageBox(const ShowMessageRequestParams &message, const MessageId &id)
|
||||
@@ -1073,8 +1072,7 @@ void Client::handleMethod(const QString &method, const MessageId &id, const ICon
|
||||
ErrorHierarchy error;
|
||||
auto logError = [&](const JsonObject &content) {
|
||||
log(QJsonDocument(content).toJson(QJsonDocument::Indented) + '\n'
|
||||
+ tr("Invalid parameter in \"%1\": %2").arg(method, error.toString()),
|
||||
Core::MessageManager::Flash);
|
||||
+ tr("Invalid parameter in \"%1\": %2").arg(method, error.toString()));
|
||||
};
|
||||
|
||||
if (method == PublishDiagnosticsNotification::methodName) {
|
||||
@@ -1086,7 +1084,7 @@ void Client::handleMethod(const QString &method, const MessageId &id, const ICon
|
||||
} else if (method == LogMessageNotification::methodName) {
|
||||
auto params = dynamic_cast<const LogMessageNotification *>(content)->params().value_or(LogMessageParams());
|
||||
if (params.isValid(&error))
|
||||
log(params, Core::MessageManager::Flash);
|
||||
log(params);
|
||||
else
|
||||
logError(params);
|
||||
} else if (method == SemanticHighlightNotification::methodName) {
|
||||
|
@@ -159,12 +159,12 @@ public:
|
||||
bool start();
|
||||
bool reset();
|
||||
|
||||
void log(const QString &message,
|
||||
Core::MessageManager::PrintToOutputPaneFlag flag = Core::MessageManager::NoModeSwitch);
|
||||
void log(const QString &message);
|
||||
template<typename Error>
|
||||
void log(const LanguageServerProtocol::ResponseError<Error> &responseError,
|
||||
Core::MessageManager::PrintToOutputPaneFlag flag = Core::MessageManager::NoModeSwitch)
|
||||
{ log(responseError.toString(), flag); }
|
||||
void log(const LanguageServerProtocol::ResponseError<Error> &responseError)
|
||||
{
|
||||
log(responseError.toString());
|
||||
}
|
||||
|
||||
const LanguageServerProtocol::ServerCapabilities &capabilities() const;
|
||||
const DynamicCapabilities &dynamicCapabilities() const;
|
||||
@@ -196,8 +196,7 @@ private:
|
||||
void initializeCallback(const LanguageServerProtocol::InitializeRequest::Response &initResponse);
|
||||
void shutDownCallback(const LanguageServerProtocol::ShutdownRequest::Response &shutdownResponse);
|
||||
bool sendWorkspceFolderChanges() const;
|
||||
void log(const LanguageServerProtocol::ShowMessageParams &message,
|
||||
Core::MessageManager::PrintToOutputPaneFlag flag = Core::MessageManager::NoModeSwitch);
|
||||
void log(const LanguageServerProtocol::ShowMessageParams &message);
|
||||
|
||||
void showMessageBox(const LanguageServerProtocol::ShowMessageRequestParams &message,
|
||||
const LanguageServerProtocol::MessageId &id);
|
||||
|
@@ -385,14 +385,13 @@ void LanguageClientManager::clientFinished(Client *client)
|
||||
&& client->state() != Client::ShutdownRequested;
|
||||
if (unexpectedFinish && !m_shuttingDown && client->reset()) {
|
||||
client->disconnect(this);
|
||||
client->log(tr("Unexpectedly finished. Restarting in %1 seconds.").arg(restartTimeoutS),
|
||||
Core::MessageManager::Flash);
|
||||
client->log(tr("Unexpectedly finished. Restarting in %1 seconds.").arg(restartTimeoutS));
|
||||
QTimer::singleShot(restartTimeoutS * 1000, client, [client]() { startClient(client); });
|
||||
for (auto it = m_clientForDocument.cbegin(); it != m_clientForDocument.cend(); ++it)
|
||||
client->deactivateDocument(it.key());
|
||||
} else {
|
||||
if (unexpectedFinish && !m_shuttingDown)
|
||||
client->log(tr("Unexpectedly finished."), Core::MessageManager::Flash);
|
||||
client->log(tr("Unexpectedly finished."));
|
||||
for (auto it = m_clientForDocument.cbegin(); it != m_clientForDocument.cend(); ++it)
|
||||
m_clientForDocument.remove(it.key());
|
||||
deleteClient(client);
|
||||
|
Reference in New Issue
Block a user