yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Yong HeLanguageServer: Enhance auto completion for override. (#7465)4d517794e

master
27.5 KiB1142 linesraw
1#pragma once
2
3#include "../../source/compiler-core/slang-json-value.h"
4#include "../../source/core/slang-rtti-info.h"
5#include "slang-com-helper.h"
6#include "slang-com-ptr.h"
7#include "slang.h"
8
9#include <optional>
10
11namespace Slang
12{
13namespace LanguageServerProtocol
14{
15struct ServerInfo
16{
17    String name;
18    String version;
19
20    static const StructRttiInfo g_rttiInfo;
21};
22
23enum class TextDocumentSyncKind
24{
25    None = 0,
26    Full = 1,
27    Incremental = 2
28};
29
30struct TextDocumentSyncOptions
31{
32    bool openClose = false;
33    int32_t change = int32_t(TextDocumentSyncKind::None); // TextDocumentSyncKind
34    static const StructRttiInfo g_rttiInfo;
35};
36
37struct WorkDoneProgressParams
38{
39    /**
40     * An optional token that a server can use to report work done progress.
41     */
42    String workDoneToken; // optional
43
44    static const StructRttiInfo g_rttiInfo;
45};
46
47struct CompletionOptions : public WorkDoneProgressParams
48{
49    /**
50     * Most tools trigger completion request automatically without explicitly
51     * requesting it using a keyboard shortcut (e.g. Ctrl+Space). Typically they
52     * do so when the user starts to type an identifier. For example if the user
53     * types `c` in a JavaScript file code complete will automatically pop up
54     * present `console` besides others as a completion item. Characters that
55     * make up identifiers don't need to be listed here.
56     *
57     * If code complete should automatically be trigger on characters not being
58     * valid inside an identifier (for example `.` in JavaScript) list them in
59     * `triggerCharacters`.
60     */
61    List<String> triggerCharacters;
62
63    /**
64     * The list of all possible characters that commit a completion. This field
65     * can be used if clients don't support individual commit characters per
66     * completion item. See client capability
67     * `completion.completionItem.commitCharactersSupport`.
68     *
69     * If a server provides both `allCommitCharacters` and commit characters on
70     * an individual completion item the ones on the completion item win.
71     *
72     * @since 3.2.0
73     */
74    List<String> allCommitCharacters;
75
76    /**
77     * The server provides support to resolve additional
78     * information for a completion item.
79     */
80    bool resolveProvider = false;
81
82    static const StructRttiInfo g_rttiInfo;
83};
84
85struct SemanticTokensLegend
86{
87    /**
88     * The token types a server uses.
89     */
90    List<String> tokenTypes;
91
92    /**
93     * The token modifiers a server uses.
94     */
95    List<String> tokenModifiers;
96
97    static const StructRttiInfo g_rttiInfo;
98};
99
100
101struct SemanticTokensOptions
102{
103    /**
104     * The legend used by the server
105     */
106    SemanticTokensLegend legend;
107
108    /**
109     * Server supports providing semantic tokens for a specific range
110     * of a document.
111     */
112    bool range = false;
113
114    /**
115     * Server supports providing semantic tokens for a full document.
116     */
117    bool full = false;
118
119    static const StructRttiInfo g_rttiInfo;
120};
121
122struct SignatureHelpOptions
123{
124    /**
125     * The characters that trigger signature help
126     * automatically.
127     */
128    List<String> triggerCharacters;
129
130    /**
131     * List of characters that re-trigger signature help.
132     *
133     * These trigger characters are only active when signature help is already
134     * showing. All trigger characters are also counted as re-trigger
135     * characters.
136     *
137     * @since 3.15.0
138     */
139    List<String> retriggerCharacters;
140
141    static const StructRttiInfo g_rttiInfo;
142};
143
144struct TextDocumentItem
145{
146    String uri;
147    String languageId;
148    int version = 0;
149    String text;
150    static const StructRttiInfo g_rttiInfo;
151};
152
153struct TextDocumentIdentifier
154{
155    String uri;
156    static const StructRttiInfo g_rttiInfo;
157};
158
159struct VersionedTextDocumentIdentifier
160{
161    String uri;
162    int version = 0;
163    static const StructRttiInfo g_rttiInfo;
164};
165
166struct Position
167{
168    int line = -1;
169    int character = -1;
170    static const StructRttiInfo g_rttiInfo;
171};
172
173struct Range
174{
175    Position start;
176    Position end;
177    static const StructRttiInfo g_rttiInfo;
178};
179
180struct TextEdit
181{
182    /**
183     * The range of the text document to be manipulated. To insert
184     * text into a document create a range where start === end.
185     */
186    Range range;
187
188    /**
189     * The string to be inserted. For delete operations use an
190     * empty string.
191     */
192    String newText;
193
194    static const StructRttiInfo g_rttiInfo;
195};
196
197struct DidOpenTextDocumentParams
198{
199    TextDocumentItem textDocument;
200    static const StructRttiInfo g_rttiInfo;
201    static const UnownedStringSlice methodName;
202};
203
204struct TextDocumentContentChangeEvent
205{
206    Range range; // optional
207    String text;
208    static const StructRttiInfo g_rttiInfo;
209};
210
211struct DidChangeTextDocumentParams
212{
213    VersionedTextDocumentIdentifier textDocument;
214    List<TextDocumentContentChangeEvent> contentChanges;
215    static const StructRttiInfo g_rttiInfo;
216    static const UnownedStringSlice methodName;
217};
218
219struct DidCloseTextDocumentParams
220{
221    TextDocumentIdentifier textDocument;
222    static const StructRttiInfo g_rttiInfo;
223    static const UnownedStringSlice methodName;
224};
225
226struct WorkspaceFoldersServerCapabilities
227{
228    /**
229     * The server has support for workspace folders
230     */
231    bool supported = false;
232
233    /**
234     * Whether the server wants to receive workspace folder
235     * change notifications.
236     *
237     * If a string is provided, the string is treated as an ID
238     * under which the notification is registered on the client
239     * side. The ID can be used to unregister for these events
240     * using the `client/unregisterCapability` request.
241     */
242    bool changeNotifications = false;
243
244    static const StructRttiInfo g_rttiInfo;
245};
246
247struct WorkspaceCapabilities
248{
249    WorkspaceFoldersServerCapabilities workspaceFolders;
250    static const StructRttiInfo g_rttiInfo;
251};
252
253/**
254 * Inlay hint options used during static registration.
255 *
256 * @since 3.17.0
257 */
258struct InlayHintOptions
259{
260    /**
261     * The server provides support to resolve additional
262     * information for an inlay hint item.
263     */
264    bool resolveProvider = false;
265    static const StructRttiInfo g_rttiInfo;
266};
267
268struct DocumentOnTypeFormattingOptions
269{
270    /**
271     * A character on which formatting should be triggered, like `{`.
272     */
273    String firstTriggerCharacter;
274
275    /**
276     * More trigger characters.
277     */
278    List<String> moreTriggerCharacter;
279
280    static const StructRttiInfo g_rttiInfo;
281};
282
283struct ServerCapabilities
284{
285    String positionEncoding;
286    TextDocumentSyncOptions textDocumentSync;
287    bool hoverProvider = false;
288    bool definitionProvider = false;
289    bool documentSymbolProvider = false;
290    bool documentFormattingProvider = false;
291    bool documentRangeFormattingProvider = false;
292    DocumentOnTypeFormattingOptions documentOnTypeFormattingProvider;
293    InlayHintOptions inlayHintProvider;
294    CompletionOptions completionProvider;
295    SemanticTokensOptions semanticTokensProvider;
296    SignatureHelpOptions signatureHelpProvider;
297    WorkspaceCapabilities workspace;
298    static const StructRttiInfo g_rttiInfo;
299};
300
301struct VSServerCapabilities : ServerCapabilities
302{
303    bool _vs_projectContextProvider = false;
304    static const StructRttiInfo g_rttiInfo;
305};
306
307struct WorkspaceFolder
308{
309    String uri;
310    String name;
311    static const StructRttiInfo g_rttiInfo;
312};
313
314struct InitializeParams
315{
316    List<WorkspaceFolder> workspaceFolders;
317    static const UnownedStringSlice methodName;
318    static const StructRttiInfo g_rttiInfo;
319};
320
321struct NullResponse
322{
323    static const StructRttiInfo g_rttiInfo;
324    static NullResponse* get();
325};
326
327struct InitializeResult
328{
329    ServerCapabilities capabilities;
330    ServerInfo serverInfo;
331
332    static const StructRttiInfo g_rttiInfo;
333};
334
335struct VSInitializeResult
336{
337    VSServerCapabilities capabilities;
338    ServerInfo serverInfo;
339
340    static const StructRttiInfo g_rttiInfo;
341};
342
343struct ShutdownParams
344{
345    static const UnownedStringSlice methodName;
346};
347
348struct ExitParams
349{
350    static const UnownedStringSlice methodName;
351};
352
353typedef uint32_t DiagnosticSeverity;
354/**
355 * Reports an error.
356 */
357const DiagnosticSeverity kDiagnosticsSeverityError = 1;
358/**
359 * Reports a warning.
360 */
361const DiagnosticSeverity kDiagnosticsSeverityWarning = 2;
362/**
363 * Reports an information.
364 */
365const DiagnosticSeverity kDiagnosticsSeverityInformation = 3;
366/**
367 * Reports a hint.
368 */
369const DiagnosticSeverity kDiagnosticsSeverityHint = 4;
370
371
372struct Location
373{
374    String uri;
375    Range range;
376    static const StructRttiInfo g_rttiInfo;
377};
378
379struct DiagnosticRelatedInformation
380{
381    /**
382     * The location of this related diagnostic information.
383     */
384    Location location;
385
386    /**
387     * The message of this related diagnostic information.
388     */
389    String message;
390
391    static const StructRttiInfo g_rttiInfo;
392};
393
394struct Diagnostic
395{
396    /**
397     * The range at which the message applies.
398     */
399    Range range;
400
401    /**
402     * The diagnostic's severity. Can be omitted. If omitted it is up to the
403     * client to interpret diagnostics as error, warning, info or hint.
404     */
405    DiagnosticSeverity severity = 1;
406
407    /**
408     * The diagnostic's code, which might appear in the user interface.
409     */
410    int32_t code = 0;
411
412    /**
413     * A human-readable string describing the source of this
414     * diagnostic, e.g. 'typescript' or 'super lint'.
415     */
416    String source;
417
418    /**
419     * The diagnostic's message.
420     */
421    String message;
422
423    /**
424     * An array of related diagnostic information, e.g. when symbol-names within
425     * a scope collide all definitions can be marked via this property.
426     */
427    List<DiagnosticRelatedInformation> relatedInformation;
428
429    bool operator==(const Diagnostic& other) const
430    {
431        return code == other.code && range.start.line == other.range.start.line &&
432               message == other.message;
433    }
434
435    HashCode getHashCode() const
436    {
437        return combineHash(code, combineHash(range.start.line, message.getHashCode()));
438    }
439
440    static const StructRttiInfo g_rttiInfo;
441};
442
443struct PublishDiagnosticsParams
444{
445    /**
446     * The URI for which diagnostic information is reported.
447     */
448    String uri;
449
450    /**
451     * An array of diagnostic information items.
452     */
453    List<Diagnostic> diagnostics;
454
455    static const StructRttiInfo g_rttiInfo;
456};
457
458struct TextDocumentPositionParams
459{
460    /**
461     * The text document.
462     */
463    TextDocumentIdentifier textDocument;
464
465    /**
466     * The position inside the text document.
467     */
468    Position position;
469
470    static const StructRttiInfo g_rttiInfo;
471};
472
473struct HoverParams : WorkDoneProgressParams, TextDocumentPositionParams
474{
475    static const StructRttiInfo g_rttiInfo;
476    static const UnownedStringSlice methodName;
477};
478
479struct DefinitionParams : WorkDoneProgressParams, TextDocumentPositionParams
480{
481    static const StructRttiInfo g_rttiInfo;
482    static const UnownedStringSlice methodName;
483};
484
485struct MarkupContent
486{
487    /**
488     * The type of the Markup
489     */
490    String kind;
491
492    /**
493     * The content itself
494     */
495    String value;
496
497    static const StructRttiInfo g_rttiInfo;
498};
499
500struct Hover
501{
502    /**
503     * The hover's content
504     */
505    MarkupContent contents;
506
507    /**
508     * An optional range is a range inside a text document
509     * that is used to visualize a hover, e.g. by changing the background color.
510     */
511    Range range;
512
513    static const StructRttiInfo g_rttiInfo;
514};
515
516typedef int CompletionTriggerKind;
517const CompletionTriggerKind kCompletionTriggerKindInvoked = 1;
518
519/**
520 * Completion was triggered by a trigger character specified by
521 * the `triggerCharacters` properties of the
522 * `CompletionRegistrationOptions`.
523 */
524const CompletionTriggerKind kCompletionTriggerKindTriggerCharacter = 2;
525
526/**
527 * Completion was re-triggered as the current completion list is incomplete.
528 */
529const CompletionTriggerKind kCompletionTriggerKindTriggerForIncompleteCompletions = 3;
530
531/**
532 * Contains additional information about the context in which a completion
533 * request is triggered.
534 */
535struct CompletionContext
536{
537    /**
538     * How the completion was triggered.
539     */
540    CompletionTriggerKind triggerKind = 1;
541
542    /**
543     * The trigger character (a single character) that has trigger code
544     * complete. Is undefined if
545     * `triggerKind !== CompletionTriggerKind.TriggerCharacter`
546     */
547    String triggerCharacter;
548
549    static const StructRttiInfo g_rttiInfo;
550};
551
552struct CompletionParams : WorkDoneProgressParams, TextDocumentPositionParams
553{
554    CompletionContext context;
555
556    static const StructRttiInfo g_rttiInfo;
557    static const UnownedStringSlice methodName;
558};
559
560typedef int32_t CompletionItemKind;
561const CompletionItemKind kCompletionItemKindText = 1;
562const CompletionItemKind kCompletionItemKindMethod = 2;
563const CompletionItemKind kCompletionItemKindFunction = 3;
564const CompletionItemKind kCompletionItemKindConstructor = 4;
565const CompletionItemKind kCompletionItemKindField = 5;
566const CompletionItemKind kCompletionItemKindVariable = 6;
567const CompletionItemKind kCompletionItemKindClass = 7;
568const CompletionItemKind kCompletionItemKindInterface = 8;
569const CompletionItemKind kCompletionItemKindModule = 9;
570const CompletionItemKind kCompletionItemKindProperty = 10;
571const CompletionItemKind kCompletionItemKindUnit = 11;
572const CompletionItemKind kCompletionItemKindValue = 12;
573const CompletionItemKind kCompletionItemKindEnum = 13;
574const CompletionItemKind kCompletionItemKindKeyword = 14;
575const CompletionItemKind kCompletionItemKindSnippet = 15;
576const CompletionItemKind kCompletionItemKindColor = 16;
577const CompletionItemKind kCompletionItemKindFile = 17;
578const CompletionItemKind kCompletionItemKindReference = 18;
579const CompletionItemKind kCompletionItemKindFolder = 19;
580const CompletionItemKind kCompletionItemKindEnumMember = 20;
581const CompletionItemKind kCompletionItemKindConstant = 21;
582const CompletionItemKind kCompletionItemKindStruct = 22;
583const CompletionItemKind kCompletionItemKindEvent = 23;
584const CompletionItemKind kCompletionItemKindOperator = 24;
585const CompletionItemKind kCompletionItemKindTypeParameter = 25;
586
587struct CompletionItem
588{
589    /**
590     * The label of this completion item.
591     *
592     * The label property is also by default the text that
593     * is inserted when selecting this completion.
594     *
595     * If label details are provided the label itself should
596     * be an unqualified name of the completion item.
597     */
598    String label;
599
600    /**
601     * The kind of this completion item. Based of the kind
602     * an icon is chosen by the editor. The standardized set
603     * of available values is defined in `CompletionItemKind`.
604     */
605    CompletionItemKind kind = CompletionItemKind(0);
606
607    /**
608     * A human-readable string with additional information
609     * about this item, like type or symbol information.
610     */
611    String detail;
612
613    /**
614     * A string that should be used when comparing this item
615     * with other items. When omitted the label is used
616     * as the sort text for this item.
617     */
618    JSONOptional<String> sortText;
619
620    /**
621     * A human-readable string that represents a doc-comment.
622     */
623    MarkupContent documentation;
624
625    /**
626     * An optional set of characters that when pressed while this completion is
627     * active will accept it first and then type that character. *Note* that all
628     * commit characters should have `length=1` and that superfluous characters
629     * will be ignored.
630     */
631    List<String> commitCharacters;
632
633    // Additional data.
634    String data;
635
636    static const StructRttiInfo g_rttiInfo;
637};
638
639struct TextEditCompletionItem
640{
641    /**
642     * The label of this completion item.
643     *
644     * The label property is also by default the text that
645     * is inserted when selecting this completion.
646     *
647     * If label details are provided the label itself should
648     * be an unqualified name of the completion item.
649     */
650    String label;
651
652    /**
653     * The kind of this completion item. Based of the kind
654     * an icon is chosen by the editor. The standardized set
655     * of available values is defined in `CompletionItemKind`.
656     */
657    CompletionItemKind kind = CompletionItemKind(0);
658
659    /**
660     * A human-readable string with additional information
661     * about this item, like type or symbol information.
662     */
663    String detail;
664
665    /**
666     * A human-readable string that represents a doc-comment.
667     */
668    MarkupContent documentation;
669
670    TextEdit textEdit;
671
672    /**
673     * An optional set of characters that when pressed while this completion is
674     * active will accept it first and then type that character. *Note* that all
675     * commit characters should have `length=1` and that superfluous characters
676     * will be ignored.
677     */
678    List<String> commitCharacters;
679
680    // Additional data.
681    String data;
682
683    static const StructRttiInfo g_rttiInfo;
684};
685
686struct SemanticTokensParams : WorkDoneProgressParams
687{
688    TextDocumentIdentifier textDocument;
689
690    static const UnownedStringSlice methodName;
691
692    static const StructRttiInfo g_rttiInfo;
693};
694
695
696struct SemanticTokens
697{
698    /**
699     * An optional result id. If provided and clients support delta updating
700     * the client will include the result id in the next semantic token request.
701     * A server can then instead of computing all semantic tokens again simply
702     * send a delta.
703     */
704    String resultId;
705
706    /**
707     * The actual tokens.
708     */
709    List<uint32_t> data;
710
711    static const StructRttiInfo g_rttiInfo;
712};
713
714struct SignatureHelpParams : WorkDoneProgressParams, TextDocumentPositionParams
715{
716    static const UnownedStringSlice methodName;
717
718    static const StructRttiInfo g_rttiInfo;
719};
720
721/**
722 * Represents a parameter of a callable-signature. A parameter can
723 * have a label and a doc-comment.
724 */
725struct ParameterInformation
726{
727    /**
728     * The label of this parameter information.
729     *
730     * Either a string or an inclusive start and exclusive end offsets within
731     * its containing signature label. (see SignatureInformation.label). The
732     * offsets are based on a UTF-16 string representation as `Position` and
733     * `Range` does.
734     *
735     * *Note*: a label of type string should be a substring of its containing
736     * signature label. Its intended use case is to highlight the parameter
737     * label part in the `SignatureInformation.label`.
738     */
739    uint32_t label[2] = {0, 0};
740
741    /**
742     * The human-readable doc-comment of this parameter. Will be shown
743     * in the UI but can be omitted.
744     */
745    MarkupContent documentation;
746
747    static const StructRttiInfo g_rttiInfo;
748};
749
750/**
751 * Represents the signature of something callable. A signature
752 * can have a label, like a function-name, a doc-comment, and
753 * a set of parameters.
754 */
755struct SignatureInformation
756{
757    /**
758     * The label of this signature. Will be shown in
759     * the UI.
760     */
761    String label;
762
763    /**
764     * The human-readable doc-comment of this signature. Will be shown
765     * in the UI but can be omitted.
766     */
767    MarkupContent documentation;
768
769    /**
770     * The parameters of this signature.
771     */
772    List<ParameterInformation> parameters;
773
774    static const StructRttiInfo g_rttiInfo;
775};
776
777struct SignatureHelp
778{
779    /**
780     * One or more signatures. If no signatures are available the signature help
781     * request should return `null`.
782     */
783    List<SignatureInformation> signatures;
784
785    /**
786     * The active signature. If omitted or the value lies outside the
787     * range of `signatures` the value defaults to zero or is ignore if
788     * the `SignatureHelp` as no signatures.
789     *
790     * Whenever possible implementors should make an active decision about
791     * the active signature and shouldn't rely on a default value.
792     *
793     * In future version of the protocol this property might become
794     * mandatory to better express this.
795     */
796    uint32_t activeSignature = 0;
797
798    /**
799     * The active parameter of the active signature. If omitted or the value
800     * lies outside the range of `signatures[activeSignature].parameters`
801     * defaults to 0 if the active signature has parameters. If
802     * the active signature has no parameters it is ignored.
803     * In future version of the protocol this property might become
804     * mandatory to better express the active parameter if the
805     * active signature does have any.
806     */
807    uint32_t activeParameter = 0;
808
809    static const StructRttiInfo g_rttiInfo;
810};
811
812
813struct DidChangeConfigurationParams
814{
815    /**
816     * The actual changed settings
817     */
818    JSONValue settings = JSONValue::makeInvalid();
819
820    static const StructRttiInfo g_rttiInfo;
821
822    static const UnownedStringSlice methodName;
823};
824
825struct ConfigurationItem
826{
827    /**
828     * The configuration section asked for.
829     */
830    String section;
831
832    static const StructRttiInfo g_rttiInfo;
833};
834
835struct ConfigurationParams
836{
837    List<ConfigurationItem> items;
838
839    static const StructRttiInfo g_rttiInfo;
840
841    static const UnownedStringSlice methodName;
842};
843
844struct Registration
845{
846    /**
847     * The id used to register the request. The id can be used to deregister
848     * the request again.
849     */
850    String id;
851
852    /**
853     * The method / capability to register for.
854     */
855    String method;
856
857    static const StructRttiInfo g_rttiInfo;
858};
859
860struct RegistrationParams
861{
862    List<Registration> registrations;
863
864    static const StructRttiInfo g_rttiInfo;
865};
866
867struct CancelParams
868{
869    /**
870     * The request id to cancel.
871     */
872    int64_t id = 0;
873
874    static const StructRttiInfo g_rttiInfo;
875};
876
877struct LogMessageParams
878{
879    /**
880     * The message type. See {@link MessageType}
881     */
882    int type = 0;
883
884    /**
885     * The actual message
886     */
887    String message;
888
889    static const StructRttiInfo g_rttiInfo;
890    static const UnownedStringSlice methodName;
891};
892
893struct DocumentSymbolParams : WorkDoneProgressParams
894{
895    /**
896     * The text document.
897     */
898    TextDocumentIdentifier textDocument;
899
900    static const StructRttiInfo g_rttiInfo;
901    static const UnownedStringSlice methodName;
902};
903
904typedef int SymbolKind;
905const int kSymbolKindFile = 1;
906const int kSymbolKindModule = 2;
907const int kSymbolKindNamespace = 3;
908const int kSymbolKindPackage = 4;
909const int kSymbolKindClass = 5;
910const int kSymbolKindMethod = 6;
911const int kSymbolKindProperty = 7;
912const int kSymbolKindField = 8;
913const int kSymbolKindConstructor = 9;
914const int kSymbolKindEnum = 10;
915const int kSymbolKindInterface = 11;
916const int kSymbolKindFunction = 12;
917const int kSymbolKindVariable = 13;
918const int kSymbolKindConstant = 14;
919const int kSymbolKindString = 15;
920const int kSymbolKindNumber = 16;
921const int kSymbolKindBoolean = 17;
922const int kSymbolKindArray = 18;
923const int kSymbolKindObject = 19;
924const int kSymbolKindKey = 20;
925const int kSymbolKindNull = 21;
926const int kSymbolKindEnumMember = 22;
927const int kSymbolKindStruct = 23;
928const int kSymbolKindEvent = 24;
929const int kSymbolKindOperator = 25;
930const int kSymbolKindTypeParameter = 26;
931
932/**
933 * Represents programming constructs like variables, classes, interfaces etc.
934 * that appear in a document. Document symbols can be hierarchical and they
935 * have two ranges: one that encloses its definition and one that points to its
936 * most interesting range, e.g. the range of an identifier.
937 */
938struct DocumentSymbol
939{
940    /**
941     * The name of this symbol. Will be displayed in the user interface and
942     * therefore must not be an empty string or a string only consisting of
943     * white spaces.
944     */
945    String name;
946
947    /**
948     * More detail for this symbol, e.g the signature of a function.
949     */
950    String detail;
951
952    /**
953     * The kind of this symbol.
954     */
955    SymbolKind kind = 0;
956
957    /**
958     * The range enclosing this symbol not including leading/trailing whitespace
959     * but everything else like comments. This information is typically used to
960     * determine if the clients cursor is inside the symbol to reveal in the
961     * symbol in the UI.
962     */
963    Range range;
964
965    /**
966     * The range that should be selected and revealed when this symbol is being
967     * picked, e.g. the name of a function. Must be contained by the `range`.
968     */
969    Range selectionRange;
970
971    /**
972     * Children of this symbol, e.g. properties of a class.
973     */
974    List<DocumentSymbol> children;
975
976    static const StructRttiInfo g_rttiInfo;
977};
978
979/**
980 * A parameter literal used in inlay hint requests.
981 *
982 * @since 3.17.0
983 */
984struct InlayHintParams
985{
986    /**
987     * The text document.
988     */
989    TextDocumentIdentifier textDocument;
990
991    /**
992     * The visible document range for which inlay hints should be computed.
993     */
994    Range range;
995
996    static const StructRttiInfo g_rttiInfo;
997    static const UnownedStringSlice methodName;
998};
999
1000typedef int InlayHintKind;
1001const int kInlayHintKindType = 1;
1002const int kInlayHintKindParameter = 2;
1003
1004/**
1005 * Inlay hint information.
1006 *
1007 * @since 3.17.0
1008 */
1009struct InlayHint
1010{
1011    /**
1012     * The position of this hint.
1013     */
1014    Position position;
1015
1016    /**
1017     * The label of this hint. A human readable string or an array of
1018     * InlayHintLabelPart label parts.
1019     *
1020     * *Note* that neither the string nor the label part can be empty.
1021     */
1022    String label;
1023
1024    /**
1025     * The kind of this hint. Can be omitted in which case the client
1026     * should fall back to a reasonable default.
1027     */
1028    InlayHintKind kind = 1;
1029
1030    List<TextEdit> textEdits;
1031
1032    /**
1033     * Render padding before the hint.
1034     *
1035     * Note: Padding should use the editor's background color, not the
1036     * background color of the hint itself. That means padding can be used
1037     * to visually align/separate an inlay hint.
1038     */
1039    bool paddingLeft = false;
1040
1041    /**
1042     * Render padding after the hint.
1043     *
1044     * Note: Padding should use the editor's background color, not the
1045     * background color of the hint itself. That means padding can be used
1046     * to visually align/separate an inlay hint.
1047     */
1048    bool paddingRight = false;
1049
1050    static const StructRttiInfo g_rttiInfo;
1051};
1052
1053struct DocumentOnTypeFormattingParams
1054{
1055    /**
1056     * The document to format.
1057     */
1058    TextDocumentIdentifier textDocument;
1059
1060    /**
1061     * The position around which the on type formatting should happen.
1062     * This is not necessarily the exact position where the character denoted
1063     * by the property `ch` got typed.
1064     */
1065    Position position;
1066
1067    /**
1068     * The character that has been typed that triggered the formatting
1069     * on type request. That is not necessarily the last character that
1070     * got inserted into the document since the client could auto insert
1071     * characters as well (e.g. like automatic brace completion).
1072     */
1073    String ch;
1074
1075    /**
1076     * The formatting options.
1077     */
1078    // FormattingOptions options;
1079
1080    static const StructRttiInfo g_rttiInfo;
1081    static const UnownedStringSlice methodName;
1082};
1083
1084struct DocumentRangeFormattingParams
1085{
1086    /**
1087     * The document to format.
1088     */
1089    TextDocumentIdentifier textDocument;
1090
1091    /**
1092     * The range to format
1093     */
1094    Range range;
1095
1096    /**
1097     * The format options
1098     */
1099    // FormattingOptions options;
1100
1101    static const StructRttiInfo g_rttiInfo;
1102    static const UnownedStringSlice methodName;
1103};
1104
1105struct DocumentFormattingParams
1106{
1107    /**
1108     * The document to format.
1109     */
1110    TextDocumentIdentifier textDocument;
1111
1112    /**
1113     * The format options
1114     */
1115    // FormattingOptions options;
1116
1117    static const StructRttiInfo g_rttiInfo;
1118    static const UnownedStringSlice methodName;
1119};
1120
1121} // namespace LanguageServerProtocol
1122} // namespace Slang
1123
1124namespace Slang
1125{
1126template<typename T>
1127struct LanguageServerResult
1128{
1129    SlangResult returnCode;
1130    bool isNull = true;
1131    T result;
1132    LanguageServerResult() { returnCode = SLANG_OK; }
1133    LanguageServerResult(std::nullopt_t) { returnCode = SLANG_OK; }
1134    LanguageServerResult(const T& value)
1135    {
1136        result = value;
1137        isNull = false;
1138        returnCode = SLANG_OK;
1139    }
1140    LanguageServerResult(SlangResult code) { returnCode = code; }
1141};
1142} // namespace Slang