Debian Codegraph @

LspCpp/include/LibLsp/lsp/general/lsWorkspaceClientCapabilites.h

raw
1 #pragma once
2 #include "LibLsp/lsp/method_type.h"
3
4 #include <stdexcept>
5
6 #include "LibLsp/JsonRpc/message.h"
7 #include "LibLsp/lsp/lsDocumentUri.h"
8 #include "LibLsp/lsp/lsAny.h"
9 #include "LibLsp/lsp/extention/jdtls/searchSymbols.h"
10
11 /**
12 * Capabilities specific to `WorkspaceEdit`s
13 */
14
15 //New in version 3.13: ResourceOperationKind and FailureHandlingKind and the client capability workspace.workspaceEdit.
16 //resourceOperations as well as workspace.workspaceEdit.failureHandling.
17
18 //The capabilities of a workspace edit has evolved over the time.
19 //Clients can describe their support using the following client capability :
20
21 struct lschangeAnnotationSupport
22 {
23 /**
24 * Whether the client groups edits with equal labels into tree nodes,
25 * for instance all edits labelled with "Changes in Strings" would
26 * be a tree node.
27 */
28 optional<bool> groupsOnLabel;
29 MAKE_SWAP_METHOD(lschangeAnnotationSupport, groupsOnLabel)
30 };
31 MAKE_REFLECT_STRUCT(lschangeAnnotationSupport, groupsOnLabel)
32
33 struct WorkspaceEditCapabilities
34 {
35 /**
36 * The client supports versioned document changes in `WorkspaceEdit`s
37 */
38 optional<bool> documentChanges;
39
40 /**
41 * The client supports resource changes
42 * in `WorkspaceEdit`s.
43 *
44 * @deprecated Since LSP introduces resource operations, use {link #resourceOperations}
45 */
46
47 optional<bool> resourceChanges;
48
49 /**
50 * The resource operations the client supports. Clients should at least
51 * support 'create', 'rename' and 'delete' files and folders.
52 *
53 * @since 3.13.0
54 */
55 optional<std::vector<std::string>> resourceOperations;
56
57 /**
58 * The failure handling strategy of a client if applying the workspace edit
59 * fails.
60 *
61 * See {@link FailureHandlingKind} for allowed values.
62 */
63 optional<std::string> failureHandling;
64
65 /**
66 * Whether the client normalizes line endings to the client specific
67 * setting.
68 * If set to `true` the client will normalize line ending characters
69 * in a workspace edit to the client specific new line character(s).
70 *
71 * @since 3.16.0
72 */
73 optional<bool> normalizesLineEndings;
74 ;
75
76 /**
77 * Whether the client in general supports change annotations on text edits,
78 * create file, rename file and delete file changes.
79 *
80 * @since 3.16.0
81 */
82 optional<lschangeAnnotationSupport> changeAnnotationSupport;
83
84 MAKE_SWAP_METHOD(
85 WorkspaceEditCapabilities, documentChanges, resourceChanges, resourceOperations, failureHandling,
86 normalizesLineEndings, changeAnnotationSupport
87 )
88 };
89 MAKE_REFLECT_STRUCT(
90 WorkspaceEditCapabilities, documentChanges, resourceChanges, resourceOperations, failureHandling,
91 normalizesLineEndings, changeAnnotationSupport
92 )
93
94 struct DynamicRegistrationCapabilities
95 {
96 // Did foo notification supports dynamic registration.
97 optional<bool> dynamicRegistration;
98
99 MAKE_SWAP_METHOD(DynamicRegistrationCapabilities, dynamicRegistration);
100 };
101
102 MAKE_REFLECT_STRUCT(DynamicRegistrationCapabilities, dynamicRegistration);
103
104 struct InlayHintLazyProperties
105 {
106 optional<std::vector<std::string>> properties;
107
108 MAKE_SWAP_METHOD(InlayHintLazyProperties, properties)
109 };
110
111 MAKE_REFLECT_STRUCT(InlayHintLazyProperties, properties)
112
113 struct InlayHintClientCapabilities
114 {
115 // Whether inlay hints support dynamic registration.
116 optional<bool> dynamicRegistration;
117
118 optional<InlayHintLazyProperties> resolveSupport;
119
120 MAKE_SWAP_METHOD(InlayHintClientCapabilities, dynamicRegistration, resolveSupport);
121 };
122
123 MAKE_REFLECT_STRUCT(InlayHintClientCapabilities, dynamicRegistration, resolveSupport)
124
125 // Workspace specific client capabilities.
126 struct SymbolKindCapabilities
127 {
128 optional<std::vector<lsSymbolKind>> valueSet;
129
130 MAKE_SWAP_METHOD(SymbolKindCapabilities, valueSet)
131 };
132 MAKE_REFLECT_STRUCT(SymbolKindCapabilities, valueSet)
133
134 struct SymbolCapabilities : public DynamicRegistrationCapabilities
135 {
136 /**
137 * Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
138 */
139 optional<SymbolKindCapabilities> symbolKind;
140
141 MAKE_SWAP_METHOD(SymbolCapabilities, symbolKind, dynamicRegistration)
142 };
143 MAKE_REFLECT_STRUCT(SymbolCapabilities, symbolKind, dynamicRegistration)
144
145 struct lsFileOperations
146 {
147 /**
148 * Whether the client supports dynamic registration for file
149 * requests/notifications.
150 */
151 optional<bool> dynamicRegistration;
152
153 /**
154 * The client has support for sending didCreateFiles notifications.
155 */
156 optional<bool> didCreate;
157
158 /**
159 * The client has support for sending willCreateFiles requests.
160 */
161 optional<bool> willCreate;
162
163 /**
164 * The client has support for sending didRenameFiles notifications.
165 */
166 optional<bool> didRename;
167
168 /**
169 * The client has support for sending willRenameFiles requests.
170 */
171 optional<bool> willRename;
172
173 /**
174 * The client has support for sending didDeleteFiles notifications.
175 */
176 optional<bool> didDelete;
177
178 /**
179 * The client has support for sending willDeleteFiles requests.
180 */
181 optional<bool> willDelete;
182 MAKE_SWAP_METHOD(
183 lsFileOperations, dynamicRegistration, didCreate, willCreate, didRename, willRename, didDelete, willDelete
184 )
185 };
186 MAKE_REFLECT_STRUCT(
187 lsFileOperations, dynamicRegistration, didCreate, willCreate, didRename, willRename, didDelete, willDelete
188 )
189
190 struct lsWorkspaceClientCapabilites
191 {
192 // The client supports applying batch edits to the workspace.
193 optional<bool> applyEdit;
194
195 // Capabilities specific to `WorkspaceEdit`s
196 optional<WorkspaceEditCapabilities> workspaceEdit;
197
198 // Capabilities specific to the `workspace/didChangeConfiguration`
199 // notification.
200 optional<DynamicRegistrationCapabilities> didChangeConfiguration;
201
202 // Capabilities specific to the `workspace/didChangeWatchedFiles`
203 // notification.
204 optional<DynamicRegistrationCapabilities> didChangeWatchedFiles;
205
206 // Capabilities specific to the `workspace/symbol` request.
207 optional<SymbolCapabilities> symbol;
208
209 // Capabilities specific to the `workspace/executeCommand` request.
210 optional<DynamicRegistrationCapabilities> executeCommand;
211
212 /**
213 * The client has support for workspace folders.
214 *
215 * Since 3.6.0
216 */
217 optional<bool> workspaceFolders;
218
219 /**
220 * The client supports `workspace/configuration` requests.
221 *
222 * Since 3.6.0
223 */
224 optional<bool> configuration;
225
226 /**
227 * Capabilities specific to the semantic token requests scoped to the
228 * workspace.
229 *
230 * @since 3.16.0
231 */
232 optional<DynamicRegistrationCapabilities> semanticTokens;
233
234 /**
235 * Capabilities specific to the code lens requests scoped to the
236 * workspace.
237 *
238 * @since 3.16.0
239 */
240 optional<DynamicRegistrationCapabilities> codeLens;
241
242 /**
243 * The client has support for file requests/notifications.
244 *
245 * @since 3.16.0
246 */
247 optional<lsFileOperations> fileOperations;
248
249 MAKE_SWAP_METHOD(
250 lsWorkspaceClientCapabilites, applyEdit, workspaceEdit, didChangeConfiguration, didChangeWatchedFiles, symbol,
251 executeCommand, workspaceFolders, configuration, semanticTokens, codeLens, fileOperations
252 )
253 };
254
255 MAKE_REFLECT_STRUCT(
256 lsWorkspaceClientCapabilites, applyEdit, workspaceEdit, didChangeConfiguration, didChangeWatchedFiles, symbol,
257 executeCommand, workspaceFolders, configuration, semanticTokens, codeLens, fileOperations
258 )