| 1 |
#pragma once |
| 2 |
|
| 3 |
#include "LibLsp/JsonRpc/RequestInMessage.h" |
| 4 |
#include "LibLsp/JsonRpc/lsResponseMessage.h" |
| 5 |
|
| 6 |
#include "LibLsp/lsp/lsTextDocumentIdentifier.h" |
| 7 |
#include "LibLsp/lsp/lsRange.h" |
| 8 |
#include "documentColor.h" |
| 9 |
#include "LibLsp/lsp/lsTextEdit.h" |
| 10 |
|
| 11 |
struct ColorPresentationParams |
| 12 |
{ |
| 13 |
|
| 14 |
/** |
| 15 |
* The text document. |
| 16 |
*/ |
| 17 |
lsTextDocumentIdentifier textDocument; |
| 18 |
|
| 19 |
/** |
| 20 |
* The range in the document where this color appers. |
| 21 |
*/ |
| 22 |
|
| 23 |
lsRange range; |
| 24 |
|
| 25 |
/** |
| 26 |
* The actual color value for this color range. |
| 27 |
*/ |
| 28 |
|
| 29 |
TextDocument::Color color; |
| 30 |
MAKE_SWAP_METHOD(ColorPresentationParams, textDocument, range, color) |
| 31 |
}; |
| 32 |
MAKE_REFLECT_STRUCT(ColorPresentationParams, textDocument, range, color) |
| 33 |
|
| 34 |
struct ColorPresentation |
| 35 |
{ |
| 36 |
/** |
| 37 |
* The label of this color presentation. It will be shown on the color |
| 38 |
* picker header. By default this is also the text that is inserted when selecting |
| 39 |
* this color presentation. |
| 40 |
*/ |
| 41 |
|
| 42 |
std::string label; |
| 43 |
|
| 44 |
/** |
| 45 |
* An edit which is applied to a document when selecting |
| 46 |
* this presentation for the color. When `null` the label is used. |
| 47 |
*/ |
| 48 |
lsTextEdit textEdit; |
| 49 |
|
| 50 |
/** |
| 51 |
* An optional array of additional text edits that are applied when |
| 52 |
* selecting this color presentation. Edits must not overlap with the main edit nor with themselves. |
| 53 |
*/ |
| 54 |
std::vector<lsTextEdit> additionalTextEdits; |
| 55 |
MAKE_SWAP_METHOD(ColorPresentation, label, textEdit, additionalTextEdits) |
| 56 |
}; |
| 57 |
MAKE_REFLECT_STRUCT(ColorPresentation, label, textEdit, additionalTextEdits) |
| 58 |
|
| 59 |
DEFINE_REQUEST_RESPONSE_TYPE( |
| 60 |
td_colorPresentation, ColorPresentationParams, std::vector<ColorPresentation>, "textDocument/colorPresentation" |
| 61 |
) |