summaryrefslogtreecommitdiff
path: root/graphics/asymptote/LspCpp/include/LibLsp/lsp/general/lsServerCapabilities.h
blob: d62d3e4dfd63a5e69805185f31437e37c4ac27bc (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
#pragma once
#include "LibLsp/lsp/method_type.h"


#include <stdexcept>
#include "LibLsp/JsonRpc/message.h"
#include "LibLsp/lsp/lsDocumentUri.h"
#include "LibLsp/lsp/lsAny.h"
#include "InitializeParams.h"
#include "LibLsp/lsp/textDocument/SemanticTokens.h"


extern void Reflect(Reader&, std::pair<boost::optional<lsTextDocumentSyncKind>, boost::optional<lsTextDocumentSyncOptions> >&);

//
 // Code Action options.
 //
struct  CodeActionOptions : WorkDoneProgressOptions {
        //
         // CodeActionKinds that this server may return.
         //
         // The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server
         // may list out every specific kind they provide.
         //
        typedef  std::string CodeActionKind;
         std::vector<CodeActionKind> codeActionKinds;

         MAKE_SWAP_METHOD(CodeActionOptions, workDoneProgress, codeActionKinds);
};
MAKE_REFLECT_STRUCT(CodeActionOptions, workDoneProgress, codeActionKinds)
struct CodeLensOptions : WorkDoneProgressOptions {
        //
         // Code lens has a resolve provider as well.
         //
        boost::optional<bool> resolveProvider ;
        MAKE_SWAP_METHOD(CodeLensOptions, workDoneProgress, resolveProvider);
};
MAKE_REFLECT_STRUCT(CodeLensOptions, workDoneProgress, resolveProvider)


// Format document on type options
struct lsDocumentOnTypeFormattingOptions :WorkDoneProgressOptions {
        // A character on which formatting should be triggered, like `}`.
        std::string firstTriggerCharacter;

        // More trigger characters.
        std::vector<std::string> moreTriggerCharacter;
        MAKE_SWAP_METHOD(lsDocumentOnTypeFormattingOptions, workDoneProgress,
                firstTriggerCharacter,
                moreTriggerCharacter);
};
MAKE_REFLECT_STRUCT(lsDocumentOnTypeFormattingOptions, workDoneProgress,
        firstTriggerCharacter,
        moreTriggerCharacter);
struct RenameOptions : WorkDoneProgressOptions {
        //
         // Renames should be checked and tested before being executed.
         //
        boost::optional<bool> prepareProvider;
        MAKE_SWAP_METHOD(RenameOptions, workDoneProgress, prepareProvider);
};
MAKE_REFLECT_STRUCT(RenameOptions,workDoneProgress,prepareProvider)

struct DocumentFilter{
        //
         // A language id, like `typescript`.
         //
        boost::optional<std::string> language;
        //
         // A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
         //
        boost::optional<std::string>scheme;
        //
         // A glob pattern, like `*.{ts,js}`.
         //
         // Glob patterns can have the following syntax:
         // - `*` to match one or more characters in a path segment
         // - `?` to match on one character in a path segment
         // - `**` to match any number of path segments, including none
         // - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}
         //   matches all TypeScript and JavaScript files)
         // - `[]` to declare a range of characters to match in a path segment
         //   (e.g., `example.[0-9]` to match on `example.0`, `example.1`,...)
         // - `[!...]` to negate a range of characters to match in a path segment
         //   (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but
         //   not `example.0`)
         //
        boost::optional<std::string>pattern;
        MAKE_SWAP_METHOD(DocumentFilter, language, scheme, pattern)
};
MAKE_REFLECT_STRUCT(DocumentFilter, language, scheme, pattern)

//A document selector is the combination of one or more document filters.
using DocumentSelector = std::vector<DocumentFilter>;

// Document link options
struct lsDocumentLinkOptions :WorkDoneProgressOptions {
        // Document links have a resolve provider as well.
        boost::optional<bool> resolveProvider;
        MAKE_SWAP_METHOD(lsDocumentLinkOptions, workDoneProgress, resolveProvider);
};
MAKE_REFLECT_STRUCT(lsDocumentLinkOptions, workDoneProgress,resolveProvider);

// Execute command options.
struct lsExecuteCommandOptions : WorkDoneProgressOptions {
        // The commands to be executed on the server
        std::vector<std::string> commands;
        MAKE_SWAP_METHOD(lsExecuteCommandOptions, workDoneProgress, commands);
};
MAKE_REFLECT_STRUCT(lsExecuteCommandOptions, workDoneProgress, commands);


struct TextDocumentRegistrationOptions
{
//
 // A document selector to identify the scope of the registration. If set to null
 // the document selector provided on the client side will be used.
 //
        boost::optional<DocumentSelector>  documentSelector;

        MAKE_SWAP_METHOD(TextDocumentRegistrationOptions, documentSelector);
};
MAKE_REFLECT_STRUCT(TextDocumentRegistrationOptions, documentSelector);

//
 // Static registration options to be returned in the initialize request.
 //
struct StaticRegistrationOptions :public TextDocumentRegistrationOptions
{
        //
         // The id used to register the request. The id can be used to deregister
         // the request again. See also Registration#id.
         //
        boost::optional<std::string> id;
        MAKE_SWAP_METHOD(StaticRegistrationOptions, documentSelector, id)
};
MAKE_REFLECT_STRUCT(StaticRegistrationOptions, documentSelector,id)

//
 // The server supports workspace folder.
 //
 // Since 3.6.0
 //

struct WorkspaceFoldersOptions {
        //
         // The server has support for workspace folders
         //
        boost::optional<bool>  supported;

        //
         // Whether the server wants to receive workspace folder
         // change notifications.
         //
         // If a string is provided, the string is treated as an ID
         // under which the notification is registered on the client
         // side. The ID can be used to unregister for these events
         // using the `client/unregisterCapability` request.
         //
        boost::optional<std::pair<  boost::optional<std::string>, boost::optional<bool> > > changeNotifications;
        MAKE_SWAP_METHOD(WorkspaceFoldersOptions, supported, changeNotifications);
};
MAKE_REFLECT_STRUCT(WorkspaceFoldersOptions, supported, changeNotifications);

//
 // A pattern kind describing if a glob pattern matches a file a folder or
 // both.
 //
 // @since 3.16.0
 //
enum lsFileOperationPatternKind
{
        file,
        folder
};
MAKE_REFLECT_TYPE_PROXY(lsFileOperationPatternKind)

//
 // Matching options for the file operation pattern.
 //
 // @since 3.16.0
 //
struct lsFileOperationPatternOptions {

        //
         // The pattern should be matched ignoring casing.
         //
        boost::optional<bool> ignoreCase;
        MAKE_SWAP_METHOD(lsFileOperationPatternOptions, ignoreCase)
};
MAKE_REFLECT_STRUCT(lsFileOperationPatternOptions, ignoreCase)
//
 // A pattern to describe in which file operation requests or notifications
 // the server is interested in.
 //
 // @since 3.16.0
 //
struct lsFileOperationPattern {
        //
         // The glob pattern to match. Glob patterns can have the following syntax:
         // - `*` to match one or more characters in a path segment
         // - `?` to match on one character in a path segment
         // - `**` to match any number of path segments, including none
         // - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}`
         //   matches all TypeScript and JavaScript files)
         // - `[]` to declare a range of characters to match in a path segment
         //   (e.g., `example.[0-9]` to match on `example.0`, `example.1`,...)
         // - `[!...]` to negate a range of characters to match in a path segment
         //   (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but
         //   not `example.0`)
         //
        std::string glob;

        //
         // Whether to match files or folders with this pattern.
         //
         // Matches both if undefined.
         //
        boost::optional<lsFileOperationPatternKind> matches;

        //
         // Additional options used during matching.
         //
        boost::optional<lsFileOperationPatternOptions> options ;
        MAKE_SWAP_METHOD(lsFileOperationPattern, glob, matches, options)
};
MAKE_REFLECT_STRUCT(lsFileOperationPattern, glob, matches, options)
//
 // A filter to describe in which file operation requests or notifications
 // the server is interested in.
 //
 // @since 3.16.0
 //
struct lsFileOperationFilter {

        //
         // A Uri like `file` or `untitled`.
         //
        boost::optional<std::string>  scheme;

        //
         // The actual file operation pattern.
         //
        boost::optional<lsFileOperationPattern> pattern;
        MAKE_SWAP_METHOD(lsFileOperationFilter, scheme, pattern)
};
MAKE_REFLECT_STRUCT(lsFileOperationFilter, scheme, pattern)
//
 // The options to register for file operations.
 //
 // @since 3.16.0
 //
struct lsFileOperationRegistrationOptions {
        //
         // The actual filters.
         //
        boost::optional<std::vector<lsFileOperationFilter>> filters;
        MAKE_SWAP_METHOD(lsFileOperationRegistrationOptions, filters)
};
MAKE_REFLECT_STRUCT(lsFileOperationRegistrationOptions, filters)

struct WorkspaceServerCapabilities {
        //
         // The server supports workspace folder.
         //
         // Since 3.6.0
         //
        WorkspaceFoldersOptions workspaceFolders;


        //
         // The server is interested in file notifications/requests.
         //
         // @since 3.16.0
         //
        struct  lsFileOperations
        {
                //
                 // The server is interested in receiving didCreateFiles
                 // notifications.
                 //
                boost::optional<lsFileOperationRegistrationOptions> didCreate;

                //
                 // The server is interested in receiving willCreateFiles requests.
                 //
                boost::optional<lsFileOperationRegistrationOptions> willCreate;

                //
                 // The server is interested in receiving didRenameFiles
                 // notifications.
                 //
                boost::optional<lsFileOperationRegistrationOptions> didRename;

                //
                 // The server is interested in receiving willRenameFiles requests.
                 //
                boost::optional<lsFileOperationRegistrationOptions> willRename;

                //
                 // The server is interested in receiving didDeleteFiles file
                 // notifications.
                 //
                boost::optional<lsFileOperationRegistrationOptions> didDelete;

                //
                 // The server is interested in receiving willDeleteFiles file
                 // requests.
                 //
                boost::optional<lsFileOperationRegistrationOptions> willDelete;
                MAKE_SWAP_METHOD(lsFileOperations, didCreate, willCreate, didRename, willRename, didDelete, willDelete)
        };
        boost::optional<lsFileOperations>fileOperations;


        MAKE_SWAP_METHOD(WorkspaceServerCapabilities, workspaceFolders, fileOperations)
};
MAKE_REFLECT_STRUCT(WorkspaceServerCapabilities, workspaceFolders, fileOperations)
MAKE_REFLECT_STRUCT(WorkspaceServerCapabilities::lsFileOperations, didCreate, willCreate, didRename, willRename, didDelete, willDelete)

//
 // Semantic highlighting server capabilities.
 //
 // <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.
 //

struct SemanticHighlightingServerCapabilities {
        //
         // A "lookup table" of semantic highlighting <a href="https://manual.macromates.com/en/language_grammars">TextMate scopes</a>
         // supported by the language server. If not defined or empty, then the server does not support the semantic highlighting
         // feature. Otherwise, clients should reuse this "lookup table" when receiving semantic highlighting notifications from
         // the server.
         //
         std::vector< std::vector<std::string> > scopes;
         MAKE_SWAP_METHOD(SemanticHighlightingServerCapabilities, scopes)
};
MAKE_REFLECT_STRUCT(SemanticHighlightingServerCapabilities, scopes)

struct SemanticTokensServerFull
{
        //
        // The server supports deltas for full documents.
        //
        bool delta =false;
        MAKE_SWAP_METHOD(SemanticTokensServerFull, delta)
};
MAKE_REFLECT_STRUCT(SemanticTokensServerFull, delta)
struct SemanticTokensWithRegistrationOptions
{
        SemanticTokensLegend legend;

        //
         // Server supports providing semantic tokens for a specific range
         // of a document.
         //
        boost::optional< std::pair< boost::optional<bool>, boost::optional<lsp::Any> > >  range;

        //
         // Server supports providing semantic tokens for a full document.
         //
        boost::optional< std::pair< boost::optional<bool>,
        boost::optional<SemanticTokensServerFull> > >  full;

        //
         // A document selector to identify the scope of the registration. If set to null
         // the document selector provided on the client side will be used.
         //
        boost::optional < std::vector<DocumentFilter> > documentSelector;
        //
         // The id used to register the request. The id can be used to deregister
         // the request again. See also Registration#id.
         //
        boost::optional<std::string> id;
        MAKE_SWAP_METHOD(SemanticTokensWithRegistrationOptions, legend, range, full, documentSelector, id)
};
MAKE_REFLECT_STRUCT(SemanticTokensWithRegistrationOptions, legend, range, full, documentSelector ,id)

using  DocumentColorOptions = WorkDoneProgressOptions;
using  FoldingRangeOptions = WorkDoneProgressOptions;
struct lsServerCapabilities {
        // Defines how text documents are synced. Is either a detailed structure
        // defining each notification or for backwards compatibility the

        // TextDocumentSyncKind number.
        boost::optional< std::pair<boost::optional<lsTextDocumentSyncKind>,
        boost::optional<lsTextDocumentSyncOptions> >> textDocumentSync;

        // The server provides hover support.
        boost::optional<bool>  hoverProvider;

        // The server provides completion support.
        boost::optional < lsCompletionOptions > completionProvider;

        // The server provides signature help support.
        boost::optional < lsSignatureHelpOptions > signatureHelpProvider;

        // The server provides goto definition support.
        boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > definitionProvider;


  //
   // The server provides Goto Type Definition support.
   //
   // Since 3.6.0
   //
        boost::optional< std::pair< boost::optional<bool>, boost::optional<StaticRegistrationOptions> > > typeDefinitionProvider ;

        // The server provides implementation support.
        boost::optional< std::pair< boost::optional<bool>, boost::optional<StaticRegistrationOptions> > >  implementationProvider ;

        // The server provides find references support.
        boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > referencesProvider ;

        // The server provides document highlight support.
        boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentHighlightProvider ;

        // The server provides document symbol support.
        boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentSymbolProvider ;

        // The server provides workspace symbol support.
        boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > workspaceSymbolProvider ;

        // The server provides code actions.
        boost::optional< std::pair< boost::optional<bool>, boost::optional<CodeActionOptions> > > codeActionProvider ;

        // The server provides code lens.
        boost::optional<CodeLensOptions> codeLensProvider;

        // The server provides document formatting.
        boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentFormattingProvider ;

        // The server provides document range formatting.
        boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentRangeFormattingProvider ;

        // The server provides document formatting on typing.
        boost::optional<lsDocumentOnTypeFormattingOptions> documentOnTypeFormattingProvider;

        // The server provides rename support.
        boost::optional< std::pair< boost::optional<bool>, boost::optional<RenameOptions> > >  renameProvider;


        // The server provides document link support.
        boost::optional<lsDocumentLinkOptions > documentLinkProvider;


        //
         // The server provides color provider support.
         //
         // @since 3.6.0
         //
        boost::optional< std::pair< boost::optional<bool>, boost::optional<DocumentColorOptions> > >  colorProvider;


        //
                 // The server provides folding provider support.
                 //
                 // @since 3.10.0
                 //
        boost::optional <  std::pair< boost::optional<bool>, boost::optional<FoldingRangeOptions> >   > foldingRangeProvider;

        // The server provides execute command support.
        boost::optional < lsExecuteCommandOptions >executeCommandProvider;


        //
         // Workspace specific server capabilities
         //
        boost::optional< WorkspaceServerCapabilities > workspace;

        //
         // Semantic highlighting server capabilities.
         //

         boost::optional<        SemanticHighlightingServerCapabilities >semanticHighlighting;

        //
         // Server capability for calculating super- and subtype hierarchies.
         // The LS supports the type hierarchy language feature, if this capability is set to {@code true}.
         //
         // <p>
         // <b>Note:</b> the <a href=
         // "https://github.com/Microsoft/vscode-languageserver-node/pull/426">{@code textDocument/typeHierarchy}
         // language feature</a> is not yet part of the official LSP specification.
         //

         boost::optional< std::pair< boost::optional<bool>,
        boost::optional<StaticRegistrationOptions> > > typeHierarchyProvider;

        //
         // The server provides Call Hierarchy support.
         //

         boost::optional< std::pair< boost::optional<bool>,
        boost::optional<StaticRegistrationOptions> > > callHierarchyProvider;

        //
         // The server provides selection range support.
         //
         // Since 3.15.0
         //
         boost::optional< std::pair< boost::optional<bool>,
        boost::optional<StaticRegistrationOptions> > > selectionRangeProvider;

         //
          // The server provides linked editing range support.
          //
          // Since 3.16.0
          //
         boost::optional< std::pair< boost::optional<bool>,
                 boost::optional<StaticRegistrationOptions> > > linkedEditingRangeProvider;


         //
          // The server provides semantic tokens support.
          //
          // Since 3.16.0
          //
         boost::optional < SemanticTokensWithRegistrationOptions> semanticTokensProvider;

         //
          // Whether server provides moniker support.
          //
          // Since 3.16.0
          //
         boost::optional< std::pair< boost::optional<bool>,
                 boost::optional<StaticRegistrationOptions> > >  monikerProvider;

        boost::optional<lsp::Any> experimental;


        MAKE_SWAP_METHOD(lsServerCapabilities,
                textDocumentSync,
                hoverProvider,
                completionProvider,
                signatureHelpProvider,
                definitionProvider,
                typeDefinitionProvider,
                implementationProvider,
                referencesProvider,
                documentHighlightProvider,
                documentSymbolProvider,
                workspaceSymbolProvider,
                codeActionProvider,
                codeLensProvider,
                documentFormattingProvider,
                documentRangeFormattingProvider,
                documentOnTypeFormattingProvider,
                renameProvider,
                documentLinkProvider,
                executeCommandProvider,
                workspace,
                semanticHighlighting,
                typeHierarchyProvider,
                callHierarchyProvider,
                selectionRangeProvider,
                experimental, colorProvider, foldingRangeProvider,
                linkedEditingRangeProvider, monikerProvider, semanticTokensProvider)

};
MAKE_REFLECT_STRUCT(lsServerCapabilities,
        textDocumentSync,
        hoverProvider,
        completionProvider,
        signatureHelpProvider,
        definitionProvider,
        typeDefinitionProvider,
        implementationProvider,
        referencesProvider,
        documentHighlightProvider,
        documentSymbolProvider,
        workspaceSymbolProvider,
        codeActionProvider,
        codeLensProvider,
        documentFormattingProvider,
        documentRangeFormattingProvider,
        documentOnTypeFormattingProvider,
        renameProvider,
        documentLinkProvider,
        executeCommandProvider,
        workspace,
        semanticHighlighting,
        typeHierarchyProvider,
        callHierarchyProvider,
        selectionRangeProvider,
        experimental, colorProvider, foldingRangeProvider,
        linkedEditingRangeProvider, monikerProvider, semanticTokensProvider)