| 1 |
#pragma once |
| 2 |
#include "LibLsp/JsonRpc/message.h" |
| 3 |
#include "LibLsp/lsp/lsDocumentUri.h" |
| 4 |
|
| 5 |
/** |
| 6 |
* General parameters to register for a capability. |
| 7 |
*/ |
| 8 |
|
| 9 |
struct Registration |
| 10 |
{ |
| 11 |
static Registration Create(std::string const& method); |
| 12 |
/** |
| 13 |
* The id used to register the request. The id can be used to deregister |
| 14 |
* the request again. |
| 15 |
*/ |
| 16 |
std::string id; |
| 17 |
|
| 18 |
/** |
| 19 |
* The method / capability to register for. |
| 20 |
*/ |
| 21 |
|
| 22 |
std::string method; |
| 23 |
|
| 24 |
MAKE_SWAP_METHOD(Registration, id, method); |
| 25 |
}; |
| 26 |
|
| 27 |
MAKE_REFLECT_STRUCT(Registration, id, method); |
| 28 |
|
| 29 |
/** |
| 30 |
* The client/registerCapability request is sent from the server to the client to register |
| 31 |
* for a new capability on the client side. Not all clients need to support dynamic |
| 32 |
* capability registration. A client opts in via the dynamicRegistration property on the |
| 33 |
* specific client capabilities. A client can even provide dynamic registration for |
| 34 |
* capability A but not for capability B (see TextDocumentClientCapabilities as an example). |
| 35 |
*/ |
| 36 |
struct RegistrationParams |
| 37 |
{ |
| 38 |
std::vector<Registration> registrations; |
| 39 |
MAKE_SWAP_METHOD(RegistrationParams, registrations); |
| 40 |
}; |
| 41 |
/** |
| 42 |
* The client/registerCapability request is sent from the server to the client |
| 43 |
* to register for a new capability on the client side. |
| 44 |
* Not all clients need to support dynamic capability registration. |
| 45 |
* A client opts in via the ClientCapabilities.dynamicRegistration property |
| 46 |
*/ |
| 47 |
MAKE_REFLECT_STRUCT(RegistrationParams, registrations); |
| 48 |
|
| 49 |
DEFINE_REQUEST_RESPONSE_TYPE(Req_ClientRegisterCapability, RegistrationParams, JsonNull, "client/registerCapability"); |