| 1 |
#pragma once |
| 2 |
|
| 3 |
#include "LibLsp/JsonRpc/RequestInMessage.h" |
| 4 |
#include "LibLsp/JsonRpc/lsResponseMessage.h" |
| 5 |
|
| 6 |
#include "LibLsp/lsp/lsTextDocumentIdentifier.h" |
| 7 |
|
| 8 |
namespace WillSaveTextDocumentParams |
| 9 |
{ |
| 10 |
|
| 11 |
/** |
| 12 |
* Represents reasons why a text document is saved. |
| 13 |
*/ |
| 14 |
enum class TextDocumentSaveReason |
| 15 |
{ |
| 16 |
|
| 17 |
/** |
| 18 |
* Manually triggered, e.g. by the user pressing save, by starting debugging, |
| 19 |
* or by an API call. |
| 20 |
*/ |
| 21 |
Manual = (1), |
| 22 |
|
| 23 |
/** |
| 24 |
* Automatic after a delay. |
| 25 |
*/ |
| 26 |
AfterDelay = (2), |
| 27 |
|
| 28 |
/** |
| 29 |
* When the editor lost focus. |
| 30 |
*/ |
| 31 |
FocusOut = (3) |
| 32 |
}; |
| 33 |
|
| 34 |
struct Params |
| 35 |
{ |
| 36 |
/** |
| 37 |
* The document that will be saved. |
| 38 |
*/ |
| 39 |
lsTextDocumentIdentifier textDocument; |
| 40 |
|
| 41 |
/* |
| 42 |
* A reason why a text document is saved. |
| 43 |
*/ |
| 44 |
|
| 45 |
optional<TextDocumentSaveReason> reason; |
| 46 |
|
| 47 |
MAKE_SWAP_METHOD(Params, textDocument, reason); |
| 48 |
}; |
| 49 |
|
| 50 |
}; // namespace WillSaveTextDocumentParams |
| 51 |
MAKE_REFLECT_TYPE_PROXY(WillSaveTextDocumentParams::TextDocumentSaveReason); |
| 52 |
|
| 53 |
MAKE_REFLECT_STRUCT(WillSaveTextDocumentParams::Params, textDocument, reason); |
| 54 |
|
| 55 |
/** |
| 56 |
* The document save notification is sent from the client to the server when |
| 57 |
* the document for saved in the client. |
| 58 |
* |
| 59 |
* Registration Options: TextDocumentSaveRegistrationOptions |
| 60 |
*/ |
| 61 |
DEFINE_NOTIFICATION_TYPE(td_willSave, WillSaveTextDocumentParams::Params, "textDocument/willSave"); |
| 62 |
|
| 63 |
/** |
| 64 |
* The document will save request is sent from the client to the server before the document is actually saved. |
| 65 |
* The request can return an array of TextEdits which will be applied to the text document before it is saved. |
| 66 |
* Please note that clients might drop results if computing the text edits took too long or if a server constantly fails on this request. |
| 67 |
* This is done to keep the save fast and reliable. |
| 68 |
* |
| 69 |
* Registration Options: TextDocumentRegistrationOptions |
| 70 |
*/ |
| 71 |
DEFINE_REQUEST_RESPONSE_TYPE( |
| 72 |
td_willSaveWaitUntil, WillSaveTextDocumentParams::Params, std::vector<lsTextEdit>, "textDocument/willSaveWaitUntil" |
| 73 |
); |