summaryrefslogtreecommitdiff
path: root/graphics/asymptote/LspCpp/include/LibLsp/lsp/textDocument/semanticHighlighting.h
blob: bfb8619559f04000c6181f09179f7f3be997e233 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#pragma once
#include "LibLsp/lsp/lsDocumentUri.h"
#include "LibLsp/lsp/lsVersionedTextDocumentIdentifier.h"

#include "LibLsp/JsonRpc/NotificationInMessage.h"
#include "LibLsp/JsonRpc/lsResponseMessage.h"

/**
 * Represents a semantic highlighting information that has to be applied on a specific line of the text document.
 */

struct SemanticHighlightingInformation {
        /**
         * The zero-based line position in the text document.
         */
        int line = 0;

        /**
         * A base64 encoded string representing every single highlighted ranges in the line with its start position, length
         * and the "lookup table" index of of the semantic highlighting <a href="https://manual.macromates.com/en/language_grammars">
         * TextMate scopes</a>. If the {@code tokens} is empty or not defined, then no highlighted positions are available for the line.
         */
         std::string tokens;

         MAKE_SWAP_METHOD(SemanticHighlightingInformation, line, tokens)
};

MAKE_REFLECT_STRUCT(SemanticHighlightingInformation, line, tokens);

/**
 * Parameters for the semantic highlighting (server-side) push notification.
 */

struct SemanticHighlightingParams {
        /**
         * The text document that has to be decorated with the semantic highlighting information.
         */

         lsVersionedTextDocumentIdentifier textDocument;

        /**
         * An array of semantic highlighting information.
         */

         std::vector<SemanticHighlightingInformation> lines;

         MAKE_SWAP_METHOD(SemanticHighlightingParams, textDocument, lines)

};
MAKE_REFLECT_STRUCT(SemanticHighlightingParams, textDocument, lines);
/**
         * The {@code textDocument/semanticHighlighting} notification is pushed from the server to the client
         * to inform the client about additional semantic highlighting information that has to be applied
         * on the text document. It is the server's responsibility to decide which lines are included in
         * the highlighting information. In other words, the server is capable of sending only a delta
         * information. For instance, after opening the text document ({@code DidOpenTextDocumentNotification})
         * the server sends the semantic highlighting information for the entire document, but if the server
         * receives a {@code DidChangeTextDocumentNotification}, it pushes the information only about
         * the affected lines in the document.
         *
         * <p>
         * <b>Note:</b> the <a href=
         * "https://github.com/Microsoft/vscode-languageserver-node/pull/367">{@code textDocument/semanticHighlighting}
         * language feature</a> is not yet part of the official LSP specification.
         */
DEFINE_NOTIFICATION_TYPE(Notify_semanticHighlighting, SemanticHighlightingParams, "textDocument/semanticHighlighting");