diff options
Diffstat (limited to 'graphics/asymptote/LspCpp/include/LibLsp/lsp/windows/MessageNotify.h')
-rw-r--r-- | graphics/asymptote/LspCpp/include/LibLsp/lsp/windows/MessageNotify.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/windows/MessageNotify.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/windows/MessageNotify.h new file mode 100644 index 0000000000..8499304f55 --- /dev/null +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/windows/MessageNotify.h @@ -0,0 +1,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") + + + |