| 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 <vector> |
| 9 |
struct DocumentColorParams |
| 10 |
{ |
| 11 |
/** |
| 12 |
* The text document. |
| 13 |
*/ |
| 14 |
|
| 15 |
lsTextDocumentIdentifier textDocument; |
| 16 |
MAKE_SWAP_METHOD(DocumentColorParams, textDocument); |
| 17 |
}; |
| 18 |
MAKE_REFLECT_STRUCT(DocumentColorParams, textDocument); |
| 19 |
|
| 20 |
/** |
| 21 |
* The document color request is sent from the client to the server to list all color references found in a given text |
| 22 |
* document. Along with the range, a color value in RGB is returned. |
| 23 |
* |
| 24 |
* Clients can use the result to decorate color references in an editor. For example: |
| 25 |
* - Color boxes showing the actual color next to the reference |
| 26 |
* - Show a color picker when a color reference is edited |
| 27 |
* |
| 28 |
* Since version 3.6.0 |
| 29 |
*/ |
| 30 |
|
| 31 |
namespace TextDocument |
| 32 |
{ |
| 33 |
struct Color |
| 34 |
{ |
| 35 |
/** |
| 36 |
* The red component of this color in the range [0-1]. |
| 37 |
*/ |
| 38 |
double red = 0; |
| 39 |
|
| 40 |
/** |
| 41 |
* The green component of this color in the range [0-1]. |
| 42 |
*/ |
| 43 |
double green = 0; |
| 44 |
|
| 45 |
/** |
| 46 |
* The blue component of this color in the range [0-1]. |
| 47 |
*/ |
| 48 |
double blue = 0; |
| 49 |
|
| 50 |
/** |
| 51 |
* The alpha component of this color in the range [0-1]. |
| 52 |
*/ |
| 53 |
double alpha = 0; |
| 54 |
MAKE_SWAP_METHOD(TextDocument::Color, red, green, blue, alpha) |
| 55 |
}; |
| 56 |
} // namespace TextDocument |
| 57 |
MAKE_REFLECT_STRUCT(TextDocument::Color, red, green, blue, alpha) |
| 58 |
|
| 59 |
struct ColorInformation |
| 60 |
{ |
| 61 |
/** |
| 62 |
* The range in the document where this color appers. |
| 63 |
*/ |
| 64 |
|
| 65 |
lsRange range; |
| 66 |
|
| 67 |
/** |
| 68 |
* The actual color value for this color range. |
| 69 |
*/ |
| 70 |
|
| 71 |
TextDocument::Color color; |
| 72 |
MAKE_SWAP_METHOD(ColorInformation, range, color) |
| 73 |
}; |
| 74 |
MAKE_REFLECT_STRUCT(ColorInformation, range, color) |
| 75 |
|
| 76 |
DEFINE_REQUEST_RESPONSE_TYPE( |
| 77 |
td_documentColor, DocumentColorParams, std::vector<ColorInformation>, "textDocument/documentColor" |
| 78 |
); |