| 1 |
#pragma once |
| 2 |
#include "LibLsp/lsp/lsDocumentUri.h" |
| 3 |
#include "LibLsp/lsp/lsVersionedTextDocumentIdentifier.h" |
| 4 |
|
| 5 |
#include "LibLsp/JsonRpc/NotificationInMessage.h" |
| 6 |
#include "LibLsp/JsonRpc/lsResponseMessage.h" |
| 7 |
|
| 8 |
/** |
| 9 |
* Represents a semantic highlighting information that has to be applied on a specific line of the text document. |
| 10 |
*/ |
| 11 |
|
| 12 |
struct SemanticHighlightingInformation |
| 13 |
{ |
| 14 |
/** |
| 15 |
* The zero-based line position in the text document. |
| 16 |
*/ |
| 17 |
int line = 0; |
| 18 |
|
| 19 |
/** |
| 20 |
* A base64 encoded string representing every single highlighted ranges in the line with its start position, length |
| 21 |
* and the "lookup table" index of of the semantic highlighting <a href="https://manual.macromates.com/en/language_grammars"> |
| 22 |
* TextMate scopes</a>. If the {@code tokens} is empty or not defined, then no highlighted positions are available for the line. |
| 23 |
*/ |
| 24 |
std::string tokens; |
| 25 |
|
| 26 |
MAKE_SWAP_METHOD(SemanticHighlightingInformation, line, tokens) |
| 27 |
}; |
| 28 |
|
| 29 |
MAKE_REFLECT_STRUCT(SemanticHighlightingInformation, line, tokens); |
| 30 |
|
| 31 |
/** |
| 32 |
* Parameters for the semantic highlighting (server-side) push notification. |
| 33 |
*/ |
| 34 |
|
| 35 |
struct SemanticHighlightingParams |
| 36 |
{ |
| 37 |
/** |
| 38 |
* The text document that has to be decorated with the semantic highlighting information. |
| 39 |
*/ |
| 40 |
|
| 41 |
lsVersionedTextDocumentIdentifier textDocument; |
| 42 |
|
| 43 |
/** |
| 44 |
* An array of semantic highlighting information. |
| 45 |
*/ |
| 46 |
|
| 47 |
std::vector<SemanticHighlightingInformation> lines; |
| 48 |
|
| 49 |
MAKE_SWAP_METHOD(SemanticHighlightingParams, textDocument, lines) |
| 50 |
}; |
| 51 |
MAKE_REFLECT_STRUCT(SemanticHighlightingParams, textDocument, lines); |
| 52 |
/** |
| 53 |
* The {@code textDocument/semanticHighlighting} notification is pushed from the server to the client |
| 54 |
* to inform the client about additional semantic highlighting information that has to be applied |
| 55 |
* on the text document. It is the server's responsibility to decide which lines are included in |
| 56 |
* the highlighting information. In other words, the server is capable of sending only a delta |
| 57 |
* information. For instance, after opening the text document ({@code DidOpenTextDocumentNotification}) |
| 58 |
* the server sends the semantic highlighting information for the entire document, but if the server |
| 59 |
* receives a {@code DidChangeTextDocumentNotification}, it pushes the information only about |
| 60 |
* the affected lines in the document. |
| 61 |
* |
| 62 |
* <p> |
| 63 |
* <b>Note:</b> the <a href= |
| 64 |
* "https://github.com/Microsoft/vscode-languageserver-node/pull/367">{@code textDocument/semanticHighlighting} |
| 65 |
* language feature</a> is not yet part of the official LSP specification. |
| 66 |
*/ |
| 67 |
DEFINE_NOTIFICATION_TYPE(Notify_semanticHighlighting, SemanticHighlightingParams, "textDocument/semanticHighlighting"); |