| 1 |
#pragma once |
| 2 |
|
| 3 |
#include "LibLsp/JsonRpc/NotificationInMessage.h" |
| 4 |
#include "LibLsp/JsonRpc/lsResponseMessage.h" |
| 5 |
|
| 6 |
#include "LibLsp/lsp/lsVersionedTextDocumentIdentifier.h" |
| 7 |
#include "LibLsp/lsp/lsRange.h" |
| 8 |
#include "LibLsp/lsp/lsDocumentUri.h" |
| 9 |
struct lsTextDocumentContentChangeEvent |
| 10 |
{ |
| 11 |
// The range of the document that changed. |
| 12 |
optional<lsRange> range; |
| 13 |
// The length of the range that got replaced. |
| 14 |
optional<int> rangeLength; |
| 15 |
// The new text of the range/document. |
| 16 |
std::string text; |
| 17 |
|
| 18 |
MAKE_SWAP_METHOD(lsTextDocumentContentChangeEvent, range, rangeLength, text); |
| 19 |
}; |
| 20 |
MAKE_REFLECT_STRUCT(lsTextDocumentContentChangeEvent, range, rangeLength, text); |
| 21 |
|
| 22 |
struct lsTextDocumentDidChangeParams |
| 23 |
{ |
| 24 |
lsVersionedTextDocumentIdentifier textDocument; |
| 25 |
std::vector<lsTextDocumentContentChangeEvent> contentChanges; |
| 26 |
|
| 27 |
/** |
| 28 |
* Legacy property to support protocol version 1.0 requests. |
| 29 |
*/ |
| 30 |
|
| 31 |
optional<lsDocumentUri> uri; |
| 32 |
|
| 33 |
void swap(lsTextDocumentDidChangeParams& arg) noexcept |
| 34 |
{ |
| 35 |
uri.swap(arg.uri); |
| 36 |
contentChanges.swap(arg.contentChanges); |
| 37 |
textDocument.swap(arg.textDocument); |
| 38 |
} |
| 39 |
}; |
| 40 |
MAKE_REFLECT_STRUCT(lsTextDocumentDidChangeParams, textDocument, contentChanges, uri); |
| 41 |
|
| 42 |
/** |
| 43 |
* The document change notification is sent from the client to the server to |
| 44 |
* signal changes to a text document. |
| 45 |
* |
| 46 |
* Registration Options: TextDocumentChangeRegistrationOptions |
| 47 |
*/ |
| 48 |
DEFINE_NOTIFICATION_TYPE(Notify_TextDocumentDidChange, lsTextDocumentDidChangeParams, "textDocument/didChange"); |