1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#ifndef LIFECYCLEMESSAHE_H
6#define LIFECYCLEMESSAHE_H
7
8#include "basicjsonstructures.h"
9
10namespace newlsp {
11
12struct ResolveSupport
13{
14 std::vector<Enum::Properties::type_value> properties{};
15};
16std::string toJsonValueStr(const ResolveSupport &val);
17
18struct CodeActionKind
19{
20 std::vector<Enum::CodeActionKind::type_value> valueSet{};
21};
22std::string toJsonValueStr(const CodeActionKind &val);
23
24struct CodeActionLiteralSupport
25{
26 CodeActionKind codeActionKind{};
27};
28std::string toJsonValueStr(const CodeActionLiteralSupport &val);
29
30struct ChangeAnotationSupport
31{
32 std::optional<bool> groupsOnLabel{};
33};
34std::string toJsonValueStr(const ChangeAnotationSupport &val);
35
36struct SymbolKind
37{
38 std::vector<Enum::SymbolKind::type_value> valueSet{};
39};
40std::string toJsonValueStr(const SymbolKind &val);
41
42struct WorkspaceEditClientCapabilities
43{
44 std::optional<bool> documentChanges{};
45 std::optional<std::vector<Enum::ResourceOperationKind::type_value>> resourceOperations{};
46 std::optional<Enum::FailureHandlingKind::type_value> failureHandling{};
47 std::optional<bool> normalizesLineEndings{};
48 std::optional<ChangeAnotationSupport> changeAnnotationSupport{};
49};
50std::string toJsonValueStr(const WorkspaceEditClientCapabilities &val);
51
52struct DidChangeConfigurationClientCapabilities
53{
54 std::optional<bool> dynamicRegistration{};
55};
56std::string toJsonValueStr(const DidChangeConfigurationClientCapabilities &val);
57
58struct DidChangeWatchedFilesClientCapabilities
59{
60 std::optional<bool> dynamicRegistration{};
61 std::optional<bool> relativePatternSupport{};
62};
63std::string toJsonValueStr(const DidChangeWatchedFilesClientCapabilities &val);
64
65struct ExecuteCommandClientCapabilities
66{
67 std::optional<bool> dynamicRegistration{};
68};
69std::string toJsonValueStr(const ExecuteCommandClientCapabilities &val);
70
71struct WorkspaceSymbolClientCapabilities
72{
73 struct TagSupport
74 {
75 std::vector<Enum::SymbolTag::type_value> valueSet{};
76 };
77 std::optional<bool> dynamicRegistration{};
78 std::optional<SymbolKind> symbolKind{};
79 std::optional<TagSupport> tagSupport{};
80 std::optional<std::vector<std::string>> resolveSupport{};
81
82};
83std::string toJsonValueStr(const WorkspaceSymbolClientCapabilities &val);
84
85struct SemanticTokensWorkspaceClientCapabilities
86{
87 std::optional<bool> refreshSupport{};
88};
89std::string toJsonValueStr(const SemanticTokensWorkspaceClientCapabilities &val);
90
91struct CodeLensWorkspaceClientCapabilities
92{
93 std::optional<bool> refreshSupport{};
94};
95std::string toJsonValueStr(const CodeLensWorkspaceClientCapabilities &val);
96
97struct InlineValueWorkspaceClientCapabilities
98{
99 std::optional<bool> refreshSupport{};
100};
101std::string toJsonValueStr(const InlineValueWorkspaceClientCapabilities &val);
102
103struct InlayHintWorkspaceClientCapabilities
104{
105 std::optional<bool> refreshSupport{};
106};
107std::string toJsonValueStr(const InlayHintWorkspaceClientCapabilities &val);
108
109struct DiagnosticWorkspaceClientCapabilities
110{
111 std::optional<bool> refreshSupport{};
112};
113std::string toJsonValueStr(const DiagnosticWorkspaceClientCapabilities &val);
114
115struct TextDocumentSyncClientCapabilities
116{
117 std::optional<bool> dynamicRegistration{};
118 std::optional<bool> willSave{};
119 std::optional<bool> willSaveWaitUntil{};
120 std::optional<bool> didSave{};
121};
122std::string toJsonValueStr(const TextDocumentSyncClientCapabilities &val);
123
124struct CompletionClientCapabilities
125{
126 struct CompletionItem
127 {
128 struct TagSupport
129 {
130 std::vector<Enum::CompletionItemTag::type_value> valueSet{};
131 };
132
133 struct InsertTextModeSupport
134 {
135 std::vector<Enum::InsertTextMode::type_value> valueSet{};
136 };
137
138 std::optional<bool> snippetSupport{};
139 std::optional<bool> commitCharactersSupport{};
140 std::optional<std::vector<Enum::MarkupKind::type_value>> documentationFormat{};
141 std::optional<bool> deprecatedSupport{};
142 std::optional<bool> preselectSupport{};
143 std::optional<TagSupport> tagSupport{};
144 std::optional<bool> insertReplaceSupport{};
145 std::optional<ResolveSupport> resolveSupport{};
146 std::optional<InsertTextModeSupport> insertTextModeSupport{};
147 std::optional<bool> labelDetailsSupport{};
148 CompletionItem() = default;
149
150 };
151
152 struct CompletionItemKind
153 {
154 std::optional<std::vector<Enum::CompletionItemKind::type_value>> valueSet{};
155 CompletionItemKind() = default;
156 };
157
158 struct CompletionList
159 {
160 std::optional<std::vector<std::string>> itemDefaults{};
161 };
162
163 std::optional<bool> dynamicRegistration{};
164 std::optional<CompletionItem> completionItem{};
165 std::optional<CompletionItemKind> completionItemKind{};
166 std::optional<bool> contextSupport{};
167 std::optional<Enum::InsertTextMode::type_value> insertTextMode{};
168 std::optional<CompletionList> itemDefaults{};
169 CompletionClientCapabilities() = default;
170};
171std::string toJsonValueStr(const CompletionClientCapabilities &val);
172std::string toJsonValueStr(const CompletionClientCapabilities::CompletionItem &val);
173std::string toJsonValueStr(const CompletionClientCapabilities::CompletionItem::TagSupport &val);
174std::string toJsonValueStr(const CompletionClientCapabilities::CompletionItem::InsertTextModeSupport &val);
175std::string toJsonValueStr(const CompletionClientCapabilities::CompletionList &val);
176std::string toJsonValueStr(const CompletionClientCapabilities::CompletionItemKind &val);
177
178struct HoverClientCapabilities
179{
180 std::optional<bool> dynamicRegistration{};
181 std::optional<std::vector<Enum::MarkupKind::type_value>> contentFormat{};
182};
183std::string toJsonValueStr(const HoverClientCapabilities &val);
184
185struct SignatureHelpClientCapabilities
186{
187 struct SignatureInformation
188 {
189 struct ParameterInformation
190 {
191 std::optional<bool> labelOffsetSupport{};
192 };
193 std::optional<std::vector<Enum::MarkupKind::type_value>> documentationFormat{};
194 std::optional<ParameterInformation> parameterInformation{};
195 std::optional<bool> activeParameterSupport{};
196 };
197 std::optional<bool> dynamicRegistration{};
198 std::optional<SignatureInformation> signatureInformation{};
199 std::optional<bool> contextSupport{};
200};
201std::string toJsonValueStr(const SignatureHelpClientCapabilities::SignatureInformation::ParameterInformation &val);
202std::string toJsonValueStr(const SignatureHelpClientCapabilities::SignatureInformation &val);
203std::string toJsonValueStr(const SignatureHelpClientCapabilities &val);
204
205struct DeclarationClientCapabilities
206{
207 std::optional<bool> dynamicRegistration{};
208 std::optional<bool> linkSupport{};
209};
210std::string toJsonValueStr(const DeclarationClientCapabilities &val);
211
212struct DefinitionClientCapabilities
213{
214 std::optional<bool> dynamicRegistration{};
215 std::optional<bool> linkSupport{};
216};
217std::string toJsonValueStr(const DefinitionClientCapabilities &val);
218
219struct TypeDefinitionClientCapabilities
220{
221 std::optional<bool> dynamicRegistration{};
222 std::optional<bool> linkSupport{};
223};
224std::string toJsonValueStr(const TypeDefinitionClientCapabilities &val);
225
226struct ImplementationClientCapabilities
227{
228 std::optional<bool> dynamicRegistration{};
229 std::optional<bool> linkSupport{};
230};
231std::string toJsonValueStr(const ImplementationClientCapabilities &val);
232
233struct ReferenceClientCapabilities
234{
235 std::optional<bool> dynamicRegistration{};
236};
237std::string toJsonValueStr(const ReferenceClientCapabilities &val);
238
239struct DocumentHighlightClientCapabilities
240{
241 std::optional<bool> dynamicRegistration{};
242};
243std::string toJsonValueStr(const DocumentHighlightClientCapabilities &val);
244
245struct DocumentSymbolClientCapabilities
246{
247 struct TagSupport
248 {
249 std::vector<Enum::SymbolKind::type_value> valueSet{};
250 };
251 std::optional<bool> dynamicRegistration{};
252 std::optional<SymbolKind> symbolKind{};
253 std::optional<bool> hierarchicalDocumentSymbolSupport{};
254 std::optional<TagSupport> tagSupport{};
255 std::optional<bool> labelSupport{};
256
257};
258std::string toJsonValueStr(const DocumentSymbolClientCapabilities &val);
259
260struct CodeActionClientCapabilities
261{
262 std::optional<bool> dynamicRegistration{};
263 std::optional<CodeActionLiteralSupport> codeActionLiteralSupport{};
264 std::optional<bool> isPreferredSupport{};
265 std::optional<bool> disabledSupport{};
266 std::optional<bool> dataSupport{};
267 std::optional<ResolveSupport> resolveSupport{};
268 std::optional<bool> honorsChangeAnnotations{};
269};
270std::string toJsonValueStr(const CodeActionClientCapabilities &val);
271
272struct CodeLensClientCapabilities
273{
274 std::optional<bool> dynamicRegistration{};
275};
276std::string toJsonValueStr(const CodeLensClientCapabilities &val);
277
278struct DocumentLinkClientCapabilities
279{
280 std::optional<bool> dynamicRegistration{};
281 std::optional<bool> tooltipSupport{};
282};
283std::string toJsonValueStr(const DocumentLinkClientCapabilities &val);
284
285struct DocumentColorClientCapabilities
286{
287 std::optional<bool> dynamicRegistration{};
288};
289std::string toJsonValueStr(const DocumentColorClientCapabilities &val);
290
291struct DocumentFormattingClientCapabilities
292{
293 std::optional<bool> dynamicRegistration{};
294};
295std::string toJsonValueStr(const DocumentFormattingClientCapabilities &val);
296
297struct DocumentRangeFormattingClientCapabilities
298{
299 std::optional<bool> dynamicRegistration{};
300};
301std::string toJsonValueStr(const DocumentRangeFormattingClientCapabilities &val);
302
303struct DocumentOnTypeFormattingClientCapabilities
304{
305 std::optional<bool> dynamicRegistration{};
306};
307std::string toJsonValueStr(const DocumentOnTypeFormattingClientCapabilities &val);
308
309struct RenameClientCapabilities
310{
311 std::optional<bool> dynamicRegistration{};
312 std::optional<bool> prepareSupport{};
313 std::optional<Enum::PrepareSupportDefaultBehavior::type_value> prepareSupportDefaultBehavior{};
314 std::optional<bool> honorsChangeAnnotations{};
315};
316std::string toJsonValueStr(const RenameClientCapabilities &val);
317
318struct PublishDiagnosticsClientCapabilities
319{
320 struct TagSupport
321 {
322 std::vector<Enum::DiagnosticTag::type_value> valueSet{};
323 };
324 std::optional<bool> relatedInformation{};
325 std::optional<TagSupport> tagSupport{};
326 std::optional<bool> versionSupport{};
327 std::optional<bool> codeDescriptionSupport{};
328 std::optional<bool> dataSupport{};
329};
330std::string toJsonValueStr(const PublishDiagnosticsClientCapabilities &val);
331
332struct FoldingRangeClientCapabilities
333{
334 struct FoldingRangeKind
335 {
336 std::optional<std::vector<Enum::FoldingRangeKind::type_value>> valueSet{};
337 };
338
339 struct FoldingRange
340 {
341 std::optional<bool> collapsedText{};
342 };
343 std::optional<bool> dynamicRegistration{};
344 std::optional<unsigned int> rangeLimit{};
345 std::optional<bool> lineFoldingOnly{};
346 std::optional<FoldingRangeKind> foldingRangeKind{};
347 std::optional<FoldingRange> foldingRange;
348};
349std::string toJsonValueStr(const FoldingRangeClientCapabilities::FoldingRange &val);
350std::string toJsonValueStr(const FoldingRangeClientCapabilities::FoldingRangeKind &val);
351std::string toJsonValueStr(const FoldingRangeClientCapabilities &val);
352
353struct SelectionRangeClientCapabilities
354{
355 std::optional<bool> dynamicRegistration{};
356};
357std::string toJsonValueStr(const SelectionRangeClientCapabilities &val);
358
359struct LinkedEditingRangeClientCapabilities
360{
361 std::optional<bool> dynamicRegistration{};
362};
363std::string toJsonValueStr(const LinkedEditingRangeClientCapabilities &val);
364
365struct CallHierarchyClientCapabilities
366{
367 std::optional<bool> dynamicRegistration{};
368};
369std::string toJsonValueStr(const CallHierarchyClientCapabilities &val);
370
371struct SemanticTokensClientCapabilities
372{
373 struct Requests
374 {
375 struct Full
376 {
377 std::optional<bool> delta;
378 };
379
380 std::optional<std::any> range{}; // boolean | {};
381 std::optional<Full> full{}; // full?: boolean | { delta?: boolean; }
382 };
383
384 Requests requests;
385 std::vector<Enum::SemanticTokenTypes::type_value> tokenTypes{};
386 std::vector<Enum::SemanticTokenModifiers::type_value> tokenModifiers{};
387 std::vector<Enum::TokenFormat::type_value> formats{};
388 std::optional<bool> dynamicRegistration{};
389 std::optional<bool> overlappingTokenSupport{};
390 std::optional<bool> multilineTokenSupport{};
391 std::optional<bool> serverCancelSupport{};
392 std::optional<bool> augmentsSyntaxTokens{};
393};
394std::string toJsonValueStr(const SemanticTokensClientCapabilities &val);
395
396struct MonikerClientCapabilities
397{
398 std::optional<bool> dynamicRegistration{};
399};
400std::string toJsonValueStr(const MonikerClientCapabilities &val);
401
402struct TypeHierarchyClientCapabilities
403{
404 std::optional<bool> dynamicRegistration{};
405};
406std::string toJsonValueStr(const TypeHierarchyClientCapabilities &val);
407
408struct InlineValueClientCapabilities
409{
410 std::optional<bool> dynamicRegistration{};
411};
412std::string toJsonValueStr(const InlineValueClientCapabilities &val);
413
414struct InlayHintClientCapabilities
415{
416 std::optional<bool> dynamicRegistration{};
417 std::optional<ResolveSupport> resolveSupport{};
418};
419std::string toJsonValueStr(const InlayHintClientCapabilities &val);
420
421struct DiagnosticClientCapabilities
422{
423 std::optional<bool> dynamicRegistration{};
424 std::optional<bool> relatedDocumentSupport{};
425};
426std::string toJsonValueStr(const DiagnosticClientCapabilities &val);
427
428struct TextDocumentClientCapabilities
429{
430 std::optional<TextDocumentSyncClientCapabilities> synchronization{};
431 std::optional<CompletionClientCapabilities> completion{};
432 std::optional<HoverClientCapabilities> hover{};
433 std::optional<SignatureHelpClientCapabilities> signatureHelp{};
434 std::optional<DeclarationClientCapabilities> declaration{};
435 std::optional<DefinitionClientCapabilities> definition{};
436 std::optional<TypeDefinitionClientCapabilities> typeDefinition{};
437 std::optional<ImplementationClientCapabilities> implementation{};
438 std::optional<ReferenceClientCapabilities> references{};
439 std::optional<DocumentHighlightClientCapabilities> documentHighlight{};
440 std::optional<DocumentSymbolClientCapabilities> documentSymbol{};
441 std::optional<CodeActionClientCapabilities> codeAction{};
442 std::optional<CodeLensClientCapabilities> codeLens{};
443 std::optional<DocumentLinkClientCapabilities> documentLink{};
444 std::optional<DocumentColorClientCapabilities> colorProvider{};
445 std::optional<DocumentFormattingClientCapabilities> formatting{};
446 std::optional<DocumentRangeFormattingClientCapabilities> rangeFormatting{};
447 std::optional<DocumentOnTypeFormattingClientCapabilities> onTypeFormatting{};
448 std::optional<RenameClientCapabilities> rename{};
449 std::optional<PublishDiagnosticsClientCapabilities> publishDiagnostics{};
450 std::optional<FoldingRangeClientCapabilities> foldingRange{};
451 std::optional<SelectionRangeClientCapabilities> selectionRange{};
452 std::optional<LinkedEditingRangeClientCapabilities> linkedEditingRange{};
453 std::optional<CallHierarchyClientCapabilities> callHierarchy{};
454 std::optional<SemanticTokensClientCapabilities> semanticTokens{};
455 std::optional<MonikerClientCapabilities> moniker{};
456 std::optional<TypeHierarchyClientCapabilities> typeHierarchy{};
457 std::optional<InlineValueClientCapabilities> inlineValue{};
458 std::optional<InlayHintClientCapabilities> inlayHint{};
459 std::optional<DiagnosticClientCapabilities> diagnostic{};
460};
461std::string toJsonValueStr(const TextDocumentClientCapabilities &val);
462
463struct FileOperations
464{
465 std::optional<bool> dynamicRegistration{};
466 std::optional<bool> didCreate{};
467 std::optional<bool> willCreate{};
468 std::optional<bool> didRename{};
469 std::optional<bool> willRename{};
470 std::optional<bool> didDelete{};
471 std::optional<bool> willDelete{};
472};
473std::string toJsonValueStr(const FileOperations &val);
474
475struct Workspace
476{
477 std::optional<bool> applyEdit{};
478 std::optional<WorkspaceEditClientCapabilities> workspaceEdit{};
479 std::optional<DidChangeConfigurationClientCapabilities> didChangeConfiguration{};
480 std::optional<DidChangeWatchedFilesClientCapabilities> didChangeWatchedFiles{};
481 std::optional<WorkspaceSymbolClientCapabilities> symbol{};
482 std::optional<ExecuteCommandClientCapabilities> executeCommand{};
483 std::optional<bool> workspaceFolders{};
484 std::optional<bool> configuration{};
485 std::optional<SemanticTokensWorkspaceClientCapabilities> semanticTokens{};
486 std::optional<CodeLensWorkspaceClientCapabilities> codeLens{};
487 std::optional<FileOperations> fileOperations{};
488 std::optional<InlineValueWorkspaceClientCapabilities> inlineValue{};
489 std::optional<InlayHintWorkspaceClientCapabilities> inlayHint{};
490 std::optional<DiagnosticWorkspaceClientCapabilities> diagnostics{};
491};
492std::string toJsonValueStr(const Workspace &val);
493
494struct NotebookDocumentSyncClientCapabilities
495{
496 std::optional<bool> dynamicRegistration{};
497 std::optional<bool> executionSummarySupport{};
498};
499std::string toJsonValueStr(const NotebookDocumentSyncClientCapabilities &val);
500
501struct NotebookDocumentClientCapabilities
502{
503 NotebookDocumentSyncClientCapabilities synchronization{};
504};
505std::string toJsonValueStr(const NotebookDocumentClientCapabilities &val);
506
507struct MessageActionItem
508{
509 std::optional<bool> additionalPropertiesSupport{};
510};
511std::string toJsonValueStr(const MessageActionItem &val);
512
513struct ShowMessageRequestClientCapabilities
514{
515 std::optional<MessageActionItem> messageActionItem{};
516};
517std::string toJsonValueStr(const ShowMessageRequestClientCapabilities &val);
518
519struct ShowDocumentClientCapabilities
520{
521 bool support{};
522};
523std::string toJsonValueStr(const ShowDocumentClientCapabilities &val);
524
525struct Window
526{
527 std::optional<bool> workDoneProgress{};
528 std::optional<ShowMessageRequestClientCapabilities> showMessage{};
529 std::optional<ShowDocumentClientCapabilities> showDocument{};
530};
531std::string toJsonValueStr(const Window &val);
532
533struct StaleRequestSupport
534{
535 bool cancel{};
536 std::vector<std::string> retryOnContentModified{};
537};
538std::string toJsonValueStr(const StaleRequestSupport &val);
539
540struct RegularExpressionsClientCapabilities
541{
542 std::string engine{};
543 std::optional<std::string> version{};
544};
545std::string toJsonValueStr(const RegularExpressionsClientCapabilities &val);
546
547struct MarkdownClientCapabilities
548{
549 std::string parser{};
550 std::optional<std::string> version{};
551 std::optional<std::vector<std::string>> allowedTags{};
552};
553std::string toJsonValueStr(const MarkdownClientCapabilities &val);
554
555struct General
556{
557 std::optional<StaleRequestSupport> staleRequestSupport{};
558 std::optional<RegularExpressionsClientCapabilities> regularExpressions{};
559 std::optional<MarkdownClientCapabilities> markdown{};
560 std::optional<std::vector<Enum::PositionEncodingKind::type_value>> positionEncodings{};
561 std::optional<std::any> experimental{};
562};
563std::string toJsonValueStr(const General &val);
564
565struct WorkspaceFolder
566{
567 DocumentUri uri{};
568 std::string name{};
569};
570std::string toJsonValueStr(const WorkspaceFolder &val);
571std::string toJsonValueStr(const std::vector<WorkspaceFolder> &val);
572
573struct ClientInfo
574{
575 std::string name{};
576 std::optional<std::string> version{};
577};
578std::string toJsonValueStr(const ClientInfo &val);
579
580struct ClientCapabilities
581{
582 std::optional<Workspace> workspace{};
583 std::optional<TextDocumentClientCapabilities> textDocument{};
584 std::optional<NotebookDocumentClientCapabilities> notebookDocument{};
585 std::optional<Window> window{};
586 std::optional<General> general{};
587};
588std::string toJsonValueStr(const ClientCapabilities &val);
589
590struct InitializeParams : WorkDoneProgressParams
591{
592 std::optional<int> processId{};
593 std::optional<ClientInfo> clientInfo{};
594 std::optional<std::string> locale{};
595 std::optional<std::string> rootPath{};
596 std::optional<std::string> rootUri{};
597 std::optional<std::string> language{}; // extend
598 std::optional<std::any> initializationOptions{};
599 ClientCapabilities capabilities{};
600 std::optional<Enum::TraceValue::type_value> trace{};
601 std::optional<std::vector<WorkspaceFolder>> workspaceFolders{};
602 std::string formatValue(const std::vector<WorkspaceFolder> &workspaceFolders) const;
603};
604std::string toJsonValueStr(const InitializeParams &val);
605
606struct InitializedParams
607{
608
609};
610std::string toJsonValueStr(const InitializedParams &val);
611
612} // namespace newlsp
613
614#endif // LIFECYCLEMESSAHE_H
615