| 1 |
#pragma once |
| 2 |
|
| 3 |
#include "LibLsp/JsonRpc/RequestInMessage.h" |
| 4 |
#include "LibLsp/JsonRpc/NotificationInMessage.h" |
| 5 |
|
| 6 |
#include "LibLsp/lsp/lsDocumentUri.h" |
| 7 |
#include "LibLsp/lsp/lsCommand.h" |
| 8 |
|
| 9 |
#ifdef _WIN32 |
| 10 |
#include <ppltasks.h> |
| 11 |
#endif |
| 12 |
|
| 13 |
struct StatusReport |
| 14 |
{ |
| 15 |
|
| 16 |
std::string ToString() const |
| 17 |
{ |
| 18 |
std::string info; |
| 19 |
info += "type:" + type + "\n"; |
| 20 |
info += "message:" + message + "\n"; |
| 21 |
return info; |
| 22 |
} |
| 23 |
/** |
| 24 |
* The message type. See { |
| 25 |
* |
| 26 |
*/ |
| 27 |
|
| 28 |
std::string type; |
| 29 |
/** |
| 30 |
* The actual message |
| 31 |
* |
| 32 |
*/ |
| 33 |
|
| 34 |
std::string message; |
| 35 |
MAKE_SWAP_METHOD(StatusReport, type, message); |
| 36 |
}; |
| 37 |
MAKE_REFLECT_STRUCT(StatusReport, type, message); |
| 38 |
|
| 39 |
/** |
| 40 |
* The show message notification is sent from a server to a client to ask |
| 41 |
* the client to display a particular message in the user interface. |
| 42 |
*/ |
| 43 |
DEFINE_NOTIFICATION_TYPE(lang_status, StatusReport, "language/status"); |
| 44 |
|
| 45 |
enum class MessageType |
| 46 |
{ |
| 47 |
|
| 48 |
/** |
| 49 |
* An error message. |
| 50 |
*/ |
| 51 |
Error = (1), |
| 52 |
|
| 53 |
/** |
| 54 |
* A warning message. |
| 55 |
*/ |
| 56 |
Warning = (2), |
| 57 |
|
| 58 |
/** |
| 59 |
* An information message. |
| 60 |
*/ |
| 61 |
Info = (3), |
| 62 |
|
| 63 |
/** |
| 64 |
* A log message. |
| 65 |
*/ |
| 66 |
Log = (4) |
| 67 |
}; |
| 68 |
MAKE_REFLECT_TYPE_PROXY(MessageType); |
| 69 |
|
| 70 |
struct ActionableNotification |
| 71 |
{ |
| 72 |
|
| 73 |
/** |
| 74 |
* The message type. See { |
| 75 |
* |
| 76 |
*/ |
| 77 |
|
| 78 |
MessageType severity; |
| 79 |
/** |
| 80 |
* The actual message |
| 81 |
* |
| 82 |
*/ |
| 83 |
|
| 84 |
std::string message; |
| 85 |
|
| 86 |
/** |
| 87 |
* Optional data |
| 88 |
* |
| 89 |
*/ |
| 90 |
|
| 91 |
optional<lsp::Any> data; |
| 92 |
|
| 93 |
/** |
| 94 |
* Optional commands |
| 95 |
* |
| 96 |
*/ |
| 97 |
|
| 98 |
std::vector<lsCommandWithAny> commands; |
| 99 |
|
| 100 |
MAKE_SWAP_METHOD(ActionableNotification, severity, message, data, commands) |
| 101 |
}; |
| 102 |
MAKE_REFLECT_STRUCT(ActionableNotification, severity, message, data, commands) |
| 103 |
|
| 104 |
/** |
| 105 |
* The actionable notification is sent from a server to a client to ask the |
| 106 |
* client to display a particular message in the user interface, and possible |
| 107 |
* commands to execute. The commands must be implemented on the client side. |
| 108 |
*/ |
| 109 |
DEFINE_NOTIFICATION_TYPE(lang_actionableNotification, ActionableNotification, "language/actionableNotification"); |
| 110 |
|
| 111 |
struct ProgressReport |
| 112 |
{ |
| 113 |
std::string ToString() const; |
| 114 |
|
| 115 |
std::string id; |
| 116 |
|
| 117 |
std::string task; |
| 118 |
|
| 119 |
std::string subTask; |
| 120 |
|
| 121 |
std::string status; |
| 122 |
|
| 123 |
int totalWork = 0; |
| 124 |
|
| 125 |
int workDone = 0; |
| 126 |
|
| 127 |
bool complete = false; |
| 128 |
MAKE_SWAP_METHOD(ProgressReport, id, task, subTask, status, workDone, complete); |
| 129 |
}; |
| 130 |
|
| 131 |
MAKE_REFLECT_STRUCT(ProgressReport, id, task, subTask, status, workDone, complete); |
| 132 |
|
| 133 |
/** |
| 134 |
* The progress report notification is sent from a server to be handled by the |
| 135 |
* client. |
| 136 |
*/ |
| 137 |
DEFINE_NOTIFICATION_TYPE(lang_progressReport, ProgressReport, "language/progressReport"); |
| 138 |
|
| 139 |
enum EventType |
| 140 |
{ |
| 141 |
/** |
| 142 |
* classpath updated event. |
| 143 |
*/ |
| 144 |
ClasspathUpdated = (100), |
| 145 |
|
| 146 |
/** |
| 147 |
* projects imported event. |
| 148 |
*/ |
| 149 |
ProjectsImported = (200) |
| 150 |
}; |
| 151 |
|
| 152 |
struct EventNotification |
| 153 |
{ |
| 154 |
int eventType; |
| 155 |
lsp::Any data; |
| 156 |
std::string ToString() const; |
| 157 |
MAKE_SWAP_METHOD(EventNotification, eventType, data) |
| 158 |
}; |
| 159 |
MAKE_REFLECT_STRUCT(EventNotification, eventType, data); |
| 160 |
|
| 161 |
DEFINE_NOTIFICATION_TYPE(lang_eventNotification, EventNotification, "language/eventNotification"); |