1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
#pragma once
#include "LibLsp/JsonRpc/NotificationInMessage.h"
#include "LibLsp/JsonRpc/RequestInMessage.h"
#include "LibLsp/JsonRpc/lsResponseMessage.h"
// Show a message to the user.
enum class lsMessageType : int { Error = 1, Warning = 2, Info = 3, Log = 4 };
MAKE_REFLECT_TYPE_PROXY(lsMessageType)
struct MessageParams {
/**
* The message type.
*/
lsMessageType type = lsMessageType::Error;
/**
* The actual message.
*/
std::string message;
void swap(MessageParams& arg) noexcept {
lsMessageType temp = type;
type = arg.type;
arg.type = temp;
message.swap(arg.message);
}
};
MAKE_REFLECT_STRUCT(MessageParams, type, message)
/**
* The log message notification is send from the server to the client to ask
* the client to log a particular message.
*/
DEFINE_NOTIFICATION_TYPE(Notify_LogMessage, MessageParams, "window/logMessage")
/**
* The show message notification is sent from a server to a client to ask
* the client to display a particular message in the user interface.
*/
DEFINE_NOTIFICATION_TYPE(Notify_ShowMessage, MessageParams, "window/showMessage")
/**
* The show message request is sent from a server to a client to ask the client to display a particular message in the
* user class. In addition to the show message notification the request allows to pass actions and to wait for an
* answer from the client.
*/
struct MessageActionItem {
/**
* A short title like 'Retry', 'Open Log' etc.
*/
std::string title;
MAKE_SWAP_METHOD(MessageActionItem, title)
};
MAKE_REFLECT_STRUCT(MessageActionItem, title);
struct ShowMessageRequestParams :public MessageParams {
/**
* The message action items to present.
*/
std::vector<MessageActionItem> actions;
MAKE_SWAP_METHOD(ShowMessageRequestParams, type, message, actions)
};
MAKE_REFLECT_STRUCT(ShowMessageRequestParams, type, message, actions)
/**
* The show message request is sent from a server to a client to ask the
* client to display a particular message in the user interface. In addition
* to the show message notification the request allows to pass actions and
* to wait for an answer from the client.
*/
DEFINE_REQUEST_RESPONSE_TYPE(WindowShowMessage, ShowMessageRequestParams, MessageActionItem, "window/showMessage")
|