Debian Codegraph @

LspCpp/include/LibLsp/lsp/textDocument/inlayHint.h

raw
1 #pragma once
2
3 #include "LibLsp/JsonRpc/RequestInMessage.h"
4 #include "LibLsp/JsonRpc/lsResponseMessage.h"
5 #include "LibLsp/lsp/lsTextDocumentIdentifier.h"
6 #include "LibLsp/lsp/lsRange.h"
7 #include "LibLsp/lsp/location_type.h"
8 #include "LibLsp/lsp/lsCommand.h"
9 #include "LibLsp/lsp/lsTextEdit.h"
10 #include "LibLsp/lsp/lsAny.h"
11
12 namespace TextDocumentInlayHint
13 {
14
15 struct Params
16 {
17 // The text document
18 lsTextDocumentIdentifier textDocument;
19 // The visible document range for which inlay hints should be computed.
20 lsRange range;
21
22 MAKE_SWAP_METHOD(Params, textDocument, range)
23 };
24
25 }; // namespace TextDocumentInlayHint
26 MAKE_REFLECT_STRUCT(TextDocumentInlayHint::Params, textDocument, range);
27
28 struct lsInlayHintLabelPart
29 {
30
31 /**
32 * The value of this label part.
33 */
34 std::string value;
35
36 /**
37 * The tooltip text when you hover over this label part. Depending on
38 * the client capability `inlayHint.resolveSupport` clients might resolve
39 * this property late using the resolve request.
40 */
41 optional<std::string> tooltip;
42
43 /**
44 * An optional source code location that represents this
45 * label part.
46 *
47 * The editor will use this location for the hover and for code navigation
48 * features: This part will become a clickable link that resolves to the
49 * definition of the symbol at the given location (not necessarily the
50 * location itself), it shows the hover that shows at the given location,
51 * and it shows a context menu with further code navigation commands.
52 *
53 * Depending on the client capability `inlayHint.resolveSupport` clients
54 * might resolve this property late using the resolve request.
55 */
56 optional<lsLocation> location;
57
58 /**
59 * An optional command for this label part.
60 *
61 * Depending on the client capability `inlayHint.resolveSupport` clients
62 * might resolve this property late using the resolve request.
63 */
64 optional<lsCommand<lsp::Any>> command;
65
66 MAKE_SWAP_METHOD(lsInlayHintLabelPart, value, tooltip, location, command)
67 };
68
69 MAKE_REFLECT_STRUCT(lsInlayHintLabelPart, value, tooltip, location, command);
70
71 enum class lsInlayHintKind
72 {
73
74 // An inlay hint that for a type annotation.
75 Type = 1,
76
77 // An inlay hint that is for a parameter.
78 Parameter = 2
79 };
80
81 MAKE_REFLECT_TYPE_PROXY(lsInlayHintKind);
82
83 /**
84 * a inlay hint is displayed in the editor right next to normal code, it is only readable text
85 * that acts like a hint, for example parameter names in function calls are displayed in editors
86 * as inlay hints
87 */
88 struct lsInlayHint
89 {
90
91 /**
92 * The position of this hint.
93 *
94 * If multiple hints have the same position, they will be shown in the order
95 * they appear in the response.
96 */
97 lsPosition position;
98
99 /**
100 * The label of this hint. A human readable string or an array of
101 * InlayHintLabelPart label parts.
102 *
103 * *Note* that neither the string nor the label part can be empty.
104 */
105 std::string label;
106
107 /**
108 * The kind of this hint. Can be omitted in which case the client
109 * should fall back to a reasonable default.
110 */
111 optional<lsInlayHintKind> kind;
112
113 /**
114 * Optional text edits that are performed when accepting this inlay hint.
115 *
116 * *Note* that edits are expected to change the document so that the inlay
117 * hint (or its nearest variant) is now part of the document and the inlay
118 * hint itself is now obsolete.
119 *
120 * Depending on the client capability `inlayHint.resolveSupport` clients
121 * might resolve this property late using the resolve request.
122 */
123 optional<std::vector<lsTextEdit>> textEdits;
124
125 /**
126 * The tooltip text when you hover over this item.
127 *
128 * Depending on the client capability `inlayHint.resolveSupport` clients
129 * might resolve this property late using the resolve request.
130 */
131 optional<std::string> tooltip;
132
133 /**
134 * Render padding before the hint.
135 *
136 * Note: Padding should use the editor's background color, not the
137 * background color of the hint itself. That means padding can be used
138 * to visually align/separate an inlay hint.
139 */
140 optional<bool> paddingLeft;
141
142 /**
143 * Render padding after the hint.
144 *
145 * Note: Padding should use the editor's background color, not the
146 * background color of the hint itself. That means padding can be used
147 * to visually align/separate an inlay hint.
148 */
149 optional<bool> paddingRight;
150
151 /**
152 * A data entry field that is preserved on an inlay hint between
153 * a `textDocument/inlayHint` and a `inlayHint/resolve` request.
154 */
155 optional<lsp::Any> data;
156
157 MAKE_SWAP_METHOD(lsInlayHint, position, label, kind, textEdits, tooltip, paddingLeft, paddingRight, data)
158 };
159
160 MAKE_REFLECT_STRUCT(lsInlayHint, position, label, kind, textEdits, tooltip, paddingLeft, paddingRight, data)
161
162 DEFINE_REQUEST_RESPONSE_TYPE(
163 td_inlayHint, TextDocumentInlayHint::Params, std::vector<lsInlayHint>, "textDocument/inlayHint"
164 );
165
166 /**
167 * The document link resolve request is sent from the client to the server to resolve the target of a given document link.
168 */
169 DEFINE_REQUEST_RESPONSE_TYPE(td_inlayHintResolve, lsInlayHint, lsInlayHint, "inlayHint/resolve");