Skip to main content

gen_lsp_types/generated/
structures.rs

1use serde::{Deserialize, ser::SerializeSeq as _, Serialize};
2use std::collections::HashMap;
3use crate::json_rpc::deserialize_some;
4#[allow(clippy::wildcard_imports)]
5use super::*;
6
7#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
8#[serde(rename_all = "camelCase")]
9pub struct ImplementationParams {
10    #[serde(flatten)]
11    pub work_done_progress_params: WorkDoneProgressParams,
12    #[serde(flatten)]
13    pub partial_result_params: PartialResultParams,
14    #[serde(flatten)]
15    pub text_document_position_params: TextDocumentPositionParams,
16}
17impl ImplementationParams {
18    #[must_use]
19    pub const fn new(
20        work_done_progress_params: WorkDoneProgressParams,
21        partial_result_params: PartialResultParams,
22        text_document_position_params: TextDocumentPositionParams,
23    ) -> Self {
24        Self {
25            work_done_progress_params,
26            partial_result_params,
27            text_document_position_params,
28        }
29    }
30}
31
32/// Represents a location inside a resource, such as a line
33/// inside a text file.
34#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
35#[serde(rename_all = "camelCase")]
36pub struct Location {
37    pub uri: Uri,
38    pub range: Range,
39}
40impl Location {
41    #[must_use]
42    pub const fn new(uri: Uri, range: Range) -> Self {
43        Self { uri, range }
44    }
45}
46
47#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
48#[serde(rename_all = "camelCase")]
49pub struct ImplementationRegistrationOptions {
50    #[serde(flatten)]
51    pub static_registration_options: StaticRegistrationOptions,
52    #[serde(flatten)]
53    pub text_document_registration_options: TextDocumentRegistrationOptions,
54    #[serde(flatten)]
55    pub implementation_options: ImplementationOptions,
56}
57impl ImplementationRegistrationOptions {
58    #[must_use]
59    pub const fn new(
60        static_registration_options: StaticRegistrationOptions,
61        text_document_registration_options: TextDocumentRegistrationOptions,
62        implementation_options: ImplementationOptions,
63    ) -> Self {
64        Self {
65            static_registration_options,
66            text_document_registration_options,
67            implementation_options,
68        }
69    }
70}
71
72#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
73#[serde(rename_all = "camelCase")]
74pub struct TypeDefinitionParams {
75    #[serde(flatten)]
76    pub work_done_progress_params: WorkDoneProgressParams,
77    #[serde(flatten)]
78    pub partial_result_params: PartialResultParams,
79    #[serde(flatten)]
80    pub text_document_position_params: TextDocumentPositionParams,
81}
82impl TypeDefinitionParams {
83    #[must_use]
84    pub const fn new(
85        work_done_progress_params: WorkDoneProgressParams,
86        partial_result_params: PartialResultParams,
87        text_document_position_params: TextDocumentPositionParams,
88    ) -> Self {
89        Self {
90            work_done_progress_params,
91            partial_result_params,
92            text_document_position_params,
93        }
94    }
95}
96
97#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
98#[serde(rename_all = "camelCase")]
99pub struct TypeDefinitionRegistrationOptions {
100    #[serde(flatten)]
101    pub static_registration_options: StaticRegistrationOptions,
102    #[serde(flatten)]
103    pub text_document_registration_options: TextDocumentRegistrationOptions,
104    #[serde(flatten)]
105    pub type_definition_options: TypeDefinitionOptions,
106}
107impl TypeDefinitionRegistrationOptions {
108    #[must_use]
109    pub const fn new(
110        static_registration_options: StaticRegistrationOptions,
111        text_document_registration_options: TextDocumentRegistrationOptions,
112        type_definition_options: TypeDefinitionOptions,
113    ) -> Self {
114        Self {
115            static_registration_options,
116            text_document_registration_options,
117            type_definition_options,
118        }
119    }
120}
121
122/// A workspace folder inside a client.
123#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
124#[serde(rename_all = "camelCase")]
125pub struct WorkspaceFolder {
126    /// The associated URI for this workspace folder.
127    pub uri: Uri,
128    /// The name of the workspace folder. Used to refer to this
129    /// workspace folder in the user interface.
130    pub name: String,
131}
132impl WorkspaceFolder {
133    #[must_use]
134    pub const fn new(uri: Uri, name: String) -> Self {
135        Self { uri, name }
136    }
137}
138
139/// The parameters of a `workspace/didChangeWorkspaceFolders` notification.
140#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
141#[serde(rename_all = "camelCase")]
142pub struct DidChangeWorkspaceFoldersParams {
143    /// The actual workspace folder change event.
144    pub event: WorkspaceFoldersChangeEvent,
145}
146impl DidChangeWorkspaceFoldersParams {
147    #[must_use]
148    pub const fn new(event: WorkspaceFoldersChangeEvent) -> Self {
149        Self { event }
150    }
151}
152
153/// The parameters of a configuration request.
154#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
155#[serde(rename_all = "camelCase")]
156pub struct ConfigurationParams {
157    pub items: Vec<ConfigurationItem>,
158}
159impl ConfigurationParams {
160    #[must_use]
161    pub const fn new(items: Vec<ConfigurationItem>) -> Self {
162        Self { items }
163    }
164}
165
166/// Parameters for a [`DocumentColorRequest`].
167#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
168#[serde(rename_all = "camelCase")]
169pub struct DocumentColorParams {
170    /// The text document.
171    pub text_document: TextDocumentIdentifier,
172    #[serde(flatten)]
173    pub work_done_progress_params: WorkDoneProgressParams,
174    #[serde(flatten)]
175    pub partial_result_params: PartialResultParams,
176}
177impl DocumentColorParams {
178    #[must_use]
179    pub const fn new(
180        text_document: TextDocumentIdentifier,
181        work_done_progress_params: WorkDoneProgressParams,
182        partial_result_params: PartialResultParams,
183    ) -> Self {
184        Self {
185            text_document,
186            work_done_progress_params,
187            partial_result_params,
188        }
189    }
190}
191
192/// Represents a color range from a document.
193#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Default, Copy)]
194#[serde(rename_all = "camelCase")]
195pub struct ColorInformation {
196    /// The range in the document where this color appears.
197    pub range: Range,
198    /// The actual color value for this color range.
199    pub color: Color,
200}
201impl ColorInformation {
202    #[must_use]
203    pub const fn new(range: Range, color: Color) -> Self {
204        Self { range, color }
205    }
206}
207
208#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
209#[serde(rename_all = "camelCase")]
210pub struct DocumentColorRegistrationOptions {
211    #[serde(flatten)]
212    pub static_registration_options: StaticRegistrationOptions,
213    #[serde(flatten)]
214    pub text_document_registration_options: TextDocumentRegistrationOptions,
215    #[serde(flatten)]
216    pub document_color_options: DocumentColorOptions,
217}
218impl DocumentColorRegistrationOptions {
219    #[must_use]
220    pub const fn new(
221        static_registration_options: StaticRegistrationOptions,
222        text_document_registration_options: TextDocumentRegistrationOptions,
223        document_color_options: DocumentColorOptions,
224    ) -> Self {
225        Self {
226            static_registration_options,
227            text_document_registration_options,
228            document_color_options,
229        }
230    }
231}
232
233/// Parameters for a [`ColorPresentationRequest`].
234#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
235#[serde(rename_all = "camelCase")]
236pub struct ColorPresentationParams {
237    /// The text document.
238    pub text_document: TextDocumentIdentifier,
239    /// The color to request presentations for.
240    pub color: Color,
241    /// The range where the color would be inserted. Serves as a context.
242    pub range: Range,
243    #[serde(flatten)]
244    pub work_done_progress_params: WorkDoneProgressParams,
245    #[serde(flatten)]
246    pub partial_result_params: PartialResultParams,
247}
248impl ColorPresentationParams {
249    #[must_use]
250    pub const fn new(
251        text_document: TextDocumentIdentifier,
252        color: Color,
253        range: Range,
254        work_done_progress_params: WorkDoneProgressParams,
255        partial_result_params: PartialResultParams,
256    ) -> Self {
257        Self {
258            text_document,
259            color,
260            range,
261            work_done_progress_params,
262            partial_result_params,
263        }
264    }
265}
266
267#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
268#[serde(rename_all = "camelCase")]
269pub struct ColorPresentation {
270    /// The label of this color presentation. It will be shown on the color
271    /// picker header. By default this is also the text that is inserted when selecting
272    /// this color presentation.
273    pub label: String,
274    /// An [edit][TextEdit] which is applied to a document when selecting
275    /// this presentation for the color.  When `falsy` the [label][`ColorPresentation::label`]
276    /// is used.
277    #[serde(skip_serializing_if = "Option::is_none")]
278    pub text_edit: Option<TextEdit>,
279    /// An optional array of additional [text edits][TextEdit] that are applied when
280    /// selecting this color presentation. Edits must not overlap with the main [edit][`ColorPresentation::textEdit`] nor with themselves.
281    #[serde(skip_serializing_if = "Option::is_none")]
282    pub additional_text_edits: Option<Vec<TextEdit>>,
283}
284impl ColorPresentation {
285    #[must_use]
286    pub const fn new(
287        label: String,
288        text_edit: Option<TextEdit>,
289        additional_text_edits: Option<Vec<TextEdit>>,
290    ) -> Self {
291        Self {
292            label,
293            text_edit,
294            additional_text_edits,
295        }
296    }
297}
298
299#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
300#[serde(rename_all = "camelCase")]
301pub struct WorkDoneProgressOptions {
302    #[serde(skip_serializing_if = "Option::is_none")]
303    pub work_done_progress: Option<bool>,
304}
305impl WorkDoneProgressOptions {
306    #[must_use]
307    pub const fn new(work_done_progress: Option<bool>) -> Self {
308        Self { work_done_progress }
309    }
310}
311
312/// General text document registration options.
313#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
314#[serde(rename_all = "camelCase")]
315pub struct TextDocumentRegistrationOptions {
316    /// A document selector to identify the scope of the registration. If set to null
317    /// the document selector provided on the client side will be used.
318    pub document_selector: Option<DocumentSelector>,
319}
320impl TextDocumentRegistrationOptions {
321    #[must_use]
322    pub const fn new(document_selector: Option<DocumentSelector>) -> Self {
323        Self { document_selector }
324    }
325}
326
327/// Parameters for a [`FoldingRangeRequest`].
328#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
329#[serde(rename_all = "camelCase")]
330pub struct FoldingRangeParams {
331    /// The text document.
332    pub text_document: TextDocumentIdentifier,
333    #[serde(flatten)]
334    pub work_done_progress_params: WorkDoneProgressParams,
335    #[serde(flatten)]
336    pub partial_result_params: PartialResultParams,
337}
338impl FoldingRangeParams {
339    #[must_use]
340    pub const fn new(
341        text_document: TextDocumentIdentifier,
342        work_done_progress_params: WorkDoneProgressParams,
343        partial_result_params: PartialResultParams,
344    ) -> Self {
345        Self {
346            text_document,
347            work_done_progress_params,
348            partial_result_params,
349        }
350    }
351}
352
353/// Represents a folding range. To be valid, start and end line must be bigger than zero and smaller
354/// than the number of lines in the document. Clients are free to ignore invalid ranges.
355#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
356#[serde(rename_all = "camelCase")]
357pub struct FoldingRange {
358    /// The zero-based start line of the range to fold. The folded area starts after the line's last character.
359    /// To be valid, the end must be zero or larger and smaller than the number of lines in the document.
360    pub start_line: u32,
361    /// The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.
362    #[serde(skip_serializing_if = "Option::is_none")]
363    pub start_character: Option<u32>,
364    /// The zero-based end line of the range to fold. The folded area ends with the line's last character.
365    /// To be valid, the end must be zero or larger and smaller than the number of lines in the document.
366    pub end_line: u32,
367    /// The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line.
368    #[serde(skip_serializing_if = "Option::is_none")]
369    pub end_character: Option<u32>,
370    /// Describes the kind of the folding range such as 'comment' or 'region'. The kind
371    /// is used to categorize folding ranges and used by commands like 'Fold all comments'.
372    /// See [`FoldingRangeKind`] for an enumeration of standardized kinds.
373    #[serde(skip_serializing_if = "Option::is_none")]
374    pub kind: Option<FoldingRangeKind>,
375    /// The text that the client should show when the specified range is
376    /// collapsed. If not defined or not supported by the client, a default
377    /// will be chosen by the client.
378    ///
379    /// @since 3.17.0
380    #[serde(skip_serializing_if = "Option::is_none")]
381    pub collapsed_text: Option<String>,
382}
383impl FoldingRange {
384    #[must_use]
385    pub const fn new(
386        start_line: u32,
387        start_character: Option<u32>,
388        end_line: u32,
389        end_character: Option<u32>,
390        kind: Option<FoldingRangeKind>,
391        collapsed_text: Option<String>,
392    ) -> Self {
393        Self {
394            start_line,
395            start_character,
396            end_line,
397            end_character,
398            kind,
399            collapsed_text,
400        }
401    }
402}
403
404#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
405#[serde(rename_all = "camelCase")]
406pub struct FoldingRangeRegistrationOptions {
407    #[serde(flatten)]
408    pub static_registration_options: StaticRegistrationOptions,
409    #[serde(flatten)]
410    pub text_document_registration_options: TextDocumentRegistrationOptions,
411    #[serde(flatten)]
412    pub folding_range_options: FoldingRangeOptions,
413}
414impl FoldingRangeRegistrationOptions {
415    #[must_use]
416    pub const fn new(
417        static_registration_options: StaticRegistrationOptions,
418        text_document_registration_options: TextDocumentRegistrationOptions,
419        folding_range_options: FoldingRangeOptions,
420    ) -> Self {
421        Self {
422            static_registration_options,
423            text_document_registration_options,
424            folding_range_options,
425        }
426    }
427}
428
429#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
430#[serde(rename_all = "camelCase")]
431pub struct DeclarationParams {
432    #[serde(flatten)]
433    pub work_done_progress_params: WorkDoneProgressParams,
434    #[serde(flatten)]
435    pub partial_result_params: PartialResultParams,
436    #[serde(flatten)]
437    pub text_document_position_params: TextDocumentPositionParams,
438}
439impl DeclarationParams {
440    #[must_use]
441    pub const fn new(
442        work_done_progress_params: WorkDoneProgressParams,
443        partial_result_params: PartialResultParams,
444        text_document_position_params: TextDocumentPositionParams,
445    ) -> Self {
446        Self {
447            work_done_progress_params,
448            partial_result_params,
449            text_document_position_params,
450        }
451    }
452}
453
454#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
455#[serde(rename_all = "camelCase")]
456pub struct DeclarationRegistrationOptions {
457    #[serde(flatten)]
458    pub static_registration_options: StaticRegistrationOptions,
459    #[serde(flatten)]
460    pub declaration_options: DeclarationOptions,
461    #[serde(flatten)]
462    pub text_document_registration_options: TextDocumentRegistrationOptions,
463}
464impl DeclarationRegistrationOptions {
465    #[must_use]
466    pub const fn new(
467        static_registration_options: StaticRegistrationOptions,
468        declaration_options: DeclarationOptions,
469        text_document_registration_options: TextDocumentRegistrationOptions,
470    ) -> Self {
471        Self {
472            static_registration_options,
473            declaration_options,
474            text_document_registration_options,
475        }
476    }
477}
478
479/// A parameter literal used in selection range requests.
480#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
481#[serde(rename_all = "camelCase")]
482pub struct SelectionRangeParams {
483    /// The text document.
484    pub text_document: TextDocumentIdentifier,
485    /// The positions inside the text document.
486    pub positions: Vec<Position>,
487    #[serde(flatten)]
488    pub work_done_progress_params: WorkDoneProgressParams,
489    #[serde(flatten)]
490    pub partial_result_params: PartialResultParams,
491}
492impl SelectionRangeParams {
493    #[must_use]
494    pub const fn new(
495        text_document: TextDocumentIdentifier,
496        positions: Vec<Position>,
497        work_done_progress_params: WorkDoneProgressParams,
498        partial_result_params: PartialResultParams,
499    ) -> Self {
500        Self {
501            text_document,
502            positions,
503            work_done_progress_params,
504            partial_result_params,
505        }
506    }
507}
508
509/// A selection range represents a part of a selection hierarchy. A selection range
510/// may have a parent selection range that contains it.
511#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
512#[serde(rename_all = "camelCase")]
513pub struct SelectionRange {
514    /// The [range][Range] of this selection range.
515    pub range: Range,
516    /// The parent selection range containing this range. Therefore `parent.range` must contain `this.range`.
517    #[serde(skip_serializing_if = "Option::is_none")]
518    pub parent: Option<Box<SelectionRange>>,
519}
520impl SelectionRange {
521    #[must_use]
522    pub const fn new(range: Range, parent: Option<Box<SelectionRange>>) -> Self {
523        Self { range, parent }
524    }
525}
526
527#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
528#[serde(rename_all = "camelCase")]
529pub struct SelectionRangeRegistrationOptions {
530    #[serde(flatten)]
531    pub static_registration_options: StaticRegistrationOptions,
532    #[serde(flatten)]
533    pub selection_range_options: SelectionRangeOptions,
534    #[serde(flatten)]
535    pub text_document_registration_options: TextDocumentRegistrationOptions,
536}
537impl SelectionRangeRegistrationOptions {
538    #[must_use]
539    pub const fn new(
540        static_registration_options: StaticRegistrationOptions,
541        selection_range_options: SelectionRangeOptions,
542        text_document_registration_options: TextDocumentRegistrationOptions,
543    ) -> Self {
544        Self {
545            static_registration_options,
546            selection_range_options,
547            text_document_registration_options,
548        }
549    }
550}
551
552#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
553#[serde(rename_all = "camelCase")]
554pub struct WorkDoneProgressCreateParams {
555    /// The token to be used to report progress.
556    pub token: ProgressToken,
557}
558impl WorkDoneProgressCreateParams {
559    #[must_use]
560    pub const fn new(token: ProgressToken) -> Self {
561        Self { token }
562    }
563}
564
565#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
566#[serde(rename_all = "camelCase")]
567pub struct WorkDoneProgressCancelParams {
568    /// The token to be used to report progress.
569    pub token: ProgressToken,
570}
571impl WorkDoneProgressCancelParams {
572    #[must_use]
573    pub const fn new(token: ProgressToken) -> Self {
574        Self { token }
575    }
576}
577
578/// The parameter of a `textDocument/prepareCallHierarchy` request.
579///
580/// @since 3.16.0
581#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
582#[serde(rename_all = "camelCase")]
583pub struct CallHierarchyPrepareParams {
584    #[serde(flatten)]
585    pub work_done_progress_params: WorkDoneProgressParams,
586    #[serde(flatten)]
587    pub text_document_position_params: TextDocumentPositionParams,
588}
589impl CallHierarchyPrepareParams {
590    #[must_use]
591    pub const fn new(
592        work_done_progress_params: WorkDoneProgressParams,
593        text_document_position_params: TextDocumentPositionParams,
594    ) -> Self {
595        Self {
596            work_done_progress_params,
597            text_document_position_params,
598        }
599    }
600}
601
602/// Represents programming constructs like functions or constructors in the context
603/// of call hierarchy.
604///
605/// @since 3.16.0
606#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
607#[serde(rename_all = "camelCase")]
608pub struct CallHierarchyItem {
609    /// The name of this item.
610    pub name: String,
611    /// The kind of this item.
612    pub kind: SymbolKind,
613    /// Tags for this item.
614    #[serde(skip_serializing_if = "Option::is_none")]
615    pub tags: Option<Vec<SymbolTag>>,
616    /// More detail for this item, e.g. the signature of a function.
617    #[serde(skip_serializing_if = "Option::is_none")]
618    pub detail: Option<String>,
619    /// The resource identifier of this item.
620    pub uri: Uri,
621    /// The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.
622    pub range: Range,
623    /// The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function.
624    /// Must be contained by the [`range`][`CallHierarchyItem::range`].
625    pub selection_range: Range,
626    /// A data entry field that is preserved between a call hierarchy prepare and
627    /// incoming calls or outgoing calls requests.
628    #[serde(skip_serializing_if = "Option::is_none")]
629    pub data: Option<LspAny>,
630}
631impl CallHierarchyItem {
632    #[must_use]
633    pub const fn new(
634        name: String,
635        kind: SymbolKind,
636        tags: Option<Vec<SymbolTag>>,
637        detail: Option<String>,
638        uri: Uri,
639        range: Range,
640        selection_range: Range,
641        data: Option<LspAny>,
642    ) -> Self {
643        Self {
644            name,
645            kind,
646            tags,
647            detail,
648            uri,
649            range,
650            selection_range,
651            data,
652        }
653    }
654}
655
656/// Call hierarchy options used during static or dynamic registration.
657///
658/// @since 3.16.0
659#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
660#[serde(rename_all = "camelCase")]
661pub struct CallHierarchyRegistrationOptions {
662    #[serde(flatten)]
663    pub static_registration_options: StaticRegistrationOptions,
664    #[serde(flatten)]
665    pub text_document_registration_options: TextDocumentRegistrationOptions,
666    #[serde(flatten)]
667    pub call_hierarchy_options: CallHierarchyOptions,
668}
669impl CallHierarchyRegistrationOptions {
670    #[must_use]
671    pub const fn new(
672        static_registration_options: StaticRegistrationOptions,
673        text_document_registration_options: TextDocumentRegistrationOptions,
674        call_hierarchy_options: CallHierarchyOptions,
675    ) -> Self {
676        Self {
677            static_registration_options,
678            text_document_registration_options,
679            call_hierarchy_options,
680        }
681    }
682}
683
684/// The parameter of a `callHierarchy/incomingCalls` request.
685///
686/// @since 3.16.0
687#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
688#[serde(rename_all = "camelCase")]
689pub struct CallHierarchyIncomingCallsParams {
690    pub item: CallHierarchyItem,
691    #[serde(flatten)]
692    pub work_done_progress_params: WorkDoneProgressParams,
693    #[serde(flatten)]
694    pub partial_result_params: PartialResultParams,
695}
696impl CallHierarchyIncomingCallsParams {
697    #[must_use]
698    pub const fn new(
699        item: CallHierarchyItem,
700        work_done_progress_params: WorkDoneProgressParams,
701        partial_result_params: PartialResultParams,
702    ) -> Self {
703        Self {
704            item,
705            work_done_progress_params,
706            partial_result_params,
707        }
708    }
709}
710
711/// Represents an incoming call, e.g. a caller of a method or constructor.
712///
713/// @since 3.16.0
714#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
715#[serde(rename_all = "camelCase")]
716pub struct CallHierarchyIncomingCall {
717    /// The item that makes the call.
718    pub from: CallHierarchyItem,
719    /// The ranges at which the calls appear. This is relative to the caller
720    /// denoted by [`this.from`][`CallHierarchyIncomingCall::from`].
721    pub from_ranges: Vec<Range>,
722}
723impl CallHierarchyIncomingCall {
724    #[must_use]
725    pub const fn new(from: CallHierarchyItem, from_ranges: Vec<Range>) -> Self {
726        Self { from, from_ranges }
727    }
728}
729
730/// The parameter of a `callHierarchy/outgoingCalls` request.
731///
732/// @since 3.16.0
733#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
734#[serde(rename_all = "camelCase")]
735pub struct CallHierarchyOutgoingCallsParams {
736    pub item: CallHierarchyItem,
737    #[serde(flatten)]
738    pub work_done_progress_params: WorkDoneProgressParams,
739    #[serde(flatten)]
740    pub partial_result_params: PartialResultParams,
741}
742impl CallHierarchyOutgoingCallsParams {
743    #[must_use]
744    pub const fn new(
745        item: CallHierarchyItem,
746        work_done_progress_params: WorkDoneProgressParams,
747        partial_result_params: PartialResultParams,
748    ) -> Self {
749        Self {
750            item,
751            work_done_progress_params,
752            partial_result_params,
753        }
754    }
755}
756
757/// Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc.
758///
759/// @since 3.16.0
760#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
761#[serde(rename_all = "camelCase")]
762pub struct CallHierarchyOutgoingCall {
763    /// The item that is called.
764    pub to: CallHierarchyItem,
765    /// The range at which this item is called. This is the range relative to the caller, e.g the item
766    /// passed to [`provideCallHierarchyOutgoingCalls`][`CallHierarchyItemProvider::provideCallHierarchyOutgoingCalls`]
767    /// and not [`this.to`][`CallHierarchyOutgoingCall::to`].
768    pub from_ranges: Vec<Range>,
769}
770impl CallHierarchyOutgoingCall {
771    #[must_use]
772    pub const fn new(to: CallHierarchyItem, from_ranges: Vec<Range>) -> Self {
773        Self { to, from_ranges }
774    }
775}
776
777/// @since 3.16.0
778#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
779#[serde(rename_all = "camelCase")]
780pub struct SemanticTokensParams {
781    /// The text document.
782    pub text_document: TextDocumentIdentifier,
783    #[serde(flatten)]
784    pub work_done_progress_params: WorkDoneProgressParams,
785    #[serde(flatten)]
786    pub partial_result_params: PartialResultParams,
787}
788impl SemanticTokensParams {
789    #[must_use]
790    pub const fn new(
791        text_document: TextDocumentIdentifier,
792        work_done_progress_params: WorkDoneProgressParams,
793        partial_result_params: PartialResultParams,
794    ) -> Self {
795        Self {
796            text_document,
797            work_done_progress_params,
798            partial_result_params,
799        }
800    }
801}
802
803/// @since 3.16.0
804#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
805#[serde(rename_all = "camelCase")]
806pub struct SemanticTokens {
807    /// An optional result id. If provided and clients support delta updating
808    /// the client will include the result id in the next semantic token request.
809    /// A server can then instead of computing all semantic tokens again simply
810    /// send a delta.
811    #[serde(skip_serializing_if = "Option::is_none")]
812    pub result_id: Option<String>,
813    /// The actual tokens.
814    #[serde(
815        deserialize_with = "SemanticToken::deserialize_tokens",
816        serialize_with = "SemanticToken::serialize_tokens"
817    )]
818    pub data: Vec<SemanticToken>,
819}
820impl SemanticTokens {
821    #[must_use]
822    pub const fn new(result_id: Option<String>, data: Vec<SemanticToken>) -> Self {
823        Self { result_id, data }
824    }
825}
826
827/// @since 3.16.0
828#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
829#[serde(rename_all = "camelCase")]
830pub struct SemanticTokensPartialResult {
831    #[serde(
832        deserialize_with = "SemanticToken::deserialize_tokens",
833        serialize_with = "SemanticToken::serialize_tokens"
834    )]
835    pub data: Vec<SemanticToken>,
836}
837impl SemanticTokensPartialResult {
838    #[must_use]
839    pub const fn new(data: Vec<SemanticToken>) -> Self {
840        Self { data }
841    }
842}
843
844/// @since 3.16.0
845#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
846#[serde(rename_all = "camelCase")]
847pub struct SemanticTokensRegistrationOptions {
848    #[serde(flatten)]
849    pub static_registration_options: StaticRegistrationOptions,
850    #[serde(flatten)]
851    pub text_document_registration_options: TextDocumentRegistrationOptions,
852    #[serde(flatten)]
853    pub semantic_tokens_options: SemanticTokensOptions,
854}
855impl SemanticTokensRegistrationOptions {
856    #[must_use]
857    pub const fn new(
858        static_registration_options: StaticRegistrationOptions,
859        text_document_registration_options: TextDocumentRegistrationOptions,
860        semantic_tokens_options: SemanticTokensOptions,
861    ) -> Self {
862        Self {
863            static_registration_options,
864            text_document_registration_options,
865            semantic_tokens_options,
866        }
867    }
868}
869
870/// @since 3.16.0
871#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
872#[serde(rename_all = "camelCase")]
873pub struct SemanticTokensDeltaParams {
874    /// The text document.
875    pub text_document: TextDocumentIdentifier,
876    /// The result id of a previous response. The result Id can either point to a full response
877    /// or a delta response depending on what was received last.
878    pub previous_result_id: String,
879    #[serde(flatten)]
880    pub work_done_progress_params: WorkDoneProgressParams,
881    #[serde(flatten)]
882    pub partial_result_params: PartialResultParams,
883}
884impl SemanticTokensDeltaParams {
885    #[must_use]
886    pub const fn new(
887        text_document: TextDocumentIdentifier,
888        previous_result_id: String,
889        work_done_progress_params: WorkDoneProgressParams,
890        partial_result_params: PartialResultParams,
891    ) -> Self {
892        Self {
893            text_document,
894            previous_result_id,
895            work_done_progress_params,
896            partial_result_params,
897        }
898    }
899}
900
901/// @since 3.16.0
902#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
903#[serde(rename_all = "camelCase")]
904pub struct SemanticTokensDelta {
905    #[serde(skip_serializing_if = "Option::is_none")]
906    pub result_id: Option<String>,
907    /// The semantic token edits to transform a previous result into a new result.
908    pub edits: Vec<SemanticTokensEdit>,
909}
910impl SemanticTokensDelta {
911    #[must_use]
912    pub const fn new(result_id: Option<String>, edits: Vec<SemanticTokensEdit>) -> Self {
913        Self { result_id, edits }
914    }
915}
916
917/// @since 3.16.0
918#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
919#[serde(rename_all = "camelCase")]
920pub struct SemanticTokensDeltaPartialResult {
921    pub edits: Vec<SemanticTokensEdit>,
922}
923impl SemanticTokensDeltaPartialResult {
924    #[must_use]
925    pub const fn new(edits: Vec<SemanticTokensEdit>) -> Self {
926        Self { edits }
927    }
928}
929
930/// @since 3.16.0
931#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
932#[serde(rename_all = "camelCase")]
933pub struct SemanticTokensRangeParams {
934    /// The text document.
935    pub text_document: TextDocumentIdentifier,
936    /// The range the semantic tokens are requested for.
937    pub range: Range,
938    #[serde(flatten)]
939    pub work_done_progress_params: WorkDoneProgressParams,
940    #[serde(flatten)]
941    pub partial_result_params: PartialResultParams,
942}
943impl SemanticTokensRangeParams {
944    #[must_use]
945    pub const fn new(
946        text_document: TextDocumentIdentifier,
947        range: Range,
948        work_done_progress_params: WorkDoneProgressParams,
949        partial_result_params: PartialResultParams,
950    ) -> Self {
951        Self {
952            text_document,
953            range,
954            work_done_progress_params,
955            partial_result_params,
956        }
957    }
958}
959
960/// Params to show a resource in the UI.
961///
962/// @since 3.16.0
963#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
964#[serde(rename_all = "camelCase")]
965pub struct ShowDocumentParams {
966    /// The uri to show.
967    pub uri: Uri,
968    /// Indicates to show the resource in an external program.
969    /// To show, for example, `https://code.visualstudio.com/`
970    /// in the default WEB browser set `external` to `true`.
971    #[serde(skip_serializing_if = "Option::is_none")]
972    pub external: Option<bool>,
973    /// An optional property to indicate whether the editor
974    /// showing the document should take focus or not.
975    /// Clients might ignore this property if an external
976    /// program is started.
977    #[serde(skip_serializing_if = "Option::is_none")]
978    pub take_focus: Option<bool>,
979    /// An optional selection range if the document is a text
980    /// document. Clients might ignore the property if an
981    /// external program is started or the file is not a text
982    /// file.
983    #[serde(skip_serializing_if = "Option::is_none")]
984    pub selection: Option<Range>,
985}
986impl ShowDocumentParams {
987    #[must_use]
988    pub const fn new(
989        uri: Uri,
990        external: Option<bool>,
991        take_focus: Option<bool>,
992        selection: Option<Range>,
993    ) -> Self {
994        Self {
995            uri,
996            external,
997            take_focus,
998            selection,
999        }
1000    }
1001}
1002
1003/// The result of a showDocument request.
1004///
1005/// @since 3.16.0
1006#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
1007#[serde(rename_all = "camelCase")]
1008pub struct ShowDocumentResult {
1009    /// A boolean indicating if the show was successful.
1010    pub success: bool,
1011}
1012impl ShowDocumentResult {
1013    #[must_use]
1014    pub const fn new(success: bool) -> Self {
1015        Self { success }
1016    }
1017}
1018
1019#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
1020#[serde(rename_all = "camelCase")]
1021pub struct LinkedEditingRangeParams {
1022    #[serde(flatten)]
1023    pub work_done_progress_params: WorkDoneProgressParams,
1024    #[serde(flatten)]
1025    pub text_document_position_params: TextDocumentPositionParams,
1026}
1027impl LinkedEditingRangeParams {
1028    #[must_use]
1029    pub const fn new(
1030        work_done_progress_params: WorkDoneProgressParams,
1031        text_document_position_params: TextDocumentPositionParams,
1032    ) -> Self {
1033        Self {
1034            work_done_progress_params,
1035            text_document_position_params,
1036        }
1037    }
1038}
1039
1040/// The result of a linked editing range request.
1041///
1042/// @since 3.16.0
1043#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
1044#[serde(rename_all = "camelCase")]
1045pub struct LinkedEditingRanges {
1046    /// A list of ranges that can be edited together. The ranges must have
1047    /// identical length and contain identical text content. The ranges cannot overlap.
1048    pub ranges: Vec<Range>,
1049    /// An optional word pattern (regular expression) that describes valid contents for
1050    /// the given ranges. If no pattern is provided, the client configuration's word
1051    /// pattern will be used.
1052    #[serde(skip_serializing_if = "Option::is_none")]
1053    pub word_pattern: Option<String>,
1054}
1055impl LinkedEditingRanges {
1056    #[must_use]
1057    pub const fn new(ranges: Vec<Range>, word_pattern: Option<String>) -> Self {
1058        Self { ranges, word_pattern }
1059    }
1060}
1061
1062#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
1063#[serde(rename_all = "camelCase")]
1064pub struct LinkedEditingRangeRegistrationOptions {
1065    #[serde(flatten)]
1066    pub static_registration_options: StaticRegistrationOptions,
1067    #[serde(flatten)]
1068    pub text_document_registration_options: TextDocumentRegistrationOptions,
1069    #[serde(flatten)]
1070    pub linked_editing_range_options: LinkedEditingRangeOptions,
1071}
1072impl LinkedEditingRangeRegistrationOptions {
1073    #[must_use]
1074    pub const fn new(
1075        static_registration_options: StaticRegistrationOptions,
1076        text_document_registration_options: TextDocumentRegistrationOptions,
1077        linked_editing_range_options: LinkedEditingRangeOptions,
1078    ) -> Self {
1079        Self {
1080            static_registration_options,
1081            text_document_registration_options,
1082            linked_editing_range_options,
1083        }
1084    }
1085}
1086
1087/// The parameters sent in notifications/requests for user-initiated creation of
1088/// files.
1089///
1090/// @since 3.16.0
1091#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
1092#[serde(rename_all = "camelCase")]
1093pub struct CreateFilesParams {
1094    /// An array of all files/folders created in this operation.
1095    pub files: Vec<FileCreate>,
1096}
1097impl CreateFilesParams {
1098    #[must_use]
1099    pub const fn new(files: Vec<FileCreate>) -> Self {
1100        Self { files }
1101    }
1102}
1103
1104/// A workspace edit represents changes to many resources managed in the workspace. The edit
1105/// should either provide `changes` or `documentChanges`. If documentChanges are present
1106/// they are preferred over `changes` if the client can handle versioned document edits.
1107///
1108/// Since version 3.13.0 a workspace edit can contain resource operations as well. If resource
1109/// operations are present clients need to execute the operations in the order in which they
1110/// are provided. So a workspace edit for example can consist of the following two changes:
1111/// (1) a create file a.txt and (2) a text document edit which insert text into file a.txt.
1112///
1113/// An invalid sequence (e.g. (1) delete file a.txt and (2) insert text into file a.txt) will
1114/// cause failure of the operation. How the client recovers from the failure is described by
1115/// the client capability: `workspace.workspaceEdit.failureHandling`
1116#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
1117#[serde(rename_all = "camelCase")]
1118pub struct WorkspaceEdit {
1119    /// Holds changes to existing resources.
1120    #[serde(skip_serializing_if = "Option::is_none")]
1121    pub changes: Option<HashMap<Uri, Vec<TextEdit>>>,
1122    /// Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes
1123    /// are either an array of `TextDocumentEdit`s to express changes to n different text documents
1124    /// where each text document edit addresses a specific version of a text document. Or it can contain
1125    /// above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations.
1126    ///
1127    /// Whether a client supports versioned document edits is expressed via
1128    /// `workspace.workspaceEdit.documentChanges` client capability.
1129    ///
1130    /// If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then
1131    /// only plain `TextEdit`s using the `changes` property are supported.
1132    #[serde(skip_serializing_if = "Option::is_none")]
1133    pub document_changes: Option<Vec<DocumentChange>>,
1134    /// A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and
1135    /// delete file / folder operations.
1136    ///
1137    /// Whether clients honor this property depends on the client capability `workspace.changeAnnotationSupport`.
1138    ///
1139    /// @since 3.16.0
1140    #[serde(skip_serializing_if = "Option::is_none")]
1141    pub change_annotations: Option<
1142        HashMap<ChangeAnnotationIdentifier, ChangeAnnotation>,
1143    >,
1144}
1145impl WorkspaceEdit {
1146    #[must_use]
1147    pub const fn new(
1148        changes: Option<HashMap<Uri, Vec<TextEdit>>>,
1149        document_changes: Option<Vec<DocumentChange>>,
1150        change_annotations: Option<HashMap<ChangeAnnotationIdentifier, ChangeAnnotation>>,
1151    ) -> Self {
1152        Self {
1153            changes,
1154            document_changes,
1155            change_annotations,
1156        }
1157    }
1158}
1159
1160/// The options to register for file operations.
1161///
1162/// @since 3.16.0
1163#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
1164#[serde(rename_all = "camelCase")]
1165pub struct FileOperationRegistrationOptions {
1166    /// The actual filters.
1167    pub filters: Vec<FileOperationFilter>,
1168}
1169impl FileOperationRegistrationOptions {
1170    #[must_use]
1171    pub const fn new(filters: Vec<FileOperationFilter>) -> Self {
1172        Self { filters }
1173    }
1174}
1175
1176/// The parameters sent in notifications/requests for user-initiated renames of
1177/// files.
1178///
1179/// @since 3.16.0
1180#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
1181#[serde(rename_all = "camelCase")]
1182pub struct RenameFilesParams {
1183    /// An array of all files/folders renamed in this operation. When a folder is renamed, only
1184    /// the folder will be included, and not its children.
1185    pub files: Vec<FileRename>,
1186}
1187impl RenameFilesParams {
1188    #[must_use]
1189    pub const fn new(files: Vec<FileRename>) -> Self {
1190        Self { files }
1191    }
1192}
1193
1194/// The parameters sent in notifications/requests for user-initiated deletes of
1195/// files.
1196///
1197/// @since 3.16.0
1198#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
1199#[serde(rename_all = "camelCase")]
1200pub struct DeleteFilesParams {
1201    /// An array of all files/folders deleted in this operation.
1202    pub files: Vec<FileDelete>,
1203}
1204impl DeleteFilesParams {
1205    #[must_use]
1206    pub const fn new(files: Vec<FileDelete>) -> Self {
1207        Self { files }
1208    }
1209}
1210
1211#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
1212#[serde(rename_all = "camelCase")]
1213pub struct MonikerParams {
1214    #[serde(flatten)]
1215    pub work_done_progress_params: WorkDoneProgressParams,
1216    #[serde(flatten)]
1217    pub partial_result_params: PartialResultParams,
1218    #[serde(flatten)]
1219    pub text_document_position_params: TextDocumentPositionParams,
1220}
1221impl MonikerParams {
1222    #[must_use]
1223    pub const fn new(
1224        work_done_progress_params: WorkDoneProgressParams,
1225        partial_result_params: PartialResultParams,
1226        text_document_position_params: TextDocumentPositionParams,
1227    ) -> Self {
1228        Self {
1229            work_done_progress_params,
1230            partial_result_params,
1231            text_document_position_params,
1232        }
1233    }
1234}
1235
1236/// Moniker definition to match LSIF 0.5 moniker definition.
1237///
1238/// @since 3.16.0
1239#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
1240#[serde(rename_all = "camelCase")]
1241pub struct Moniker {
1242    /// The scheme of the moniker. For example tsc or .Net
1243    pub scheme: String,
1244    /// The identifier of the moniker. The value is opaque in LSIF however
1245    /// schema owners are allowed to define the structure if they want.
1246    pub identifier: String,
1247    /// The scope in which the moniker is unique
1248    pub unique: UniquenessLevel,
1249    /// The moniker kind if known.
1250    #[serde(skip_serializing_if = "Option::is_none")]
1251    pub kind: Option<MonikerKind>,
1252}
1253impl Moniker {
1254    #[must_use]
1255    pub const fn new(
1256        scheme: String,
1257        identifier: String,
1258        unique: UniquenessLevel,
1259        kind: Option<MonikerKind>,
1260    ) -> Self {
1261        Self {
1262            scheme,
1263            identifier,
1264            unique,
1265            kind,
1266        }
1267    }
1268}
1269
1270#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
1271#[serde(rename_all = "camelCase")]
1272pub struct MonikerRegistrationOptions {
1273    #[serde(flatten)]
1274    pub text_document_registration_options: TextDocumentRegistrationOptions,
1275    #[serde(flatten)]
1276    pub moniker_options: MonikerOptions,
1277}
1278impl MonikerRegistrationOptions {
1279    #[must_use]
1280    pub const fn new(
1281        text_document_registration_options: TextDocumentRegistrationOptions,
1282        moniker_options: MonikerOptions,
1283    ) -> Self {
1284        Self {
1285            text_document_registration_options,
1286            moniker_options,
1287        }
1288    }
1289}
1290
1291/// The parameter of a `textDocument/prepareTypeHierarchy` request.
1292///
1293/// @since 3.17.0
1294#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
1295#[serde(rename_all = "camelCase")]
1296pub struct TypeHierarchyPrepareParams {
1297    #[serde(flatten)]
1298    pub work_done_progress_params: WorkDoneProgressParams,
1299    #[serde(flatten)]
1300    pub text_document_position_params: TextDocumentPositionParams,
1301}
1302impl TypeHierarchyPrepareParams {
1303    #[must_use]
1304    pub const fn new(
1305        work_done_progress_params: WorkDoneProgressParams,
1306        text_document_position_params: TextDocumentPositionParams,
1307    ) -> Self {
1308        Self {
1309            work_done_progress_params,
1310            text_document_position_params,
1311        }
1312    }
1313}
1314
1315/// @since 3.17.0
1316#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
1317#[serde(rename_all = "camelCase")]
1318pub struct TypeHierarchyItem {
1319    /// The name of this item.
1320    pub name: String,
1321    /// The kind of this item.
1322    pub kind: SymbolKind,
1323    /// Tags for this item.
1324    #[serde(skip_serializing_if = "Option::is_none")]
1325    pub tags: Option<Vec<SymbolTag>>,
1326    /// More detail for this item, e.g. the signature of a function.
1327    #[serde(skip_serializing_if = "Option::is_none")]
1328    pub detail: Option<String>,
1329    /// The resource identifier of this item.
1330    pub uri: Uri,
1331    /// The range enclosing this symbol not including leading/trailing whitespace
1332    /// but everything else, e.g. comments and code.
1333    pub range: Range,
1334    /// The range that should be selected and revealed when this symbol is being
1335    /// picked, e.g. the name of a function. Must be contained by the
1336    /// [`range`][`TypeHierarchyItem::range`].
1337    pub selection_range: Range,
1338    /// A data entry field that is preserved between a type hierarchy prepare and
1339    /// supertypes or subtypes requests. It could also be used to identify the
1340    /// type hierarchy in the server, helping improve the performance on
1341    /// resolving supertypes and subtypes.
1342    #[serde(skip_serializing_if = "Option::is_none")]
1343    pub data: Option<LspAny>,
1344}
1345impl TypeHierarchyItem {
1346    #[must_use]
1347    pub const fn new(
1348        name: String,
1349        kind: SymbolKind,
1350        tags: Option<Vec<SymbolTag>>,
1351        detail: Option<String>,
1352        uri: Uri,
1353        range: Range,
1354        selection_range: Range,
1355        data: Option<LspAny>,
1356    ) -> Self {
1357        Self {
1358            name,
1359            kind,
1360            tags,
1361            detail,
1362            uri,
1363            range,
1364            selection_range,
1365            data,
1366        }
1367    }
1368}
1369
1370/// Type hierarchy options used during static or dynamic registration.
1371///
1372/// @since 3.17.0
1373#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
1374#[serde(rename_all = "camelCase")]
1375pub struct TypeHierarchyRegistrationOptions {
1376    #[serde(flatten)]
1377    pub static_registration_options: StaticRegistrationOptions,
1378    #[serde(flatten)]
1379    pub text_document_registration_options: TextDocumentRegistrationOptions,
1380    #[serde(flatten)]
1381    pub type_hierarchy_options: TypeHierarchyOptions,
1382}
1383impl TypeHierarchyRegistrationOptions {
1384    #[must_use]
1385    pub const fn new(
1386        static_registration_options: StaticRegistrationOptions,
1387        text_document_registration_options: TextDocumentRegistrationOptions,
1388        type_hierarchy_options: TypeHierarchyOptions,
1389    ) -> Self {
1390        Self {
1391            static_registration_options,
1392            text_document_registration_options,
1393            type_hierarchy_options,
1394        }
1395    }
1396}
1397
1398/// The parameter of a `typeHierarchy/supertypes` request.
1399///
1400/// @since 3.17.0
1401#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
1402#[serde(rename_all = "camelCase")]
1403pub struct TypeHierarchySupertypesParams {
1404    pub item: TypeHierarchyItem,
1405    #[serde(flatten)]
1406    pub work_done_progress_params: WorkDoneProgressParams,
1407    #[serde(flatten)]
1408    pub partial_result_params: PartialResultParams,
1409}
1410impl TypeHierarchySupertypesParams {
1411    #[must_use]
1412    pub const fn new(
1413        item: TypeHierarchyItem,
1414        work_done_progress_params: WorkDoneProgressParams,
1415        partial_result_params: PartialResultParams,
1416    ) -> Self {
1417        Self {
1418            item,
1419            work_done_progress_params,
1420            partial_result_params,
1421        }
1422    }
1423}
1424
1425/// The parameter of a `typeHierarchy/subtypes` request.
1426///
1427/// @since 3.17.0
1428#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
1429#[serde(rename_all = "camelCase")]
1430pub struct TypeHierarchySubtypesParams {
1431    pub item: TypeHierarchyItem,
1432    #[serde(flatten)]
1433    pub work_done_progress_params: WorkDoneProgressParams,
1434    #[serde(flatten)]
1435    pub partial_result_params: PartialResultParams,
1436}
1437impl TypeHierarchySubtypesParams {
1438    #[must_use]
1439    pub const fn new(
1440        item: TypeHierarchyItem,
1441        work_done_progress_params: WorkDoneProgressParams,
1442        partial_result_params: PartialResultParams,
1443    ) -> Self {
1444        Self {
1445            item,
1446            work_done_progress_params,
1447            partial_result_params,
1448        }
1449    }
1450}
1451
1452/// A parameter literal used in inline value requests.
1453///
1454/// @since 3.17.0
1455#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
1456#[serde(rename_all = "camelCase")]
1457pub struct InlineValueParams {
1458    /// The text document.
1459    pub text_document: TextDocumentIdentifier,
1460    /// The document range for which inline values should be computed.
1461    pub range: Range,
1462    /// Additional information about the context in which inline values were
1463    /// requested.
1464    pub context: InlineValueContext,
1465    #[serde(flatten)]
1466    pub work_done_progress_params: WorkDoneProgressParams,
1467}
1468impl InlineValueParams {
1469    #[must_use]
1470    pub const fn new(
1471        text_document: TextDocumentIdentifier,
1472        range: Range,
1473        context: InlineValueContext,
1474        work_done_progress_params: WorkDoneProgressParams,
1475    ) -> Self {
1476        Self {
1477            text_document,
1478            range,
1479            context,
1480            work_done_progress_params,
1481        }
1482    }
1483}
1484
1485/// Inline value options used during static or dynamic registration.
1486///
1487/// @since 3.17.0
1488#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
1489#[serde(rename_all = "camelCase")]
1490pub struct InlineValueRegistrationOptions {
1491    #[serde(flatten)]
1492    pub static_registration_options: StaticRegistrationOptions,
1493    #[serde(flatten)]
1494    pub inline_value_options: InlineValueOptions,
1495    #[serde(flatten)]
1496    pub text_document_registration_options: TextDocumentRegistrationOptions,
1497}
1498impl InlineValueRegistrationOptions {
1499    #[must_use]
1500    pub const fn new(
1501        static_registration_options: StaticRegistrationOptions,
1502        inline_value_options: InlineValueOptions,
1503        text_document_registration_options: TextDocumentRegistrationOptions,
1504    ) -> Self {
1505        Self {
1506            static_registration_options,
1507            inline_value_options,
1508            text_document_registration_options,
1509        }
1510    }
1511}
1512
1513/// A parameter literal used in inlay hint requests.
1514///
1515/// @since 3.17.0
1516#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
1517#[serde(rename_all = "camelCase")]
1518pub struct InlayHintParams {
1519    /// The text document.
1520    pub text_document: TextDocumentIdentifier,
1521    /// The document range for which inlay hints should be computed.
1522    pub range: Range,
1523    #[serde(flatten)]
1524    pub work_done_progress_params: WorkDoneProgressParams,
1525}
1526impl InlayHintParams {
1527    #[must_use]
1528    pub const fn new(
1529        text_document: TextDocumentIdentifier,
1530        range: Range,
1531        work_done_progress_params: WorkDoneProgressParams,
1532    ) -> Self {
1533        Self {
1534            text_document,
1535            range,
1536            work_done_progress_params,
1537        }
1538    }
1539}
1540
1541/// Inlay hint information.
1542///
1543/// @since 3.17.0
1544#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
1545#[serde(rename_all = "camelCase")]
1546pub struct InlayHint {
1547    /// The position of this hint.
1548    ///
1549    /// If multiple hints have the same position, they will be shown in the order
1550    /// they appear in the response.
1551    pub position: Position,
1552    /// The label of this hint. A human readable string or an array of
1553    /// InlayHintLabelPart label parts.
1554    ///
1555    /// *Note* that neither the string nor the label part can be empty.
1556    pub label: Label,
1557    /// The kind of this hint. Can be omitted in which case the client
1558    /// should fall back to a reasonable default.
1559    #[serde(skip_serializing_if = "Option::is_none")]
1560    pub kind: Option<InlayHintKind>,
1561    /// Optional text edits that are performed when accepting this inlay hint.
1562    ///
1563    /// *Note* that edits are expected to change the document so that the inlay
1564    /// hint (or its nearest variant) is now part of the document and the inlay
1565    /// hint itself is now obsolete.
1566    #[serde(skip_serializing_if = "Option::is_none")]
1567    pub text_edits: Option<Vec<TextEdit>>,
1568    /// The tooltip text when you hover over this item.
1569    #[serde(skip_serializing_if = "Option::is_none")]
1570    pub tooltip: Option<Tooltip>,
1571    /// Render padding before the hint.
1572    ///
1573    /// Note: Padding should use the editor's background color, not the
1574    /// background color of the hint itself. That means padding can be used
1575    /// to visually align/separate an inlay hint.
1576    #[serde(skip_serializing_if = "Option::is_none")]
1577    pub padding_left: Option<bool>,
1578    /// Render padding after the hint.
1579    ///
1580    /// Note: Padding should use the editor's background color, not the
1581    /// background color of the hint itself. That means padding can be used
1582    /// to visually align/separate an inlay hint.
1583    #[serde(skip_serializing_if = "Option::is_none")]
1584    pub padding_right: Option<bool>,
1585    /// A data entry field that is preserved on an inlay hint between
1586    /// a `textDocument/inlayHint` and a `inlayHint/resolve` request.
1587    #[serde(skip_serializing_if = "Option::is_none")]
1588    pub data: Option<LspAny>,
1589}
1590impl InlayHint {
1591    #[must_use]
1592    pub const fn new(
1593        position: Position,
1594        label: Label,
1595        kind: Option<InlayHintKind>,
1596        text_edits: Option<Vec<TextEdit>>,
1597        tooltip: Option<Tooltip>,
1598        padding_left: Option<bool>,
1599        padding_right: Option<bool>,
1600        data: Option<LspAny>,
1601    ) -> Self {
1602        Self {
1603            position,
1604            label,
1605            kind,
1606            text_edits,
1607            tooltip,
1608            padding_left,
1609            padding_right,
1610            data,
1611        }
1612    }
1613}
1614
1615/// Inlay hint options used during static or dynamic registration.
1616///
1617/// @since 3.17.0
1618#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
1619#[serde(rename_all = "camelCase")]
1620pub struct InlayHintRegistrationOptions {
1621    #[serde(flatten)]
1622    pub static_registration_options: StaticRegistrationOptions,
1623    #[serde(flatten)]
1624    pub inlay_hint_options: InlayHintOptions,
1625    #[serde(flatten)]
1626    pub text_document_registration_options: TextDocumentRegistrationOptions,
1627}
1628impl InlayHintRegistrationOptions {
1629    #[must_use]
1630    pub const fn new(
1631        static_registration_options: StaticRegistrationOptions,
1632        inlay_hint_options: InlayHintOptions,
1633        text_document_registration_options: TextDocumentRegistrationOptions,
1634    ) -> Self {
1635        Self {
1636            static_registration_options,
1637            inlay_hint_options,
1638            text_document_registration_options,
1639        }
1640    }
1641}
1642
1643/// Parameters of the document diagnostic request.
1644///
1645/// @since 3.17.0
1646#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
1647#[serde(rename_all = "camelCase")]
1648pub struct DocumentDiagnosticParams {
1649    /// The text document.
1650    pub text_document: TextDocumentIdentifier,
1651    /// The additional identifier  provided during registration.
1652    #[serde(skip_serializing_if = "Option::is_none")]
1653    pub identifier: Option<String>,
1654    /// The result id of a previous response if provided.
1655    #[serde(skip_serializing_if = "Option::is_none")]
1656    pub previous_result_id: Option<String>,
1657    #[serde(flatten)]
1658    pub work_done_progress_params: WorkDoneProgressParams,
1659    #[serde(flatten)]
1660    pub partial_result_params: PartialResultParams,
1661}
1662impl DocumentDiagnosticParams {
1663    #[must_use]
1664    pub const fn new(
1665        text_document: TextDocumentIdentifier,
1666        identifier: Option<String>,
1667        previous_result_id: Option<String>,
1668        work_done_progress_params: WorkDoneProgressParams,
1669        partial_result_params: PartialResultParams,
1670    ) -> Self {
1671        Self {
1672            text_document,
1673            identifier,
1674            previous_result_id,
1675            work_done_progress_params,
1676            partial_result_params,
1677        }
1678    }
1679}
1680
1681/// A partial result for a document diagnostic report.
1682///
1683/// @since 3.17.0
1684#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
1685#[serde(rename_all = "camelCase")]
1686pub struct DocumentDiagnosticReportPartialResult {
1687    pub related_documents: HashMap<Uri, RelatedDocument>,
1688}
1689impl DocumentDiagnosticReportPartialResult {
1690    #[must_use]
1691    pub const fn new(related_documents: HashMap<Uri, RelatedDocument>) -> Self {
1692        Self { related_documents }
1693    }
1694}
1695
1696/// Cancellation data returned from a diagnostic request.
1697///
1698/// @since 3.17.0
1699#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
1700#[serde(rename_all = "camelCase")]
1701pub struct DiagnosticServerCancellationData {
1702    pub retrigger_request: bool,
1703}
1704impl DiagnosticServerCancellationData {
1705    #[must_use]
1706    pub const fn new(retrigger_request: bool) -> Self {
1707        Self { retrigger_request }
1708    }
1709}
1710
1711/// Diagnostic registration options.
1712///
1713/// @since 3.17.0
1714#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
1715#[serde(rename_all = "camelCase")]
1716pub struct DiagnosticRegistrationOptions {
1717    #[serde(flatten)]
1718    pub static_registration_options: StaticRegistrationOptions,
1719    #[serde(flatten)]
1720    pub text_document_registration_options: TextDocumentRegistrationOptions,
1721    #[serde(flatten)]
1722    pub diagnostic_options: DiagnosticOptions,
1723}
1724impl DiagnosticRegistrationOptions {
1725    #[must_use]
1726    pub const fn new(
1727        static_registration_options: StaticRegistrationOptions,
1728        text_document_registration_options: TextDocumentRegistrationOptions,
1729        diagnostic_options: DiagnosticOptions,
1730    ) -> Self {
1731        Self {
1732            static_registration_options,
1733            text_document_registration_options,
1734            diagnostic_options,
1735        }
1736    }
1737}
1738
1739/// Parameters of the workspace diagnostic request.
1740///
1741/// @since 3.17.0
1742#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
1743#[serde(rename_all = "camelCase")]
1744pub struct WorkspaceDiagnosticParams {
1745    /// The additional identifier provided during registration.
1746    #[serde(skip_serializing_if = "Option::is_none")]
1747    pub identifier: Option<String>,
1748    /// The currently known diagnostic reports with their
1749    /// previous result ids.
1750    pub previous_result_ids: Vec<PreviousResultId>,
1751    #[serde(flatten)]
1752    pub work_done_progress_params: WorkDoneProgressParams,
1753    #[serde(flatten)]
1754    pub partial_result_params: PartialResultParams,
1755}
1756impl WorkspaceDiagnosticParams {
1757    #[must_use]
1758    pub const fn new(
1759        identifier: Option<String>,
1760        previous_result_ids: Vec<PreviousResultId>,
1761        work_done_progress_params: WorkDoneProgressParams,
1762        partial_result_params: PartialResultParams,
1763    ) -> Self {
1764        Self {
1765            identifier,
1766            previous_result_ids,
1767            work_done_progress_params,
1768            partial_result_params,
1769        }
1770    }
1771}
1772
1773/// A workspace diagnostic report.
1774///
1775/// @since 3.17.0
1776#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
1777#[serde(rename_all = "camelCase")]
1778pub struct WorkspaceDiagnosticReport {
1779    pub items: Vec<WorkspaceDocumentDiagnosticReport>,
1780}
1781impl WorkspaceDiagnosticReport {
1782    #[must_use]
1783    pub const fn new(items: Vec<WorkspaceDocumentDiagnosticReport>) -> Self {
1784        Self { items }
1785    }
1786}
1787
1788/// A partial result for a workspace diagnostic report.
1789///
1790/// @since 3.17.0
1791#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
1792#[serde(rename_all = "camelCase")]
1793pub struct WorkspaceDiagnosticReportPartialResult {
1794    pub items: Vec<WorkspaceDocumentDiagnosticReport>,
1795}
1796impl WorkspaceDiagnosticReportPartialResult {
1797    #[must_use]
1798    pub const fn new(items: Vec<WorkspaceDocumentDiagnosticReport>) -> Self {
1799        Self { items }
1800    }
1801}
1802
1803/// The params sent in an open notebook document notification.
1804///
1805/// @since 3.17.0
1806#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
1807#[serde(rename_all = "camelCase")]
1808pub struct DidOpenNotebookDocumentParams {
1809    /// The notebook document that got opened.
1810    pub notebook_document: NotebookDocument,
1811    /// The text documents that represent the content
1812    /// of a notebook cell.
1813    pub cell_text_documents: Vec<TextDocumentItem>,
1814}
1815impl DidOpenNotebookDocumentParams {
1816    #[must_use]
1817    pub const fn new(
1818        notebook_document: NotebookDocument,
1819        cell_text_documents: Vec<TextDocumentItem>,
1820    ) -> Self {
1821        Self {
1822            notebook_document,
1823            cell_text_documents,
1824        }
1825    }
1826}
1827
1828/// Registration options specific to a notebook.
1829///
1830/// @since 3.17.0
1831#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
1832#[serde(rename_all = "camelCase")]
1833pub struct NotebookDocumentSyncRegistrationOptions {
1834    #[serde(flatten)]
1835    pub static_registration_options: StaticRegistrationOptions,
1836    #[serde(flatten)]
1837    pub notebook_document_sync_options: NotebookDocumentSyncOptions,
1838}
1839impl NotebookDocumentSyncRegistrationOptions {
1840    #[must_use]
1841    pub const fn new(
1842        static_registration_options: StaticRegistrationOptions,
1843        notebook_document_sync_options: NotebookDocumentSyncOptions,
1844    ) -> Self {
1845        Self {
1846            static_registration_options,
1847            notebook_document_sync_options,
1848        }
1849    }
1850}
1851
1852/// The params sent in a change notebook document notification.
1853///
1854/// @since 3.17.0
1855#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
1856#[serde(rename_all = "camelCase")]
1857pub struct DidChangeNotebookDocumentParams {
1858    /// The notebook document that did change. The version number points
1859    /// to the version after all provided changes have been applied. If
1860    /// only the text document content of a cell changes the notebook version
1861    /// doesn't necessarily have to change.
1862    pub notebook_document: VersionedNotebookDocumentIdentifier,
1863    /// The actual changes to the notebook document.
1864    ///
1865    /// The changes describe single state changes to the notebook document.
1866    /// So if there are two changes c1 (at array index 0) and c2 (at array
1867    /// index 1) for a notebook in state S then c1 moves the notebook from
1868    /// S to S' and c2 from S' to S''. So c1 is computed on the state S and
1869    /// c2 is computed on the state S'.
1870    ///
1871    /// To mirror the content of a notebook using change events use the following approach:
1872    /// - start with the same initial content
1873    /// - apply the 'notebookDocument/didChange' notifications in the order you receive them.
1874    /// - apply the `NotebookChangeEvent`s in a single notification in the order
1875    ///   you receive them.
1876    pub change: NotebookDocumentChangeEvent,
1877}
1878impl DidChangeNotebookDocumentParams {
1879    #[must_use]
1880    pub const fn new(
1881        notebook_document: VersionedNotebookDocumentIdentifier,
1882        change: NotebookDocumentChangeEvent,
1883    ) -> Self {
1884        Self { notebook_document, change }
1885    }
1886}
1887
1888/// The params sent in a save notebook document notification.
1889///
1890/// @since 3.17.0
1891#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
1892#[serde(rename_all = "camelCase")]
1893pub struct DidSaveNotebookDocumentParams {
1894    /// The notebook document that got saved.
1895    pub notebook_document: NotebookDocumentIdentifier,
1896}
1897impl DidSaveNotebookDocumentParams {
1898    #[must_use]
1899    pub const fn new(notebook_document: NotebookDocumentIdentifier) -> Self {
1900        Self { notebook_document }
1901    }
1902}
1903
1904/// The params sent in a close notebook document notification.
1905///
1906/// @since 3.17.0
1907#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
1908#[serde(rename_all = "camelCase")]
1909pub struct DidCloseNotebookDocumentParams {
1910    /// The notebook document that got closed.
1911    pub notebook_document: NotebookDocumentIdentifier,
1912    /// The text documents that represent the content
1913    /// of a notebook cell that got closed.
1914    pub cell_text_documents: Vec<TextDocumentIdentifier>,
1915}
1916impl DidCloseNotebookDocumentParams {
1917    #[must_use]
1918    pub const fn new(
1919        notebook_document: NotebookDocumentIdentifier,
1920        cell_text_documents: Vec<TextDocumentIdentifier>,
1921    ) -> Self {
1922        Self {
1923            notebook_document,
1924            cell_text_documents,
1925        }
1926    }
1927}
1928
1929/// A parameter literal used in inline completion requests.
1930///
1931/// @since 3.18.0
1932/// @proposed
1933#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
1934#[serde(rename_all = "camelCase")]
1935pub struct InlineCompletionParams {
1936    /// Additional information about the context in which inline completions were
1937    /// requested.
1938    pub context: InlineCompletionContext,
1939    #[serde(flatten)]
1940    pub work_done_progress_params: WorkDoneProgressParams,
1941    #[serde(flatten)]
1942    pub text_document_position_params: TextDocumentPositionParams,
1943}
1944impl InlineCompletionParams {
1945    #[must_use]
1946    pub const fn new(
1947        context: InlineCompletionContext,
1948        work_done_progress_params: WorkDoneProgressParams,
1949        text_document_position_params: TextDocumentPositionParams,
1950    ) -> Self {
1951        Self {
1952            context,
1953            work_done_progress_params,
1954            text_document_position_params,
1955        }
1956    }
1957}
1958
1959/// Represents a collection of [inline completion items][InlineCompletionItem] to be presented in the editor.
1960///
1961/// @since 3.18.0
1962/// @proposed
1963#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
1964#[serde(rename_all = "camelCase")]
1965pub struct InlineCompletionList {
1966    /// The inline completion items
1967    pub items: Vec<InlineCompletionItem>,
1968}
1969impl InlineCompletionList {
1970    #[must_use]
1971    pub const fn new(items: Vec<InlineCompletionItem>) -> Self {
1972        Self { items }
1973    }
1974}
1975
1976/// An inline completion item represents a text snippet that is proposed inline to complete text that is being typed.
1977///
1978/// @since 3.18.0
1979/// @proposed
1980#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
1981#[serde(rename_all = "camelCase")]
1982pub struct InlineCompletionItem {
1983    /// The text to replace the range with. Must be set.
1984    pub insert_text: InsertText,
1985    /// A text that is used to decide if this inline completion should be shown. When `falsy` the [`InlineCompletionItem::insertText`] is used.
1986    #[serde(skip_serializing_if = "Option::is_none")]
1987    pub filter_text: Option<String>,
1988    /// The range to replace. Must begin and end on the same line.
1989    #[serde(skip_serializing_if = "Option::is_none")]
1990    pub range: Option<Range>,
1991    /// An optional [`Command`] that is executed *after* inserting this completion.
1992    #[serde(skip_serializing_if = "Option::is_none")]
1993    pub command: Option<Command>,
1994}
1995impl InlineCompletionItem {
1996    #[must_use]
1997    pub const fn new(
1998        insert_text: InsertText,
1999        filter_text: Option<String>,
2000        range: Option<Range>,
2001        command: Option<Command>,
2002    ) -> Self {
2003        Self {
2004            insert_text,
2005            filter_text,
2006            range,
2007            command,
2008        }
2009    }
2010}
2011
2012/// Inline completion options used during static or dynamic registration.
2013///
2014/// @since 3.18.0
2015/// @proposed
2016#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
2017#[serde(rename_all = "camelCase")]
2018pub struct InlineCompletionRegistrationOptions {
2019    #[serde(flatten)]
2020    pub static_registration_options: StaticRegistrationOptions,
2021    #[serde(flatten)]
2022    pub inline_completion_options: InlineCompletionOptions,
2023    #[serde(flatten)]
2024    pub text_document_registration_options: TextDocumentRegistrationOptions,
2025}
2026impl InlineCompletionRegistrationOptions {
2027    #[must_use]
2028    pub const fn new(
2029        static_registration_options: StaticRegistrationOptions,
2030        inline_completion_options: InlineCompletionOptions,
2031        text_document_registration_options: TextDocumentRegistrationOptions,
2032    ) -> Self {
2033        Self {
2034            static_registration_options,
2035            inline_completion_options,
2036            text_document_registration_options,
2037        }
2038    }
2039}
2040
2041/// Parameters for the `workspace/textDocumentContent` request.
2042///
2043/// @since 3.18.0
2044/// @proposed
2045#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
2046#[serde(rename_all = "camelCase")]
2047pub struct TextDocumentContentParams {
2048    /// The uri of the text document.
2049    pub uri: Uri,
2050}
2051impl TextDocumentContentParams {
2052    #[must_use]
2053    pub const fn new(uri: Uri) -> Self {
2054        Self { uri }
2055    }
2056}
2057
2058/// Result of the `workspace/textDocumentContent` request.
2059///
2060/// @since 3.18.0
2061/// @proposed
2062#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
2063#[serde(rename_all = "camelCase")]
2064pub struct TextDocumentContentResult {
2065    /// The text content of the text document. Please note, that the content of
2066    /// any subsequent open notifications for the text document might differ
2067    /// from the returned content due to whitespace and line ending
2068    /// normalizations done on the client
2069    pub text: String,
2070}
2071impl TextDocumentContentResult {
2072    #[must_use]
2073    pub const fn new(text: String) -> Self {
2074        Self { text }
2075    }
2076}
2077
2078/// Text document content provider registration options.
2079///
2080/// @since 3.18.0
2081/// @proposed
2082#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
2083#[serde(rename_all = "camelCase")]
2084pub struct TextDocumentContentRegistrationOptions {
2085    #[serde(flatten)]
2086    pub static_registration_options: StaticRegistrationOptions,
2087    #[serde(flatten)]
2088    pub text_document_content_options: TextDocumentContentOptions,
2089}
2090impl TextDocumentContentRegistrationOptions {
2091    #[must_use]
2092    pub const fn new(
2093        static_registration_options: StaticRegistrationOptions,
2094        text_document_content_options: TextDocumentContentOptions,
2095    ) -> Self {
2096        Self {
2097            static_registration_options,
2098            text_document_content_options,
2099        }
2100    }
2101}
2102
2103/// Parameters for the `workspace/textDocumentContent/refresh` request.
2104///
2105/// @since 3.18.0
2106/// @proposed
2107#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
2108#[serde(rename_all = "camelCase")]
2109pub struct TextDocumentContentRefreshParams {
2110    /// The uri of the text document to refresh.
2111    pub uri: Uri,
2112}
2113impl TextDocumentContentRefreshParams {
2114    #[must_use]
2115    pub const fn new(uri: Uri) -> Self {
2116        Self { uri }
2117    }
2118}
2119
2120#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
2121#[serde(rename_all = "camelCase")]
2122pub struct RegistrationParams {
2123    pub registrations: Vec<Registration>,
2124}
2125impl RegistrationParams {
2126    #[must_use]
2127    pub const fn new(registrations: Vec<Registration>) -> Self {
2128        Self { registrations }
2129    }
2130}
2131
2132#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
2133#[serde(rename_all = "camelCase")]
2134pub struct UnregistrationParams {
2135    pub unregisterations: Vec<Unregistration>,
2136}
2137impl UnregistrationParams {
2138    #[must_use]
2139    pub const fn new(unregisterations: Vec<Unregistration>) -> Self {
2140        Self { unregisterations }
2141    }
2142}
2143
2144#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
2145#[serde(rename_all = "camelCase")]
2146pub struct InitializeParams {
2147    /// The process Id of the parent process that started
2148    /// the server.
2149    ///
2150    /// Is `null` if the process has not been started by another process.
2151    /// If the parent process is not alive then the server should exit.
2152    pub process_id: Option<i32>,
2153    /// Information about the client
2154    ///
2155    /// @since 3.15.0
2156    #[serde(skip_serializing_if = "Option::is_none")]
2157    pub client_info: Option<ClientInfo>,
2158    /// The locale the client is currently showing the user interface
2159    /// in. This must not necessarily be the locale of the operating
2160    /// system.
2161    ///
2162    /// Uses IETF language tags as the value's syntax
2163    /// (See https://en.wikipedia.org/wiki/IETF_language_tag)
2164    ///
2165    /// @since 3.16.0
2166    #[serde(skip_serializing_if = "Option::is_none")]
2167    pub locale: Option<String>,
2168    /// The rootPath of the workspace. Is null
2169    /// if no folder is open.
2170    ///
2171    /// @deprecated in favour of rootUri.
2172    #[deprecated(note = "in favour of rootUri.")]
2173    #[serde(default, deserialize_with = "deserialize_some")]
2174    #[serde(skip_serializing_if = "Option::is_none")]
2175    pub root_path: Option<RootPath>,
2176    /// The rootUri of the workspace. Is null if no
2177    /// folder is open. If both `rootPath` and `rootUri` are set
2178    /// `rootUri` wins.
2179    ///
2180    /// @deprecated in favour of workspaceFolders.
2181    #[deprecated(note = "in favour of workspaceFolders.")]
2182    pub root_uri: Option<Uri>,
2183    /// The capabilities provided by the client (editor or tool)
2184    pub capabilities: ClientCapabilities,
2185    /// User provided initialization options.
2186    #[serde(skip_serializing_if = "Option::is_none")]
2187    pub initialization_options: Option<LspAny>,
2188    /// The initial trace setting. If omitted trace is disabled ('off').
2189    #[serde(skip_serializing_if = "Option::is_none")]
2190    pub trace: Option<TraceValue>,
2191    #[serde(flatten)]
2192    pub work_done_progress_params: WorkDoneProgressParams,
2193    #[serde(flatten)]
2194    pub workspace_folders_initialize_params: WorkspaceFoldersInitializeParams,
2195}
2196impl InitializeParams {
2197    #[must_use]
2198    pub const fn new(
2199        process_id: Option<i32>,
2200        client_info: Option<ClientInfo>,
2201        locale: Option<String>,
2202        root_path: Option<RootPath>,
2203        root_uri: Option<Uri>,
2204        capabilities: ClientCapabilities,
2205        initialization_options: Option<LspAny>,
2206        trace: Option<TraceValue>,
2207        work_done_progress_params: WorkDoneProgressParams,
2208        workspace_folders_initialize_params: WorkspaceFoldersInitializeParams,
2209    ) -> Self {
2210        Self {
2211            process_id,
2212            client_info,
2213            locale,
2214            root_path,
2215            root_uri,
2216            capabilities,
2217            initialization_options,
2218            trace,
2219            work_done_progress_params,
2220            workspace_folders_initialize_params,
2221        }
2222    }
2223}
2224
2225/// The result returned from an initialize request.
2226#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
2227#[serde(rename_all = "camelCase")]
2228pub struct InitializeResult {
2229    /// The capabilities the language server provides.
2230    pub capabilities: ServerCapabilities,
2231    /// Information about the server.
2232    ///
2233    /// @since 3.15.0
2234    #[serde(skip_serializing_if = "Option::is_none")]
2235    pub server_info: Option<ServerInfo>,
2236}
2237impl InitializeResult {
2238    #[must_use]
2239    pub const fn new(
2240        capabilities: ServerCapabilities,
2241        server_info: Option<ServerInfo>,
2242    ) -> Self {
2243        Self { capabilities, server_info }
2244    }
2245}
2246
2247/// The data type of the ResponseError if the
2248/// initialize request fails.
2249#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
2250#[serde(rename_all = "camelCase")]
2251pub struct InitializeError {
2252    /// Indicates whether the client execute the following retry logic:
2253    /// (1) show the message provided by the ResponseError to the user
2254    /// (2) user selects retry or cancel
2255    /// (3) if user selected retry the initialize method is sent again.
2256    pub retry: bool,
2257}
2258impl InitializeError {
2259    #[must_use]
2260    pub const fn new(retry: bool) -> Self {
2261        Self { retry }
2262    }
2263}
2264
2265#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
2266#[serde(rename_all = "camelCase")]
2267pub struct InitializedParams {}
2268impl InitializedParams {
2269    #[must_use]
2270    pub const fn new() -> Self {
2271        Self {}
2272    }
2273}
2274
2275/// The parameters of a change configuration notification.
2276#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
2277#[serde(rename_all = "camelCase")]
2278pub struct DidChangeConfigurationParams {
2279    /// The actual changed settings
2280    pub settings: LspAny,
2281}
2282impl DidChangeConfigurationParams {
2283    #[must_use]
2284    pub const fn new(settings: LspAny) -> Self {
2285        Self { settings }
2286    }
2287}
2288
2289#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
2290#[serde(rename_all = "camelCase")]
2291pub struct DidChangeConfigurationRegistrationOptions {
2292    #[serde(skip_serializing_if = "Option::is_none")]
2293    pub section: Option<Section>,
2294}
2295impl DidChangeConfigurationRegistrationOptions {
2296    #[must_use]
2297    pub const fn new(section: Option<Section>) -> Self {
2298        Self { section }
2299    }
2300}
2301
2302/// The parameters of a notification message.
2303#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
2304#[serde(rename_all = "camelCase")]
2305pub struct ShowMessageParams {
2306    /// The message type. See [`MessageType`]
2307    #[serde(rename = "type")]
2308    pub kind: MessageType,
2309    /// The actual message.
2310    pub message: String,
2311}
2312impl ShowMessageParams {
2313    #[must_use]
2314    pub const fn new(kind: MessageType, message: String) -> Self {
2315        Self { kind, message }
2316    }
2317}
2318
2319#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
2320#[serde(rename_all = "camelCase")]
2321pub struct ShowMessageRequestParams {
2322    /// The message type. See [`MessageType`]
2323    #[serde(rename = "type")]
2324    pub kind: MessageType,
2325    /// The actual message.
2326    pub message: String,
2327    /// The message action items to present.
2328    #[serde(skip_serializing_if = "Option::is_none")]
2329    pub actions: Option<Vec<MessageActionItem>>,
2330}
2331impl ShowMessageRequestParams {
2332    #[must_use]
2333    pub const fn new(
2334        kind: MessageType,
2335        message: String,
2336        actions: Option<Vec<MessageActionItem>>,
2337    ) -> Self {
2338        Self { kind, message, actions }
2339    }
2340}
2341
2342#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
2343#[serde(rename_all = "camelCase")]
2344pub struct MessageActionItem {
2345    /// A short title like 'Retry', 'Open Log' etc.
2346    pub title: String,
2347}
2348impl MessageActionItem {
2349    #[must_use]
2350    pub const fn new(title: String) -> Self {
2351        Self { title }
2352    }
2353}
2354
2355/// The log message parameters.
2356#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
2357#[serde(rename_all = "camelCase")]
2358pub struct LogMessageParams {
2359    /// The message type. See [`MessageType`]
2360    #[serde(rename = "type")]
2361    pub kind: MessageType,
2362    /// The actual message.
2363    pub message: String,
2364}
2365impl LogMessageParams {
2366    #[must_use]
2367    pub const fn new(kind: MessageType, message: String) -> Self {
2368        Self { kind, message }
2369    }
2370}
2371
2372/// The parameters sent in an open text document notification
2373#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
2374#[serde(rename_all = "camelCase")]
2375pub struct DidOpenTextDocumentParams {
2376    /// The document that was opened.
2377    pub text_document: TextDocumentItem,
2378}
2379impl DidOpenTextDocumentParams {
2380    #[must_use]
2381    pub const fn new(text_document: TextDocumentItem) -> Self {
2382        Self { text_document }
2383    }
2384}
2385
2386/// The change text document notification's parameters.
2387#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
2388#[serde(rename_all = "camelCase")]
2389pub struct DidChangeTextDocumentParams {
2390    /// The document that did change. The version number points
2391    /// to the version after all provided content changes have
2392    /// been applied.
2393    pub text_document: VersionedTextDocumentIdentifier,
2394    /// The actual content changes. The content changes describe single state changes
2395    /// to the document. So if there are two content changes c1 (at array index 0) and
2396    /// c2 (at array index 1) for a document in state S then c1 moves the document from
2397    /// S to S' and c2 from S' to S''. So c1 is computed on the state S and c2 is computed
2398    /// on the state S'.
2399    ///
2400    /// To mirror the content of a document using change events use the following approach:
2401    /// - start with the same initial content
2402    /// - apply the 'textDocument/didChange' notifications in the order you receive them.
2403    /// - apply the `TextDocumentContentChangeEvent`s in a single notification in the order
2404    ///   you receive them.
2405    pub content_changes: Vec<TextDocumentContentChangeEvent>,
2406}
2407impl DidChangeTextDocumentParams {
2408    #[must_use]
2409    pub const fn new(
2410        text_document: VersionedTextDocumentIdentifier,
2411        content_changes: Vec<TextDocumentContentChangeEvent>,
2412    ) -> Self {
2413        Self {
2414            text_document,
2415            content_changes,
2416        }
2417    }
2418}
2419
2420/// Describe options to be used when registered for text document change events.
2421#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
2422#[serde(rename_all = "camelCase")]
2423pub struct TextDocumentChangeRegistrationOptions {
2424    /// How documents are synced to the server.
2425    pub sync_kind: TextDocumentSyncKind,
2426    #[serde(flatten)]
2427    pub text_document_registration_options: TextDocumentRegistrationOptions,
2428}
2429impl TextDocumentChangeRegistrationOptions {
2430    #[must_use]
2431    pub const fn new(
2432        sync_kind: TextDocumentSyncKind,
2433        text_document_registration_options: TextDocumentRegistrationOptions,
2434    ) -> Self {
2435        Self {
2436            sync_kind,
2437            text_document_registration_options,
2438        }
2439    }
2440}
2441
2442/// The parameters sent in a close text document notification
2443#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
2444#[serde(rename_all = "camelCase")]
2445pub struct DidCloseTextDocumentParams {
2446    /// The document that was closed.
2447    pub text_document: TextDocumentIdentifier,
2448}
2449impl DidCloseTextDocumentParams {
2450    #[must_use]
2451    pub const fn new(text_document: TextDocumentIdentifier) -> Self {
2452        Self { text_document }
2453    }
2454}
2455
2456/// The parameters sent in a save text document notification
2457#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
2458#[serde(rename_all = "camelCase")]
2459pub struct DidSaveTextDocumentParams {
2460    /// The document that was saved.
2461    pub text_document: TextDocumentIdentifier,
2462    /// Optional the content when saved. Depends on the includeText value
2463    /// when the save notification was requested.
2464    #[serde(skip_serializing_if = "Option::is_none")]
2465    pub text: Option<String>,
2466}
2467impl DidSaveTextDocumentParams {
2468    #[must_use]
2469    pub const fn new(
2470        text_document: TextDocumentIdentifier,
2471        text: Option<String>,
2472    ) -> Self {
2473        Self { text_document, text }
2474    }
2475}
2476
2477/// Save registration options.
2478#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
2479#[serde(rename_all = "camelCase")]
2480pub struct TextDocumentSaveRegistrationOptions {
2481    #[serde(flatten)]
2482    pub text_document_registration_options: TextDocumentRegistrationOptions,
2483    #[serde(flatten)]
2484    pub save_options: SaveOptions,
2485}
2486impl TextDocumentSaveRegistrationOptions {
2487    #[must_use]
2488    pub const fn new(
2489        text_document_registration_options: TextDocumentRegistrationOptions,
2490        save_options: SaveOptions,
2491    ) -> Self {
2492        Self {
2493            text_document_registration_options,
2494            save_options,
2495        }
2496    }
2497}
2498
2499/// The parameters sent in a will save text document notification.
2500#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
2501#[serde(rename_all = "camelCase")]
2502pub struct WillSaveTextDocumentParams {
2503    /// The document that will be saved.
2504    pub text_document: TextDocumentIdentifier,
2505    /// The 'TextDocumentSaveReason'.
2506    pub reason: TextDocumentSaveReason,
2507}
2508impl WillSaveTextDocumentParams {
2509    #[must_use]
2510    pub const fn new(
2511        text_document: TextDocumentIdentifier,
2512        reason: TextDocumentSaveReason,
2513    ) -> Self {
2514        Self { text_document, reason }
2515    }
2516}
2517
2518/// A text edit applicable to a text document.
2519#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
2520#[serde(rename_all = "camelCase")]
2521pub struct TextEdit {
2522    /// The range of the text document to be manipulated. To insert
2523    /// text into a document create a range where start === end.
2524    pub range: Range,
2525    /// The string to be inserted. For delete operations use an
2526    /// empty string.
2527    pub new_text: String,
2528}
2529impl TextEdit {
2530    #[must_use]
2531    pub const fn new(range: Range, new_text: String) -> Self {
2532        Self { range, new_text }
2533    }
2534}
2535
2536/// The watched files change notification's parameters.
2537#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
2538#[serde(rename_all = "camelCase")]
2539pub struct DidChangeWatchedFilesParams {
2540    /// The actual file events.
2541    pub changes: Vec<FileEvent>,
2542}
2543impl DidChangeWatchedFilesParams {
2544    #[must_use]
2545    pub const fn new(changes: Vec<FileEvent>) -> Self {
2546        Self { changes }
2547    }
2548}
2549
2550/// Describe options to be used when registered for text document change events.
2551#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
2552#[serde(rename_all = "camelCase")]
2553pub struct DidChangeWatchedFilesRegistrationOptions {
2554    /// The watchers to register.
2555    pub watchers: Vec<FileSystemWatcher>,
2556}
2557impl DidChangeWatchedFilesRegistrationOptions {
2558    #[must_use]
2559    pub const fn new(watchers: Vec<FileSystemWatcher>) -> Self {
2560        Self { watchers }
2561    }
2562}
2563
2564/// The publish diagnostic notification's parameters.
2565#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
2566#[serde(rename_all = "camelCase")]
2567pub struct PublishDiagnosticsParams {
2568    /// The URI for which diagnostic information is reported.
2569    pub uri: Uri,
2570    /// Optional the version number of the document the diagnostics are published for.
2571    ///
2572    /// @since 3.15.0
2573    #[serde(skip_serializing_if = "Option::is_none")]
2574    pub version: Option<i32>,
2575    /// An array of diagnostic information items.
2576    pub diagnostics: Vec<Diagnostic>,
2577}
2578impl PublishDiagnosticsParams {
2579    #[must_use]
2580    pub const fn new(
2581        uri: Uri,
2582        version: Option<i32>,
2583        diagnostics: Vec<Diagnostic>,
2584    ) -> Self {
2585        Self { uri, version, diagnostics }
2586    }
2587}
2588
2589/// Completion parameters
2590#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
2591#[serde(rename_all = "camelCase")]
2592pub struct CompletionParams {
2593    /// The completion context. This is only available it the client specifies
2594    /// to send this using the client capability `textDocument.completion.contextSupport === true`
2595    #[serde(skip_serializing_if = "Option::is_none")]
2596    pub context: Option<CompletionContext>,
2597    #[serde(flatten)]
2598    pub work_done_progress_params: WorkDoneProgressParams,
2599    #[serde(flatten)]
2600    pub partial_result_params: PartialResultParams,
2601    #[serde(flatten)]
2602    pub text_document_position_params: TextDocumentPositionParams,
2603}
2604impl CompletionParams {
2605    #[must_use]
2606    pub const fn new(
2607        context: Option<CompletionContext>,
2608        work_done_progress_params: WorkDoneProgressParams,
2609        partial_result_params: PartialResultParams,
2610        text_document_position_params: TextDocumentPositionParams,
2611    ) -> Self {
2612        Self {
2613            context,
2614            work_done_progress_params,
2615            partial_result_params,
2616            text_document_position_params,
2617        }
2618    }
2619}
2620
2621/// A completion item represents a text snippet that is
2622/// proposed to complete text that is being typed.
2623#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
2624#[serde(rename_all = "camelCase")]
2625pub struct CompletionItem {
2626    /// The label of this completion item.
2627    ///
2628    /// The label property is also by default the text that
2629    /// is inserted when selecting this completion.
2630    ///
2631    /// If label details are provided the label itself should
2632    /// be an unqualified name of the completion item.
2633    pub label: String,
2634    /// Additional details for the label
2635    ///
2636    /// @since 3.17.0
2637    #[serde(skip_serializing_if = "Option::is_none")]
2638    pub label_details: Option<CompletionItemLabelDetails>,
2639    /// The kind of this completion item. Based of the kind
2640    /// an icon is chosen by the editor.
2641    #[serde(skip_serializing_if = "Option::is_none")]
2642    pub kind: Option<CompletionItemKind>,
2643    /// Tags for this completion item.
2644    ///
2645    /// @since 3.15.0
2646    #[serde(skip_serializing_if = "Option::is_none")]
2647    pub tags: Option<Vec<CompletionItemTag>>,
2648    /// A human-readable string with additional information
2649    /// about this item, like type or symbol information.
2650    #[serde(skip_serializing_if = "Option::is_none")]
2651    pub detail: Option<String>,
2652    /// A human-readable string that represents a doc-comment.
2653    #[serde(skip_serializing_if = "Option::is_none")]
2654    pub documentation: Option<Documentation>,
2655    /// Indicates if this item is deprecated.
2656    /// @deprecated Use `tags` instead.
2657    #[deprecated(note = "Use `tags` instead.")]
2658    #[serde(skip_serializing_if = "Option::is_none")]
2659    pub deprecated: Option<bool>,
2660    /// Select this item when showing.
2661    ///
2662    /// *Note* that only one completion item can be selected and that the
2663    /// tool / client decides which item that is. The rule is that the *first*
2664    /// item of those that match best is selected.
2665    #[serde(skip_serializing_if = "Option::is_none")]
2666    pub preselect: Option<bool>,
2667    /// A string that should be used when comparing this item
2668    /// with other items. When `falsy` the [label][`CompletionItem::label`]
2669    /// is used.
2670    #[serde(skip_serializing_if = "Option::is_none")]
2671    pub sort_text: Option<String>,
2672    /// A string that should be used when filtering a set of
2673    /// completion items. When `falsy` the [label][`CompletionItem::label`]
2674    /// is used.
2675    #[serde(skip_serializing_if = "Option::is_none")]
2676    pub filter_text: Option<String>,
2677    /// A string that should be inserted into a document when selecting
2678    /// this completion. When `falsy` the [label][`CompletionItem::label`]
2679    /// is used.
2680    ///
2681    /// The `insertText` is subject to interpretation by the client side.
2682    /// Some tools might not take the string literally. For example
2683    /// VS Code when code complete is requested in this example
2684    /// `con<cursor position>` and a completion item with an `insertText` of
2685    /// `console` is provided it will only insert `sole`. Therefore it is
2686    /// recommended to use `textEdit` instead since it avoids additional client
2687    /// side interpretation.
2688    #[serde(skip_serializing_if = "Option::is_none")]
2689    pub insert_text: Option<String>,
2690    /// The format of the insert text. The format applies to both the
2691    /// `insertText` property and the `newText` property of a provided
2692    /// `textEdit`. If omitted defaults to `InsertTextFormat.PlainText`.
2693    ///
2694    /// Please note that the insertTextFormat doesn't apply to
2695    /// `additionalTextEdits`.
2696    #[serde(skip_serializing_if = "Option::is_none")]
2697    pub insert_text_format: Option<InsertTextFormat>,
2698    /// How whitespace and indentation is handled during completion
2699    /// item insertion. If not provided the clients default value depends on
2700    /// the `textDocument.completion.insertTextMode` client capability.
2701    ///
2702    /// @since 3.16.0
2703    #[serde(skip_serializing_if = "Option::is_none")]
2704    pub insert_text_mode: Option<InsertTextMode>,
2705    /// An [edit][TextEdit] which is applied to a document when selecting
2706    /// this completion. When an edit is provided the value of
2707    /// [insertText][`CompletionItem::insertText`] is ignored.
2708    ///
2709    /// Most editors support two different operations when accepting a completion
2710    /// item. One is to insert a completion text and the other is to replace an
2711    /// existing text with a completion text. Since this can usually not be
2712    /// predetermined by a server it can report both ranges. Clients need to
2713    /// signal support for `InsertReplaceEdits` via the
2714    /// `textDocument.completion.insertReplaceSupport` client capability
2715    /// property.
2716    ///
2717    /// *Note 1:* The text edit's range as well as both ranges from an insert
2718    /// replace edit must be a [single line] and they must contain the position
2719    /// at which completion has been requested.
2720    /// *Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range
2721    /// must be a prefix of the edit's replace range, that means it must be
2722    /// contained and starting at the same position.
2723    ///
2724    /// @since 3.16.0 additional type `InsertReplaceEdit`
2725    #[serde(skip_serializing_if = "Option::is_none")]
2726    pub text_edit: Option<CompletionItemTextEdit>,
2727    /// The edit text used if the completion item is part of a CompletionList and
2728    /// CompletionList defines an item default for the text edit range.
2729    ///
2730    /// Clients will only honor this property if they opt into completion list
2731    /// item defaults using the capability `completionList.itemDefaults`.
2732    ///
2733    /// If not provided and a list's default range is provided the label
2734    /// property is used as a text.
2735    ///
2736    /// @since 3.17.0
2737    #[serde(skip_serializing_if = "Option::is_none")]
2738    pub text_edit_text: Option<String>,
2739    /// An optional array of additional [text edits][TextEdit] that are applied when
2740    /// selecting this completion. Edits must not overlap (including the same insert position)
2741    /// with the main [edit][`CompletionItem::textEdit`] nor with themselves.
2742    ///
2743    /// Additional text edits should be used to change text unrelated to the current cursor position
2744    /// (for example adding an import statement at the top of the file if the completion item will
2745    /// insert an unqualified type).
2746    #[serde(skip_serializing_if = "Option::is_none")]
2747    pub additional_text_edits: Option<Vec<TextEdit>>,
2748    /// An optional set of characters that when pressed while this completion is active will accept it first and
2749    /// then type that character. *Note* that all commit characters should have `length=1` and that superfluous
2750    /// characters will be ignored.
2751    #[serde(skip_serializing_if = "Option::is_none")]
2752    pub commit_characters: Option<Vec<String>>,
2753    /// An optional [command][Command] that is executed *after* inserting this completion. *Note* that
2754    /// additional modifications to the current document should be described with the
2755    /// [additionalTextEdits][`CompletionItem::additionalTextEdits`]-property.
2756    #[serde(skip_serializing_if = "Option::is_none")]
2757    pub command: Option<Command>,
2758    /// A data entry field that is preserved on a completion item between a
2759    /// [`CompletionRequest`] and a [`CompletionResolveRequest`].
2760    #[serde(skip_serializing_if = "Option::is_none")]
2761    pub data: Option<LspAny>,
2762}
2763impl CompletionItem {
2764    #[must_use]
2765    pub const fn new(
2766        label: String,
2767        label_details: Option<CompletionItemLabelDetails>,
2768        kind: Option<CompletionItemKind>,
2769        tags: Option<Vec<CompletionItemTag>>,
2770        detail: Option<String>,
2771        documentation: Option<Documentation>,
2772        deprecated: Option<bool>,
2773        preselect: Option<bool>,
2774        sort_text: Option<String>,
2775        filter_text: Option<String>,
2776        insert_text: Option<String>,
2777        insert_text_format: Option<InsertTextFormat>,
2778        insert_text_mode: Option<InsertTextMode>,
2779        text_edit: Option<CompletionItemTextEdit>,
2780        text_edit_text: Option<String>,
2781        additional_text_edits: Option<Vec<TextEdit>>,
2782        commit_characters: Option<Vec<String>>,
2783        command: Option<Command>,
2784        data: Option<LspAny>,
2785    ) -> Self {
2786        Self {
2787            label,
2788            label_details,
2789            kind,
2790            tags,
2791            detail,
2792            documentation,
2793            deprecated,
2794            preselect,
2795            sort_text,
2796            filter_text,
2797            insert_text,
2798            insert_text_format,
2799            insert_text_mode,
2800            text_edit,
2801            text_edit_text,
2802            additional_text_edits,
2803            commit_characters,
2804            command,
2805            data,
2806        }
2807    }
2808}
2809
2810/// Represents a collection of [completion items][CompletionItem] to be presented
2811/// in the editor.
2812#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
2813#[serde(rename_all = "camelCase")]
2814pub struct CompletionList {
2815    /// This list it not complete. Further typing results in recomputing this list.
2816    ///
2817    /// Recomputed lists have all their items replaced (not appended) in the
2818    /// incomplete completion sessions.
2819    pub is_incomplete: bool,
2820    /// In many cases the items of an actual completion result share the same
2821    /// value for properties like `commitCharacters` or the range of a text
2822    /// edit. A completion list can therefore define item defaults which will
2823    /// be used if a completion item itself doesn't specify the value.
2824    ///
2825    /// If a completion list specifies a default value and a completion item
2826    /// also specifies a corresponding value, the rules for combining these are
2827    /// defined by `applyKinds` (if the client supports it), defaulting to
2828    /// ApplyKind.Replace.
2829    ///
2830    /// Servers are only allowed to return default values if the client
2831    /// signals support for this via the `completionList.itemDefaults`
2832    /// capability.
2833    ///
2834    /// @since 3.17.0
2835    #[serde(skip_serializing_if = "Option::is_none")]
2836    pub item_defaults: Option<CompletionItemDefaults>,
2837    /// Specifies how fields from a completion item should be combined with those
2838    /// from `completionList.itemDefaults`.
2839    ///
2840    /// If unspecified, all fields will be treated as ApplyKind.Replace.
2841    ///
2842    /// If a field's value is ApplyKind.Replace, the value from a completion item
2843    /// (if provided and not `null`) will always be used instead of the value
2844    /// from `completionItem.itemDefaults`.
2845    ///
2846    /// If a field's value is ApplyKind.Merge, the values will be merged using
2847    /// the rules defined against each field below.
2848    ///
2849    /// Servers are only allowed to return `applyKind` if the client
2850    /// signals support for this via the `completionList.applyKindSupport`
2851    /// capability.
2852    ///
2853    /// @since 3.18.0
2854    #[serde(skip_serializing_if = "Option::is_none")]
2855    pub apply_kind: Option<CompletionItemApplyKinds>,
2856    /// The completion items.
2857    pub items: Vec<CompletionItem>,
2858}
2859impl CompletionList {
2860    #[must_use]
2861    pub const fn new(
2862        is_incomplete: bool,
2863        item_defaults: Option<CompletionItemDefaults>,
2864        apply_kind: Option<CompletionItemApplyKinds>,
2865        items: Vec<CompletionItem>,
2866    ) -> Self {
2867        Self {
2868            is_incomplete,
2869            item_defaults,
2870            apply_kind,
2871            items,
2872        }
2873    }
2874}
2875
2876/// Registration options for a [`CompletionRequest`].
2877#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
2878#[serde(rename_all = "camelCase")]
2879pub struct CompletionRegistrationOptions {
2880    #[serde(flatten)]
2881    pub text_document_registration_options: TextDocumentRegistrationOptions,
2882    #[serde(flatten)]
2883    pub completion_options: CompletionOptions,
2884}
2885impl CompletionRegistrationOptions {
2886    #[must_use]
2887    pub const fn new(
2888        text_document_registration_options: TextDocumentRegistrationOptions,
2889        completion_options: CompletionOptions,
2890    ) -> Self {
2891        Self {
2892            text_document_registration_options,
2893            completion_options,
2894        }
2895    }
2896}
2897
2898/// Parameters for a [`HoverRequest`].
2899#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
2900#[serde(rename_all = "camelCase")]
2901pub struct HoverParams {
2902    #[serde(flatten)]
2903    pub work_done_progress_params: WorkDoneProgressParams,
2904    #[serde(flatten)]
2905    pub text_document_position_params: TextDocumentPositionParams,
2906}
2907impl HoverParams {
2908    #[must_use]
2909    pub const fn new(
2910        work_done_progress_params: WorkDoneProgressParams,
2911        text_document_position_params: TextDocumentPositionParams,
2912    ) -> Self {
2913        Self {
2914            work_done_progress_params,
2915            text_document_position_params,
2916        }
2917    }
2918}
2919
2920/// The result of a hover request.
2921#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
2922#[serde(rename_all = "camelCase")]
2923pub struct Hover {
2924    /// The hover's content
2925    pub contents: Contents,
2926    /// An optional range inside the text document that is used to
2927    /// visualize the hover, e.g. by changing the background color.
2928    #[serde(skip_serializing_if = "Option::is_none")]
2929    pub range: Option<Range>,
2930}
2931impl Hover {
2932    #[must_use]
2933    pub const fn new(contents: Contents, range: Option<Range>) -> Self {
2934        Self { contents, range }
2935    }
2936}
2937
2938/// Registration options for a [`HoverRequest`].
2939#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
2940#[serde(rename_all = "camelCase")]
2941pub struct HoverRegistrationOptions {
2942    #[serde(flatten)]
2943    pub text_document_registration_options: TextDocumentRegistrationOptions,
2944    #[serde(flatten)]
2945    pub hover_options: HoverOptions,
2946}
2947impl HoverRegistrationOptions {
2948    #[must_use]
2949    pub const fn new(
2950        text_document_registration_options: TextDocumentRegistrationOptions,
2951        hover_options: HoverOptions,
2952    ) -> Self {
2953        Self {
2954            text_document_registration_options,
2955            hover_options,
2956        }
2957    }
2958}
2959
2960/// Parameters for a [`SignatureHelpRequest`].
2961#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
2962#[serde(rename_all = "camelCase")]
2963pub struct SignatureHelpParams {
2964    /// The signature help context. This is only available if the client specifies
2965    /// to send this using the client capability `textDocument.signatureHelp.contextSupport === true`
2966    ///
2967    /// @since 3.15.0
2968    #[serde(skip_serializing_if = "Option::is_none")]
2969    pub context: Option<SignatureHelpContext>,
2970    #[serde(flatten)]
2971    pub work_done_progress_params: WorkDoneProgressParams,
2972    #[serde(flatten)]
2973    pub text_document_position_params: TextDocumentPositionParams,
2974}
2975impl SignatureHelpParams {
2976    #[must_use]
2977    pub const fn new(
2978        context: Option<SignatureHelpContext>,
2979        work_done_progress_params: WorkDoneProgressParams,
2980        text_document_position_params: TextDocumentPositionParams,
2981    ) -> Self {
2982        Self {
2983            context,
2984            work_done_progress_params,
2985            text_document_position_params,
2986        }
2987    }
2988}
2989
2990/// Signature help represents the signature of something
2991/// callable. There can be multiple signature but only one
2992/// active and only one active parameter.
2993#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
2994#[serde(rename_all = "camelCase")]
2995pub struct SignatureHelp {
2996    /// One or more signatures.
2997    pub signatures: Vec<SignatureInformation>,
2998    /// The active signature. If omitted or the value lies outside the
2999    /// range of `signatures` the value defaults to zero or is ignored if
3000    /// the `SignatureHelp` has no signatures.
3001    ///
3002    /// Whenever possible implementors should make an active decision about
3003    /// the active signature and shouldn't rely on a default value.
3004    ///
3005    /// In future version of the protocol this property might become
3006    /// mandatory to better express this.
3007    #[serde(skip_serializing_if = "Option::is_none")]
3008    pub active_signature: Option<u32>,
3009    /// The active parameter of the active signature.
3010    ///
3011    /// If `null`, no parameter of the signature is active (for example a named
3012    /// argument that does not match any declared parameters). This is only valid
3013    /// if the client specifies the client capability
3014    /// `textDocument.signatureHelp.noActiveParameterSupport === true`
3015    ///
3016    /// If omitted or the value lies outside the range of
3017    /// `signatures[activeSignature].parameters` defaults to 0 if the active
3018    /// signature has parameters.
3019    ///
3020    /// If the active signature has no parameters it is ignored.
3021    ///
3022    /// In future version of the protocol this property might become
3023    /// mandatory (but still nullable) to better express the active parameter if
3024    /// the active signature does have any.
3025    #[serde(default, deserialize_with = "deserialize_some")]
3026    #[serde(skip_serializing_if = "Option::is_none")]
3027    pub active_parameter: Option<ActiveParameter>,
3028}
3029impl SignatureHelp {
3030    #[must_use]
3031    pub const fn new(
3032        signatures: Vec<SignatureInformation>,
3033        active_signature: Option<u32>,
3034        active_parameter: Option<ActiveParameter>,
3035    ) -> Self {
3036        Self {
3037            signatures,
3038            active_signature,
3039            active_parameter,
3040        }
3041    }
3042}
3043
3044/// Registration options for a [`SignatureHelpRequest`].
3045#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
3046#[serde(rename_all = "camelCase")]
3047pub struct SignatureHelpRegistrationOptions {
3048    #[serde(flatten)]
3049    pub text_document_registration_options: TextDocumentRegistrationOptions,
3050    #[serde(flatten)]
3051    pub signature_help_options: SignatureHelpOptions,
3052}
3053impl SignatureHelpRegistrationOptions {
3054    #[must_use]
3055    pub const fn new(
3056        text_document_registration_options: TextDocumentRegistrationOptions,
3057        signature_help_options: SignatureHelpOptions,
3058    ) -> Self {
3059        Self {
3060            text_document_registration_options,
3061            signature_help_options,
3062        }
3063    }
3064}
3065
3066/// Parameters for a [`DefinitionRequest`].
3067#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
3068#[serde(rename_all = "camelCase")]
3069pub struct DefinitionParams {
3070    #[serde(flatten)]
3071    pub work_done_progress_params: WorkDoneProgressParams,
3072    #[serde(flatten)]
3073    pub partial_result_params: PartialResultParams,
3074    #[serde(flatten)]
3075    pub text_document_position_params: TextDocumentPositionParams,
3076}
3077impl DefinitionParams {
3078    #[must_use]
3079    pub const fn new(
3080        work_done_progress_params: WorkDoneProgressParams,
3081        partial_result_params: PartialResultParams,
3082        text_document_position_params: TextDocumentPositionParams,
3083    ) -> Self {
3084        Self {
3085            work_done_progress_params,
3086            partial_result_params,
3087            text_document_position_params,
3088        }
3089    }
3090}
3091
3092/// Registration options for a [`DefinitionRequest`].
3093#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
3094#[serde(rename_all = "camelCase")]
3095pub struct DefinitionRegistrationOptions {
3096    #[serde(flatten)]
3097    pub text_document_registration_options: TextDocumentRegistrationOptions,
3098    #[serde(flatten)]
3099    pub definition_options: DefinitionOptions,
3100}
3101impl DefinitionRegistrationOptions {
3102    #[must_use]
3103    pub const fn new(
3104        text_document_registration_options: TextDocumentRegistrationOptions,
3105        definition_options: DefinitionOptions,
3106    ) -> Self {
3107        Self {
3108            text_document_registration_options,
3109            definition_options,
3110        }
3111    }
3112}
3113
3114/// Parameters for a [`ReferencesRequest`].
3115#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
3116#[serde(rename_all = "camelCase")]
3117pub struct ReferenceParams {
3118    pub context: ReferenceContext,
3119    #[serde(flatten)]
3120    pub work_done_progress_params: WorkDoneProgressParams,
3121    #[serde(flatten)]
3122    pub partial_result_params: PartialResultParams,
3123    #[serde(flatten)]
3124    pub text_document_position_params: TextDocumentPositionParams,
3125}
3126impl ReferenceParams {
3127    #[must_use]
3128    pub const fn new(
3129        context: ReferenceContext,
3130        work_done_progress_params: WorkDoneProgressParams,
3131        partial_result_params: PartialResultParams,
3132        text_document_position_params: TextDocumentPositionParams,
3133    ) -> Self {
3134        Self {
3135            context,
3136            work_done_progress_params,
3137            partial_result_params,
3138            text_document_position_params,
3139        }
3140    }
3141}
3142
3143/// Registration options for a [`ReferencesRequest`].
3144#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
3145#[serde(rename_all = "camelCase")]
3146pub struct ReferenceRegistrationOptions {
3147    #[serde(flatten)]
3148    pub text_document_registration_options: TextDocumentRegistrationOptions,
3149    #[serde(flatten)]
3150    pub reference_options: ReferenceOptions,
3151}
3152impl ReferenceRegistrationOptions {
3153    #[must_use]
3154    pub const fn new(
3155        text_document_registration_options: TextDocumentRegistrationOptions,
3156        reference_options: ReferenceOptions,
3157    ) -> Self {
3158        Self {
3159            text_document_registration_options,
3160            reference_options,
3161        }
3162    }
3163}
3164
3165/// Parameters for a [`DocumentHighlightRequest`].
3166#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
3167#[serde(rename_all = "camelCase")]
3168pub struct DocumentHighlightParams {
3169    #[serde(flatten)]
3170    pub work_done_progress_params: WorkDoneProgressParams,
3171    #[serde(flatten)]
3172    pub partial_result_params: PartialResultParams,
3173    #[serde(flatten)]
3174    pub text_document_position_params: TextDocumentPositionParams,
3175}
3176impl DocumentHighlightParams {
3177    #[must_use]
3178    pub const fn new(
3179        work_done_progress_params: WorkDoneProgressParams,
3180        partial_result_params: PartialResultParams,
3181        text_document_position_params: TextDocumentPositionParams,
3182    ) -> Self {
3183        Self {
3184            work_done_progress_params,
3185            partial_result_params,
3186            text_document_position_params,
3187        }
3188    }
3189}
3190
3191/// A document highlight is a range inside a text document which deserves
3192/// special attention. Usually a document highlight is visualized by changing
3193/// the background color of its range.
3194#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
3195#[serde(rename_all = "camelCase")]
3196pub struct DocumentHighlight {
3197    /// The range this highlight applies to.
3198    pub range: Range,
3199    /// The highlight kind, default is [text][`DocumentHighlightKind::Text`].
3200    #[serde(skip_serializing_if = "Option::is_none")]
3201    pub kind: Option<DocumentHighlightKind>,
3202}
3203impl DocumentHighlight {
3204    #[must_use]
3205    pub const fn new(range: Range, kind: Option<DocumentHighlightKind>) -> Self {
3206        Self { range, kind }
3207    }
3208}
3209
3210/// Registration options for a [`DocumentHighlightRequest`].
3211#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
3212#[serde(rename_all = "camelCase")]
3213pub struct DocumentHighlightRegistrationOptions {
3214    #[serde(flatten)]
3215    pub text_document_registration_options: TextDocumentRegistrationOptions,
3216    #[serde(flatten)]
3217    pub document_highlight_options: DocumentHighlightOptions,
3218}
3219impl DocumentHighlightRegistrationOptions {
3220    #[must_use]
3221    pub const fn new(
3222        text_document_registration_options: TextDocumentRegistrationOptions,
3223        document_highlight_options: DocumentHighlightOptions,
3224    ) -> Self {
3225        Self {
3226            text_document_registration_options,
3227            document_highlight_options,
3228        }
3229    }
3230}
3231
3232/// Parameters for a [`DocumentSymbolRequest`].
3233#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
3234#[serde(rename_all = "camelCase")]
3235pub struct DocumentSymbolParams {
3236    /// The text document.
3237    pub text_document: TextDocumentIdentifier,
3238    #[serde(flatten)]
3239    pub work_done_progress_params: WorkDoneProgressParams,
3240    #[serde(flatten)]
3241    pub partial_result_params: PartialResultParams,
3242}
3243impl DocumentSymbolParams {
3244    #[must_use]
3245    pub const fn new(
3246        text_document: TextDocumentIdentifier,
3247        work_done_progress_params: WorkDoneProgressParams,
3248        partial_result_params: PartialResultParams,
3249    ) -> Self {
3250        Self {
3251            text_document,
3252            work_done_progress_params,
3253            partial_result_params,
3254        }
3255    }
3256}
3257
3258/// Represents information about programming constructs like variables, classes,
3259/// interfaces etc.
3260#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
3261#[serde(rename_all = "camelCase")]
3262pub struct SymbolInformation {
3263    /// Indicates if this symbol is deprecated.
3264    ///
3265    /// @deprecated Use tags instead
3266    #[deprecated(note = "Use tags instead")]
3267    #[serde(skip_serializing_if = "Option::is_none")]
3268    pub deprecated: Option<bool>,
3269    /// The location of this symbol. The location's range is used by a tool
3270    /// to reveal the location in the editor. If the symbol is selected in the
3271    /// tool the range's start information is used to position the cursor. So
3272    /// the range usually spans more than the actual symbol's name and does
3273    /// normally include things like visibility modifiers.
3274    ///
3275    /// The range doesn't have to denote a node range in the sense of an abstract
3276    /// syntax tree. It can therefore not be used to re-construct a hierarchy of
3277    /// the symbols.
3278    pub location: Location,
3279    #[serde(flatten)]
3280    pub base_symbol_information: BaseSymbolInformation,
3281}
3282impl SymbolInformation {
3283    #[must_use]
3284    pub const fn new(
3285        deprecated: Option<bool>,
3286        location: Location,
3287        base_symbol_information: BaseSymbolInformation,
3288    ) -> Self {
3289        Self {
3290            deprecated,
3291            location,
3292            base_symbol_information,
3293        }
3294    }
3295}
3296
3297/// Represents programming constructs like variables, classes, interfaces etc.
3298/// that appear in a document. Document symbols can be hierarchical and they
3299/// have two ranges: one that encloses its definition and one that points to
3300/// its most interesting range, e.g. the range of an identifier.
3301#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
3302#[serde(rename_all = "camelCase")]
3303pub struct DocumentSymbol {
3304    /// The name of this symbol. Will be displayed in the user interface and therefore must not be
3305    /// an empty string or a string only consisting of white spaces.
3306    pub name: String,
3307    /// More detail for this symbol, e.g the signature of a function.
3308    #[serde(skip_serializing_if = "Option::is_none")]
3309    pub detail: Option<String>,
3310    /// The kind of this symbol.
3311    pub kind: SymbolKind,
3312    /// Tags for this document symbol.
3313    ///
3314    /// @since 3.16.0
3315    #[serde(skip_serializing_if = "Option::is_none")]
3316    pub tags: Option<Vec<SymbolTag>>,
3317    /// Indicates if this symbol is deprecated.
3318    ///
3319    /// @deprecated Use tags instead
3320    #[deprecated(note = "Use tags instead")]
3321    #[serde(skip_serializing_if = "Option::is_none")]
3322    pub deprecated: Option<bool>,
3323    /// The range enclosing this symbol not including leading/trailing whitespace but everything else
3324    /// like comments. This information is typically used to determine if the clients cursor is
3325    /// inside the symbol to reveal in the symbol in the UI.
3326    pub range: Range,
3327    /// The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.
3328    /// Must be contained by the `range`.
3329    pub selection_range: Range,
3330    /// Children of this symbol, e.g. properties of a class.
3331    #[serde(skip_serializing_if = "Option::is_none")]
3332    pub children: Option<Vec<DocumentSymbol>>,
3333}
3334impl DocumentSymbol {
3335    #[must_use]
3336    pub const fn new(
3337        name: String,
3338        detail: Option<String>,
3339        kind: SymbolKind,
3340        tags: Option<Vec<SymbolTag>>,
3341        deprecated: Option<bool>,
3342        range: Range,
3343        selection_range: Range,
3344        children: Option<Vec<DocumentSymbol>>,
3345    ) -> Self {
3346        Self {
3347            name,
3348            detail,
3349            kind,
3350            tags,
3351            deprecated,
3352            range,
3353            selection_range,
3354            children,
3355        }
3356    }
3357}
3358
3359/// Registration options for a [`DocumentSymbolRequest`].
3360#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
3361#[serde(rename_all = "camelCase")]
3362pub struct DocumentSymbolRegistrationOptions {
3363    #[serde(flatten)]
3364    pub text_document_registration_options: TextDocumentRegistrationOptions,
3365    #[serde(flatten)]
3366    pub document_symbol_options: DocumentSymbolOptions,
3367}
3368impl DocumentSymbolRegistrationOptions {
3369    #[must_use]
3370    pub const fn new(
3371        text_document_registration_options: TextDocumentRegistrationOptions,
3372        document_symbol_options: DocumentSymbolOptions,
3373    ) -> Self {
3374        Self {
3375            text_document_registration_options,
3376            document_symbol_options,
3377        }
3378    }
3379}
3380
3381/// The parameters of a [`CodeActionRequest`].
3382#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
3383#[serde(rename_all = "camelCase")]
3384pub struct CodeActionParams {
3385    /// The document in which the command was invoked.
3386    pub text_document: TextDocumentIdentifier,
3387    /// The range for which the command was invoked.
3388    pub range: Range,
3389    /// Context carrying additional information.
3390    pub context: CodeActionContext,
3391    #[serde(flatten)]
3392    pub work_done_progress_params: WorkDoneProgressParams,
3393    #[serde(flatten)]
3394    pub partial_result_params: PartialResultParams,
3395}
3396impl CodeActionParams {
3397    #[must_use]
3398    pub const fn new(
3399        text_document: TextDocumentIdentifier,
3400        range: Range,
3401        context: CodeActionContext,
3402        work_done_progress_params: WorkDoneProgressParams,
3403        partial_result_params: PartialResultParams,
3404    ) -> Self {
3405        Self {
3406            text_document,
3407            range,
3408            context,
3409            work_done_progress_params,
3410            partial_result_params,
3411        }
3412    }
3413}
3414
3415/// Represents a reference to a command. Provides a title which
3416/// will be used to represent a command in the UI and, optionally,
3417/// an array of arguments which will be passed to the command handler
3418/// function when invoked.
3419#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
3420#[serde(rename_all = "camelCase")]
3421pub struct Command {
3422    /// Title of the command, like `save`.
3423    pub title: String,
3424    /// An optional tooltip.
3425    ///
3426    /// @since 3.18.0
3427    /// @proposed
3428    #[serde(skip_serializing_if = "Option::is_none")]
3429    pub tooltip: Option<String>,
3430    /// The identifier of the actual command handler.
3431    pub command: String,
3432    /// Arguments that the command handler should be
3433    /// invoked with.
3434    #[serde(skip_serializing_if = "Option::is_none")]
3435    pub arguments: Option<Vec<LspAny>>,
3436}
3437impl Command {
3438    #[must_use]
3439    pub const fn new(
3440        title: String,
3441        tooltip: Option<String>,
3442        command: String,
3443        arguments: Option<Vec<LspAny>>,
3444    ) -> Self {
3445        Self {
3446            title,
3447            tooltip,
3448            command,
3449            arguments,
3450        }
3451    }
3452}
3453
3454/// A code action represents a change that can be performed in code, e.g. to fix a problem or
3455/// to refactor code.
3456///
3457/// A CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed.
3458#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
3459#[serde(rename_all = "camelCase")]
3460pub struct CodeAction {
3461    /// A short, human-readable, title for this code action.
3462    pub title: String,
3463    /// The kind of the code action.
3464    ///
3465    /// Used to filter code actions.
3466    #[serde(skip_serializing_if = "Option::is_none")]
3467    pub kind: Option<CodeActionKind>,
3468    /// The diagnostics that this code action resolves.
3469    #[serde(skip_serializing_if = "Option::is_none")]
3470    pub diagnostics: Option<Vec<Diagnostic>>,
3471    /// Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted
3472    /// by keybindings.
3473    ///
3474    /// A quick fix should be marked preferred if it properly addresses the underlying error.
3475    /// A refactoring should be marked preferred if it is the most reasonable choice of actions to take.
3476    ///
3477    /// @since 3.15.0
3478    #[serde(skip_serializing_if = "Option::is_none")]
3479    pub is_preferred: Option<bool>,
3480    /// Marks that the code action cannot currently be applied.
3481    ///
3482    /// Clients should follow the following guidelines regarding disabled code actions:
3483    ///
3484    ///   - Disabled code actions are not shown in automatic [lightbulbs](https://code.visualstudio.com/docs/editor/editingevolved#_code-action)
3485    ///     code action menus.
3486    ///
3487    ///   - Disabled actions are shown as faded out in the code action menu when the user requests a more specific type
3488    ///     of code action, such as refactorings.
3489    ///
3490    ///   - If the user has a [keybinding](https://code.visualstudio.com/docs/editor/refactoring#_keybindings-for-code-actions)
3491    ///     that auto applies a code action and only disabled code actions are returned, the client should show the user an
3492    ///     error message with `reason` in the editor.
3493    ///
3494    /// @since 3.16.0
3495    #[serde(skip_serializing_if = "Option::is_none")]
3496    pub disabled: Option<CodeActionDisabled>,
3497    /// The workspace edit this code action performs.
3498    #[serde(skip_serializing_if = "Option::is_none")]
3499    pub edit: Option<WorkspaceEdit>,
3500    /// A command this code action executes. If a code action
3501    /// provides an edit and a command, first the edit is
3502    /// executed and then the command.
3503    #[serde(skip_serializing_if = "Option::is_none")]
3504    pub command: Option<Command>,
3505    /// A data entry field that is preserved on a code action between
3506    /// a `textDocument/codeAction` and a `codeAction/resolve` request.
3507    ///
3508    /// @since 3.16.0
3509    #[serde(skip_serializing_if = "Option::is_none")]
3510    pub data: Option<LspAny>,
3511    /// Tags for this code action.
3512    ///
3513    /// @since 3.18.0 - proposed
3514    #[serde(skip_serializing_if = "Option::is_none")]
3515    pub tags: Option<Vec<CodeActionTag>>,
3516}
3517impl CodeAction {
3518    #[must_use]
3519    pub const fn new(
3520        title: String,
3521        kind: Option<CodeActionKind>,
3522        diagnostics: Option<Vec<Diagnostic>>,
3523        is_preferred: Option<bool>,
3524        disabled: Option<CodeActionDisabled>,
3525        edit: Option<WorkspaceEdit>,
3526        command: Option<Command>,
3527        data: Option<LspAny>,
3528        tags: Option<Vec<CodeActionTag>>,
3529    ) -> Self {
3530        Self {
3531            title,
3532            kind,
3533            diagnostics,
3534            is_preferred,
3535            disabled,
3536            edit,
3537            command,
3538            data,
3539            tags,
3540        }
3541    }
3542}
3543
3544/// Registration options for a [`CodeActionRequest`].
3545#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
3546#[serde(rename_all = "camelCase")]
3547pub struct CodeActionRegistrationOptions {
3548    #[serde(flatten)]
3549    pub text_document_registration_options: TextDocumentRegistrationOptions,
3550    #[serde(flatten)]
3551    pub code_action_options: CodeActionOptions,
3552}
3553impl CodeActionRegistrationOptions {
3554    #[must_use]
3555    pub const fn new(
3556        text_document_registration_options: TextDocumentRegistrationOptions,
3557        code_action_options: CodeActionOptions,
3558    ) -> Self {
3559        Self {
3560            text_document_registration_options,
3561            code_action_options,
3562        }
3563    }
3564}
3565
3566/// The parameters of a [`WorkspaceSymbolRequest`].
3567#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
3568#[serde(rename_all = "camelCase")]
3569pub struct WorkspaceSymbolParams {
3570    /// A query string to filter symbols by. Clients may send an empty
3571    /// string here to request all symbols.
3572    ///
3573    /// The `query`-parameter should be interpreted in a *relaxed way* as editors
3574    /// will apply their own highlighting and scoring on the results. A good rule
3575    /// of thumb is to match case-insensitive and to simply check that the
3576    /// characters of *query* appear in their order in a candidate symbol.
3577    /// Servers shouldn't use prefix, substring, or similar strict matching.
3578    pub query: String,
3579    #[serde(flatten)]
3580    pub work_done_progress_params: WorkDoneProgressParams,
3581    #[serde(flatten)]
3582    pub partial_result_params: PartialResultParams,
3583}
3584impl WorkspaceSymbolParams {
3585    #[must_use]
3586    pub const fn new(
3587        query: String,
3588        work_done_progress_params: WorkDoneProgressParams,
3589        partial_result_params: PartialResultParams,
3590    ) -> Self {
3591        Self {
3592            query,
3593            work_done_progress_params,
3594            partial_result_params,
3595        }
3596    }
3597}
3598
3599/// A special workspace symbol that supports locations without a range.
3600///
3601/// See also SymbolInformation.
3602///
3603/// @since 3.17.0
3604#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
3605#[serde(rename_all = "camelCase")]
3606pub struct WorkspaceSymbol {
3607    /// The location of the symbol. Whether a server is allowed to
3608    /// return a location without a range depends on the client
3609    /// capability `workspace.symbol.resolveSupport`.
3610    ///
3611    /// See SymbolInformation#location for more details.
3612    pub location: WorkspaceSymbolLocation,
3613    /// A data entry field that is preserved on a workspace symbol between a
3614    /// workspace symbol request and a workspace symbol resolve request.
3615    #[serde(skip_serializing_if = "Option::is_none")]
3616    pub data: Option<LspAny>,
3617    #[serde(flatten)]
3618    pub base_symbol_information: BaseSymbolInformation,
3619}
3620impl WorkspaceSymbol {
3621    #[must_use]
3622    pub const fn new(
3623        location: WorkspaceSymbolLocation,
3624        data: Option<LspAny>,
3625        base_symbol_information: BaseSymbolInformation,
3626    ) -> Self {
3627        Self {
3628            location,
3629            data,
3630            base_symbol_information,
3631        }
3632    }
3633}
3634
3635/// Registration options for a [`WorkspaceSymbolRequest`].
3636#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
3637#[serde(rename_all = "camelCase")]
3638pub struct WorkspaceSymbolRegistrationOptions {
3639    #[serde(flatten)]
3640    pub workspace_symbol_options: WorkspaceSymbolOptions,
3641}
3642impl WorkspaceSymbolRegistrationOptions {
3643    #[must_use]
3644    pub const fn new(workspace_symbol_options: WorkspaceSymbolOptions) -> Self {
3645        Self { workspace_symbol_options }
3646    }
3647}
3648
3649/// The parameters of a [`CodeLensRequest`].
3650#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
3651#[serde(rename_all = "camelCase")]
3652pub struct CodeLensParams {
3653    /// The document to request code lens for.
3654    pub text_document: TextDocumentIdentifier,
3655    #[serde(flatten)]
3656    pub work_done_progress_params: WorkDoneProgressParams,
3657    #[serde(flatten)]
3658    pub partial_result_params: PartialResultParams,
3659}
3660impl CodeLensParams {
3661    #[must_use]
3662    pub const fn new(
3663        text_document: TextDocumentIdentifier,
3664        work_done_progress_params: WorkDoneProgressParams,
3665        partial_result_params: PartialResultParams,
3666    ) -> Self {
3667        Self {
3668            text_document,
3669            work_done_progress_params,
3670            partial_result_params,
3671        }
3672    }
3673}
3674
3675/// A code lens represents a [command][Command] that should be shown along with
3676/// source text, like the number of references, a way to run tests, etc.
3677///
3678/// A code lens is _unresolved_ when no command is associated to it. For performance
3679/// reasons the creation of a code lens and resolving should be done in two stages.
3680#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
3681#[serde(rename_all = "camelCase")]
3682pub struct CodeLens {
3683    /// The range in which this code lens is valid. Should only span a single line.
3684    pub range: Range,
3685    /// The command this code lens represents.
3686    #[serde(skip_serializing_if = "Option::is_none")]
3687    pub command: Option<Command>,
3688    /// A data entry field that is preserved on a code lens item between
3689    /// a [`CodeLensRequest`] and a [`CodeLensResolveRequest`]
3690    #[serde(skip_serializing_if = "Option::is_none")]
3691    pub data: Option<LspAny>,
3692}
3693impl CodeLens {
3694    #[must_use]
3695    pub const fn new(
3696        range: Range,
3697        command: Option<Command>,
3698        data: Option<LspAny>,
3699    ) -> Self {
3700        Self { range, command, data }
3701    }
3702}
3703
3704/// Registration options for a [`CodeLensRequest`].
3705#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
3706#[serde(rename_all = "camelCase")]
3707pub struct CodeLensRegistrationOptions {
3708    #[serde(flatten)]
3709    pub text_document_registration_options: TextDocumentRegistrationOptions,
3710    #[serde(flatten)]
3711    pub code_lens_options: CodeLensOptions,
3712}
3713impl CodeLensRegistrationOptions {
3714    #[must_use]
3715    pub const fn new(
3716        text_document_registration_options: TextDocumentRegistrationOptions,
3717        code_lens_options: CodeLensOptions,
3718    ) -> Self {
3719        Self {
3720            text_document_registration_options,
3721            code_lens_options,
3722        }
3723    }
3724}
3725
3726/// The parameters of a [`DocumentLinkRequest`].
3727#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
3728#[serde(rename_all = "camelCase")]
3729pub struct DocumentLinkParams {
3730    /// The document to provide document links for.
3731    pub text_document: TextDocumentIdentifier,
3732    #[serde(flatten)]
3733    pub work_done_progress_params: WorkDoneProgressParams,
3734    #[serde(flatten)]
3735    pub partial_result_params: PartialResultParams,
3736}
3737impl DocumentLinkParams {
3738    #[must_use]
3739    pub const fn new(
3740        text_document: TextDocumentIdentifier,
3741        work_done_progress_params: WorkDoneProgressParams,
3742        partial_result_params: PartialResultParams,
3743    ) -> Self {
3744        Self {
3745            text_document,
3746            work_done_progress_params,
3747            partial_result_params,
3748        }
3749    }
3750}
3751
3752/// A document link is a range in a text document that links to an internal or external resource, like another
3753/// text document or a web site.
3754#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
3755#[serde(rename_all = "camelCase")]
3756pub struct DocumentLink {
3757    /// The range this link applies to.
3758    pub range: Range,
3759    /// The uri this link points to. If missing a resolve request is sent later.
3760    #[serde(skip_serializing_if = "Option::is_none")]
3761    pub target: Option<Uri>,
3762    /// The tooltip text when you hover over this link.
3763    ///
3764    /// If a tooltip is provided, is will be displayed in a string that includes instructions on how to
3765    /// trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS,
3766    /// user settings, and localization.
3767    ///
3768    /// @since 3.15.0
3769    #[serde(skip_serializing_if = "Option::is_none")]
3770    pub tooltip: Option<String>,
3771    /// A data entry field that is preserved on a document link between a
3772    /// DocumentLinkRequest and a DocumentLinkResolveRequest.
3773    #[serde(skip_serializing_if = "Option::is_none")]
3774    pub data: Option<LspAny>,
3775}
3776impl DocumentLink {
3777    #[must_use]
3778    pub const fn new(
3779        range: Range,
3780        target: Option<Uri>,
3781        tooltip: Option<String>,
3782        data: Option<LspAny>,
3783    ) -> Self {
3784        Self {
3785            range,
3786            target,
3787            tooltip,
3788            data,
3789        }
3790    }
3791}
3792
3793/// Registration options for a [`DocumentLinkRequest`].
3794#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
3795#[serde(rename_all = "camelCase")]
3796pub struct DocumentLinkRegistrationOptions {
3797    #[serde(flatten)]
3798    pub text_document_registration_options: TextDocumentRegistrationOptions,
3799    #[serde(flatten)]
3800    pub document_link_options: DocumentLinkOptions,
3801}
3802impl DocumentLinkRegistrationOptions {
3803    #[must_use]
3804    pub const fn new(
3805        text_document_registration_options: TextDocumentRegistrationOptions,
3806        document_link_options: DocumentLinkOptions,
3807    ) -> Self {
3808        Self {
3809            text_document_registration_options,
3810            document_link_options,
3811        }
3812    }
3813}
3814
3815/// The parameters of a [`DocumentFormattingRequest`].
3816#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
3817#[serde(rename_all = "camelCase")]
3818pub struct DocumentFormattingParams {
3819    /// The document to format.
3820    pub text_document: TextDocumentIdentifier,
3821    /// The format options.
3822    pub options: FormattingOptions,
3823    #[serde(flatten)]
3824    pub work_done_progress_params: WorkDoneProgressParams,
3825}
3826impl DocumentFormattingParams {
3827    #[must_use]
3828    pub const fn new(
3829        text_document: TextDocumentIdentifier,
3830        options: FormattingOptions,
3831        work_done_progress_params: WorkDoneProgressParams,
3832    ) -> Self {
3833        Self {
3834            text_document,
3835            options,
3836            work_done_progress_params,
3837        }
3838    }
3839}
3840
3841/// Registration options for a [`DocumentFormattingRequest`].
3842#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
3843#[serde(rename_all = "camelCase")]
3844pub struct DocumentFormattingRegistrationOptions {
3845    #[serde(flatten)]
3846    pub text_document_registration_options: TextDocumentRegistrationOptions,
3847    #[serde(flatten)]
3848    pub document_formatting_options: DocumentFormattingOptions,
3849}
3850impl DocumentFormattingRegistrationOptions {
3851    #[must_use]
3852    pub const fn new(
3853        text_document_registration_options: TextDocumentRegistrationOptions,
3854        document_formatting_options: DocumentFormattingOptions,
3855    ) -> Self {
3856        Self {
3857            text_document_registration_options,
3858            document_formatting_options,
3859        }
3860    }
3861}
3862
3863/// The parameters of a [`DocumentRangeFormattingRequest`].
3864#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
3865#[serde(rename_all = "camelCase")]
3866pub struct DocumentRangeFormattingParams {
3867    /// The document to format.
3868    pub text_document: TextDocumentIdentifier,
3869    /// The range to format
3870    pub range: Range,
3871    /// The format options
3872    pub options: FormattingOptions,
3873    #[serde(flatten)]
3874    pub work_done_progress_params: WorkDoneProgressParams,
3875}
3876impl DocumentRangeFormattingParams {
3877    #[must_use]
3878    pub const fn new(
3879        text_document: TextDocumentIdentifier,
3880        range: Range,
3881        options: FormattingOptions,
3882        work_done_progress_params: WorkDoneProgressParams,
3883    ) -> Self {
3884        Self {
3885            text_document,
3886            range,
3887            options,
3888            work_done_progress_params,
3889        }
3890    }
3891}
3892
3893/// Registration options for a [`DocumentRangeFormattingRequest`].
3894#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
3895#[serde(rename_all = "camelCase")]
3896pub struct DocumentRangeFormattingRegistrationOptions {
3897    #[serde(flatten)]
3898    pub text_document_registration_options: TextDocumentRegistrationOptions,
3899    #[serde(flatten)]
3900    pub document_range_formatting_options: DocumentRangeFormattingOptions,
3901}
3902impl DocumentRangeFormattingRegistrationOptions {
3903    #[must_use]
3904    pub const fn new(
3905        text_document_registration_options: TextDocumentRegistrationOptions,
3906        document_range_formatting_options: DocumentRangeFormattingOptions,
3907    ) -> Self {
3908        Self {
3909            text_document_registration_options,
3910            document_range_formatting_options,
3911        }
3912    }
3913}
3914
3915/// The parameters of a [`DocumentRangesFormattingRequest`].
3916///
3917/// @since 3.18.0
3918/// @proposed
3919#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
3920#[serde(rename_all = "camelCase")]
3921pub struct DocumentRangesFormattingParams {
3922    /// The document to format.
3923    pub text_document: TextDocumentIdentifier,
3924    /// The ranges to format
3925    pub ranges: Vec<Range>,
3926    /// The format options
3927    pub options: FormattingOptions,
3928    #[serde(flatten)]
3929    pub work_done_progress_params: WorkDoneProgressParams,
3930}
3931impl DocumentRangesFormattingParams {
3932    #[must_use]
3933    pub const fn new(
3934        text_document: TextDocumentIdentifier,
3935        ranges: Vec<Range>,
3936        options: FormattingOptions,
3937        work_done_progress_params: WorkDoneProgressParams,
3938    ) -> Self {
3939        Self {
3940            text_document,
3941            ranges,
3942            options,
3943            work_done_progress_params,
3944        }
3945    }
3946}
3947
3948/// The parameters of a [`DocumentOnTypeFormattingRequest`].
3949#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
3950#[serde(rename_all = "camelCase")]
3951pub struct DocumentOnTypeFormattingParams {
3952    /// The document to format.
3953    pub text_document: TextDocumentIdentifier,
3954    /// The position around which the on type formatting should happen.
3955    /// This is not necessarily the exact position where the character denoted
3956    /// by the property `ch` got typed.
3957    pub position: Position,
3958    /// The character that has been typed that triggered the formatting
3959    /// on type request. That is not necessarily the last character that
3960    /// got inserted into the document since the client could auto insert
3961    /// characters as well (e.g. like automatic brace completion).
3962    pub ch: String,
3963    /// The formatting options.
3964    pub options: FormattingOptions,
3965}
3966impl DocumentOnTypeFormattingParams {
3967    #[must_use]
3968    pub const fn new(
3969        text_document: TextDocumentIdentifier,
3970        position: Position,
3971        ch: String,
3972        options: FormattingOptions,
3973    ) -> Self {
3974        Self {
3975            text_document,
3976            position,
3977            ch,
3978            options,
3979        }
3980    }
3981}
3982
3983/// Registration options for a [`DocumentOnTypeFormattingRequest`].
3984#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
3985#[serde(rename_all = "camelCase")]
3986pub struct DocumentOnTypeFormattingRegistrationOptions {
3987    #[serde(flatten)]
3988    pub text_document_registration_options: TextDocumentRegistrationOptions,
3989    #[serde(flatten)]
3990    pub document_on_type_formatting_options: DocumentOnTypeFormattingOptions,
3991}
3992impl DocumentOnTypeFormattingRegistrationOptions {
3993    #[must_use]
3994    pub const fn new(
3995        text_document_registration_options: TextDocumentRegistrationOptions,
3996        document_on_type_formatting_options: DocumentOnTypeFormattingOptions,
3997    ) -> Self {
3998        Self {
3999            text_document_registration_options,
4000            document_on_type_formatting_options,
4001        }
4002    }
4003}
4004
4005/// The parameters of a [`RenameRequest`].
4006#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
4007#[serde(rename_all = "camelCase")]
4008pub struct RenameParams {
4009    /// The new name of the symbol. If the given name is not valid the
4010    /// request must return a [`ResponseError`] with an
4011    /// appropriate message set.
4012    pub new_name: String,
4013    #[serde(flatten)]
4014    pub work_done_progress_params: WorkDoneProgressParams,
4015    #[serde(flatten)]
4016    pub text_document_position_params: TextDocumentPositionParams,
4017}
4018impl RenameParams {
4019    #[must_use]
4020    pub const fn new(
4021        new_name: String,
4022        work_done_progress_params: WorkDoneProgressParams,
4023        text_document_position_params: TextDocumentPositionParams,
4024    ) -> Self {
4025        Self {
4026            new_name,
4027            work_done_progress_params,
4028            text_document_position_params,
4029        }
4030    }
4031}
4032
4033/// Registration options for a [`RenameRequest`].
4034#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
4035#[serde(rename_all = "camelCase")]
4036pub struct RenameRegistrationOptions {
4037    #[serde(flatten)]
4038    pub text_document_registration_options: TextDocumentRegistrationOptions,
4039    #[serde(flatten)]
4040    pub rename_options: RenameOptions,
4041}
4042impl RenameRegistrationOptions {
4043    #[must_use]
4044    pub const fn new(
4045        text_document_registration_options: TextDocumentRegistrationOptions,
4046        rename_options: RenameOptions,
4047    ) -> Self {
4048        Self {
4049            text_document_registration_options,
4050            rename_options,
4051        }
4052    }
4053}
4054
4055#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
4056#[serde(rename_all = "camelCase")]
4057pub struct PrepareRenameParams {
4058    #[serde(flatten)]
4059    pub work_done_progress_params: WorkDoneProgressParams,
4060    #[serde(flatten)]
4061    pub text_document_position_params: TextDocumentPositionParams,
4062}
4063impl PrepareRenameParams {
4064    #[must_use]
4065    pub const fn new(
4066        work_done_progress_params: WorkDoneProgressParams,
4067        text_document_position_params: TextDocumentPositionParams,
4068    ) -> Self {
4069        Self {
4070            work_done_progress_params,
4071            text_document_position_params,
4072        }
4073    }
4074}
4075
4076/// The parameters of a [`ExecuteCommandRequest`].
4077#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
4078#[serde(rename_all = "camelCase")]
4079pub struct ExecuteCommandParams {
4080    /// The identifier of the actual command handler.
4081    pub command: String,
4082    /// Arguments that the command should be invoked with.
4083    #[serde(skip_serializing_if = "Option::is_none")]
4084    pub arguments: Option<Vec<LspAny>>,
4085    #[serde(flatten)]
4086    pub work_done_progress_params: WorkDoneProgressParams,
4087}
4088impl ExecuteCommandParams {
4089    #[must_use]
4090    pub const fn new(
4091        command: String,
4092        arguments: Option<Vec<LspAny>>,
4093        work_done_progress_params: WorkDoneProgressParams,
4094    ) -> Self {
4095        Self {
4096            command,
4097            arguments,
4098            work_done_progress_params,
4099        }
4100    }
4101}
4102
4103/// Registration options for a [`ExecuteCommandRequest`].
4104#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
4105#[serde(rename_all = "camelCase")]
4106pub struct ExecuteCommandRegistrationOptions {
4107    #[serde(flatten)]
4108    pub execute_command_options: ExecuteCommandOptions,
4109}
4110impl ExecuteCommandRegistrationOptions {
4111    #[must_use]
4112    pub const fn new(execute_command_options: ExecuteCommandOptions) -> Self {
4113        Self { execute_command_options }
4114    }
4115}
4116
4117/// The parameters passed via an apply workspace edit request.
4118#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
4119#[serde(rename_all = "camelCase")]
4120pub struct ApplyWorkspaceEditParams {
4121    /// An optional label of the workspace edit. This label is
4122    /// presented in the user interface for example on an undo
4123    /// stack to undo the workspace edit.
4124    #[serde(skip_serializing_if = "Option::is_none")]
4125    pub label: Option<String>,
4126    /// The edits to apply.
4127    pub edit: WorkspaceEdit,
4128    /// Additional data about the edit.
4129    ///
4130    /// @since 3.18.0
4131    /// @proposed
4132    #[serde(skip_serializing_if = "Option::is_none")]
4133    pub metadata: Option<WorkspaceEditMetadata>,
4134}
4135impl ApplyWorkspaceEditParams {
4136    #[must_use]
4137    pub const fn new(
4138        label: Option<String>,
4139        edit: WorkspaceEdit,
4140        metadata: Option<WorkspaceEditMetadata>,
4141    ) -> Self {
4142        Self { label, edit, metadata }
4143    }
4144}
4145
4146/// The result returned from the apply workspace edit request.
4147///
4148/// @since 3.17 renamed from ApplyWorkspaceEditResponse
4149#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
4150#[serde(rename_all = "camelCase")]
4151pub struct ApplyWorkspaceEditResult {
4152    /// Indicates whether the edit was applied or not.
4153    pub applied: bool,
4154    /// An optional textual description for why the edit was not applied.
4155    /// This may be used by the server for diagnostic logging or to provide
4156    /// a suitable error for a request that triggered the edit.
4157    #[serde(skip_serializing_if = "Option::is_none")]
4158    pub failure_reason: Option<String>,
4159    /// Depending on the client's failure handling strategy `failedChange` might
4160    /// contain the index of the change that failed. This property is only available
4161    /// if the client signals a `failureHandlingStrategy` in its client capabilities.
4162    #[serde(skip_serializing_if = "Option::is_none")]
4163    pub failed_change: Option<u32>,
4164}
4165impl ApplyWorkspaceEditResult {
4166    #[must_use]
4167    pub const fn new(
4168        applied: bool,
4169        failure_reason: Option<String>,
4170        failed_change: Option<u32>,
4171    ) -> Self {
4172        Self {
4173            applied,
4174            failure_reason,
4175            failed_change,
4176        }
4177    }
4178}
4179
4180#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
4181#[serde(rename_all = "camelCase")]
4182#[serde(try_from = "ShadowWorkDoneProgressBegin", into = "ShadowWorkDoneProgressBegin")]
4183pub struct WorkDoneProgressBegin {
4184    /// Mandatory title of the progress operation. Used to briefly inform about
4185    /// the kind of operation being performed.
4186    ///
4187    /// Examples: "Indexing" or "Linking dependencies".
4188    pub title: String,
4189    /// Controls if a cancel button should show to allow the user to cancel the
4190    /// long running operation. Clients that don't support cancellation are allowed
4191    /// to ignore the setting.
4192    #[serde(skip_serializing_if = "Option::is_none")]
4193    pub cancellable: Option<bool>,
4194    /// Optional, more detailed associated progress message. Contains
4195    /// complementary information to the `title`.
4196    ///
4197    /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
4198    /// If unset, the previous progress message (if any) is still valid.
4199    #[serde(skip_serializing_if = "Option::is_none")]
4200    pub message: Option<String>,
4201    /// Optional progress percentage to display (value 100 is considered 100%).
4202    /// If not provided infinite progress is assumed and clients are allowed
4203    /// to ignore the `percentage` value in subsequent in report notifications.
4204    ///
4205    /// The value should be steadily rising. Clients are free to ignore values
4206    /// that are not following this rule. The value range is [0, 100].
4207    #[serde(skip_serializing_if = "Option::is_none")]
4208    pub percentage: Option<u32>,
4209}
4210#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
4211#[serde(rename_all = "camelCase")]
4212struct ShadowWorkDoneProgressBegin {
4213    /// Mandatory title of the progress operation. Used to briefly inform about
4214    /// the kind of operation being performed.
4215    ///
4216    /// Examples: "Indexing" or "Linking dependencies".
4217    pub title: String,
4218    /// Controls if a cancel button should show to allow the user to cancel the
4219    /// long running operation. Clients that don't support cancellation are allowed
4220    /// to ignore the setting.
4221    #[serde(skip_serializing_if = "Option::is_none")]
4222    pub cancellable: Option<bool>,
4223    /// Optional, more detailed associated progress message. Contains
4224    /// complementary information to the `title`.
4225    ///
4226    /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
4227    /// If unset, the previous progress message (if any) is still valid.
4228    #[serde(skip_serializing_if = "Option::is_none")]
4229    pub message: Option<String>,
4230    /// Optional progress percentage to display (value 100 is considered 100%).
4231    /// If not provided infinite progress is assumed and clients are allowed
4232    /// to ignore the `percentage` value in subsequent in report notifications.
4233    ///
4234    /// The value should be steadily rising. Clients are free to ignore values
4235    /// that are not following this rule. The value range is [0, 100].
4236    #[serde(skip_serializing_if = "Option::is_none")]
4237    pub percentage: Option<u32>,
4238    pub kind: String,
4239}
4240impl TryFrom<ShadowWorkDoneProgressBegin> for WorkDoneProgressBegin {
4241    type Error = String;
4242    fn try_from(shadow: ShadowWorkDoneProgressBegin) -> Result<Self, Self::Error> {
4243        if shadow.kind != "begin" {
4244            return Err(format!("Invalid value for prop kind: {}", shadow.kind));
4245        }
4246        Ok(Self {
4247            title: shadow.title,
4248            cancellable: shadow.cancellable,
4249            message: shadow.message,
4250            percentage: shadow.percentage,
4251        })
4252    }
4253}
4254impl From<WorkDoneProgressBegin> for ShadowWorkDoneProgressBegin {
4255    fn from(original: WorkDoneProgressBegin) -> Self {
4256        Self {
4257            title: original.title,
4258            cancellable: original.cancellable,
4259            message: original.message,
4260            percentage: original.percentage,
4261            kind: "begin".to_string(),
4262        }
4263    }
4264}
4265impl WorkDoneProgressBegin {
4266    #[must_use]
4267    pub const fn new(
4268        title: String,
4269        cancellable: Option<bool>,
4270        message: Option<String>,
4271        percentage: Option<u32>,
4272    ) -> Self {
4273        Self {
4274            title,
4275            cancellable,
4276            message,
4277            percentage,
4278        }
4279    }
4280}
4281
4282#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
4283#[serde(rename_all = "camelCase")]
4284#[serde(
4285    try_from = "ShadowWorkDoneProgressReport",
4286    into = "ShadowWorkDoneProgressReport"
4287)]
4288pub struct WorkDoneProgressReport {
4289    /// Controls enablement state of a cancel button.
4290    ///
4291    /// Clients that don't support cancellation or don't support controlling the button's
4292    /// enablement state are allowed to ignore the property.
4293    #[serde(skip_serializing_if = "Option::is_none")]
4294    pub cancellable: Option<bool>,
4295    /// Optional, more detailed associated progress message. Contains
4296    /// complementary information to the `title`.
4297    ///
4298    /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
4299    /// If unset, the previous progress message (if any) is still valid.
4300    #[serde(skip_serializing_if = "Option::is_none")]
4301    pub message: Option<String>,
4302    /// Optional progress percentage to display (value 100 is considered 100%).
4303    /// If not provided infinite progress is assumed and clients are allowed
4304    /// to ignore the `percentage` value in subsequent in report notifications.
4305    ///
4306    /// The value should be steadily rising. Clients are free to ignore values
4307    /// that are not following this rule. The value range is [0, 100]
4308    #[serde(skip_serializing_if = "Option::is_none")]
4309    pub percentage: Option<u32>,
4310}
4311#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
4312#[serde(rename_all = "camelCase")]
4313struct ShadowWorkDoneProgressReport {
4314    /// Controls enablement state of a cancel button.
4315    ///
4316    /// Clients that don't support cancellation or don't support controlling the button's
4317    /// enablement state are allowed to ignore the property.
4318    #[serde(skip_serializing_if = "Option::is_none")]
4319    pub cancellable: Option<bool>,
4320    /// Optional, more detailed associated progress message. Contains
4321    /// complementary information to the `title`.
4322    ///
4323    /// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
4324    /// If unset, the previous progress message (if any) is still valid.
4325    #[serde(skip_serializing_if = "Option::is_none")]
4326    pub message: Option<String>,
4327    /// Optional progress percentage to display (value 100 is considered 100%).
4328    /// If not provided infinite progress is assumed and clients are allowed
4329    /// to ignore the `percentage` value in subsequent in report notifications.
4330    ///
4331    /// The value should be steadily rising. Clients are free to ignore values
4332    /// that are not following this rule. The value range is [0, 100]
4333    #[serde(skip_serializing_if = "Option::is_none")]
4334    pub percentage: Option<u32>,
4335    pub kind: String,
4336}
4337impl TryFrom<ShadowWorkDoneProgressReport> for WorkDoneProgressReport {
4338    type Error = String;
4339    fn try_from(shadow: ShadowWorkDoneProgressReport) -> Result<Self, Self::Error> {
4340        if shadow.kind != "report" {
4341            return Err(format!("Invalid value for prop kind: {}", shadow.kind));
4342        }
4343        Ok(Self {
4344            cancellable: shadow.cancellable,
4345            message: shadow.message,
4346            percentage: shadow.percentage,
4347        })
4348    }
4349}
4350impl From<WorkDoneProgressReport> for ShadowWorkDoneProgressReport {
4351    fn from(original: WorkDoneProgressReport) -> Self {
4352        Self {
4353            cancellable: original.cancellable,
4354            message: original.message,
4355            percentage: original.percentage,
4356            kind: "report".to_string(),
4357        }
4358    }
4359}
4360impl WorkDoneProgressReport {
4361    #[must_use]
4362    pub const fn new(
4363        cancellable: Option<bool>,
4364        message: Option<String>,
4365        percentage: Option<u32>,
4366    ) -> Self {
4367        Self {
4368            cancellable,
4369            message,
4370            percentage,
4371        }
4372    }
4373}
4374
4375#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
4376#[serde(rename_all = "camelCase")]
4377#[serde(try_from = "ShadowWorkDoneProgressEnd", into = "ShadowWorkDoneProgressEnd")]
4378pub struct WorkDoneProgressEnd {
4379    /// Optional, a final message indicating to for example indicate the outcome
4380    /// of the operation.
4381    #[serde(skip_serializing_if = "Option::is_none")]
4382    pub message: Option<String>,
4383}
4384#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
4385#[serde(rename_all = "camelCase")]
4386struct ShadowWorkDoneProgressEnd {
4387    /// Optional, a final message indicating to for example indicate the outcome
4388    /// of the operation.
4389    #[serde(skip_serializing_if = "Option::is_none")]
4390    pub message: Option<String>,
4391    pub kind: String,
4392}
4393impl TryFrom<ShadowWorkDoneProgressEnd> for WorkDoneProgressEnd {
4394    type Error = String;
4395    fn try_from(shadow: ShadowWorkDoneProgressEnd) -> Result<Self, Self::Error> {
4396        if shadow.kind != "end" {
4397            return Err(format!("Invalid value for prop kind: {}", shadow.kind));
4398        }
4399        Ok(Self { message: shadow.message })
4400    }
4401}
4402impl From<WorkDoneProgressEnd> for ShadowWorkDoneProgressEnd {
4403    fn from(original: WorkDoneProgressEnd) -> Self {
4404        Self {
4405            message: original.message,
4406            kind: "end".to_string(),
4407        }
4408    }
4409}
4410impl WorkDoneProgressEnd {
4411    #[must_use]
4412    pub const fn new(message: Option<String>) -> Self {
4413        Self { message }
4414    }
4415}
4416
4417#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Copy)]
4418#[serde(rename_all = "camelCase")]
4419pub struct SetTraceParams {
4420    pub value: TraceValue,
4421}
4422impl SetTraceParams {
4423    #[must_use]
4424    pub const fn new(value: TraceValue) -> Self {
4425        Self { value }
4426    }
4427}
4428
4429#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
4430#[serde(rename_all = "camelCase")]
4431pub struct LogTraceParams {
4432    pub message: String,
4433    #[serde(skip_serializing_if = "Option::is_none")]
4434    pub verbose: Option<String>,
4435}
4436impl LogTraceParams {
4437    #[must_use]
4438    pub const fn new(message: String, verbose: Option<String>) -> Self {
4439        Self { message, verbose }
4440    }
4441}
4442
4443#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
4444#[serde(rename_all = "camelCase")]
4445pub struct CancelParams {
4446    /// The request id to cancel.
4447    pub id: Id,
4448}
4449impl CancelParams {
4450    #[must_use]
4451    pub const fn new(id: Id) -> Self {
4452        Self { id }
4453    }
4454}
4455
4456#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
4457#[serde(rename_all = "camelCase")]
4458pub struct ProgressParams {
4459    /// The progress token provided by the client or server.
4460    pub token: ProgressToken,
4461    /// The progress data.
4462    pub value: LspAny,
4463}
4464impl ProgressParams {
4465    #[must_use]
4466    pub const fn new(token: ProgressToken, value: LspAny) -> Self {
4467        Self { token, value }
4468    }
4469}
4470
4471/// A parameter literal used in requests to pass a text document and a position inside that
4472/// document.
4473#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
4474#[serde(rename_all = "camelCase")]
4475pub struct TextDocumentPositionParams {
4476    /// The text document.
4477    pub text_document: TextDocumentIdentifier,
4478    /// The position inside the text document.
4479    pub position: Position,
4480}
4481impl TextDocumentPositionParams {
4482    #[must_use]
4483    pub const fn new(text_document: TextDocumentIdentifier, position: Position) -> Self {
4484        Self { text_document, position }
4485    }
4486}
4487
4488#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
4489#[serde(rename_all = "camelCase")]
4490pub struct WorkDoneProgressParams {
4491    /// An optional token that a server can use to report work done progress.
4492    #[serde(skip_serializing_if = "Option::is_none")]
4493    pub work_done_token: Option<ProgressToken>,
4494}
4495impl WorkDoneProgressParams {
4496    #[must_use]
4497    pub const fn new(work_done_token: Option<ProgressToken>) -> Self {
4498        Self { work_done_token }
4499    }
4500}
4501
4502#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
4503#[serde(rename_all = "camelCase")]
4504pub struct PartialResultParams {
4505    /// An optional token that a server can use to report partial results (e.g. streaming) to
4506    /// the client.
4507    #[serde(skip_serializing_if = "Option::is_none")]
4508    pub partial_result_token: Option<ProgressToken>,
4509}
4510impl PartialResultParams {
4511    #[must_use]
4512    pub const fn new(partial_result_token: Option<ProgressToken>) -> Self {
4513        Self { partial_result_token }
4514    }
4515}
4516
4517/// Represents the connection of two locations. Provides additional metadata over normal [locations][Location],
4518/// including an origin range.
4519#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
4520#[serde(rename_all = "camelCase")]
4521pub struct LocationLink {
4522    /// Span of the origin of this link.
4523    ///
4524    /// Used as the underlined span for mouse interaction. Defaults to the word range at
4525    /// the definition position.
4526    #[serde(skip_serializing_if = "Option::is_none")]
4527    pub origin_selection_range: Option<Range>,
4528    /// The target resource identifier of this link.
4529    pub target_uri: Uri,
4530    /// The full target range of this link. If the target for example is a symbol then target range is the
4531    /// range enclosing this symbol not including leading/trailing whitespace but everything else
4532    /// like comments. This information is typically used to highlight the range in the editor.
4533    pub target_range: Range,
4534    /// The range that should be selected and revealed when this link is being followed, e.g the name of a function.
4535    /// Must be contained by the `targetRange`. See also `DocumentSymbol#range`
4536    pub target_selection_range: Range,
4537}
4538impl LocationLink {
4539    #[must_use]
4540    pub const fn new(
4541        origin_selection_range: Option<Range>,
4542        target_uri: Uri,
4543        target_range: Range,
4544        target_selection_range: Range,
4545    ) -> Self {
4546        Self {
4547            origin_selection_range,
4548            target_uri,
4549            target_range,
4550            target_selection_range,
4551        }
4552    }
4553}
4554
4555/// A range in a text document expressed as (zero-based) start and end positions.
4556///
4557/// If you want to specify a range that contains a line including the line ending
4558/// character(s) then use an end position denoting the start of the next line.
4559/// For example:
4560/// ```ts
4561/// {
4562///     start: { line: 5, character: 23 }
4563///     end : { line 6, character : 0 }
4564/// }
4565/// ```
4566#[derive(
4567    Serialize,
4568    Deserialize,
4569    PartialEq,
4570    Debug,
4571    Clone,
4572    Eq,
4573    Hash,
4574    Default,
4575    Copy,
4576    PartialOrd,
4577    Ord
4578)]
4579#[serde(rename_all = "camelCase")]
4580pub struct Range {
4581    /// The range's start position.
4582    pub start: Position,
4583    /// The range's end position.
4584    pub end: Position,
4585}
4586impl Range {
4587    #[must_use]
4588    pub const fn new(start: Position, end: Position) -> Self {
4589        Self { start, end }
4590    }
4591}
4592
4593#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
4594#[serde(rename_all = "camelCase")]
4595pub struct ImplementationOptions {
4596    #[serde(flatten)]
4597    pub work_done_progress_options: WorkDoneProgressOptions,
4598}
4599impl ImplementationOptions {
4600    #[must_use]
4601    pub const fn new(work_done_progress_options: WorkDoneProgressOptions) -> Self {
4602        Self { work_done_progress_options }
4603    }
4604}
4605
4606/// Static registration options to be returned in the initialize
4607/// request.
4608#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
4609#[serde(rename_all = "camelCase")]
4610pub struct StaticRegistrationOptions {
4611    /// The id used to register the request. The id can be used to deregister
4612    /// the request again. See also Registration#id.
4613    #[serde(skip_serializing_if = "Option::is_none")]
4614    pub id: Option<String>,
4615}
4616impl StaticRegistrationOptions {
4617    #[must_use]
4618    pub const fn new(id: Option<String>) -> Self {
4619        Self { id }
4620    }
4621}
4622
4623#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
4624#[serde(rename_all = "camelCase")]
4625pub struct TypeDefinitionOptions {
4626    #[serde(flatten)]
4627    pub work_done_progress_options: WorkDoneProgressOptions,
4628}
4629impl TypeDefinitionOptions {
4630    #[must_use]
4631    pub const fn new(work_done_progress_options: WorkDoneProgressOptions) -> Self {
4632        Self { work_done_progress_options }
4633    }
4634}
4635
4636/// The workspace folder change event.
4637#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
4638#[serde(rename_all = "camelCase")]
4639pub struct WorkspaceFoldersChangeEvent {
4640    /// The array of added workspace folders
4641    pub added: Vec<WorkspaceFolder>,
4642    /// The array of the removed workspace folders
4643    pub removed: Vec<WorkspaceFolder>,
4644}
4645impl WorkspaceFoldersChangeEvent {
4646    #[must_use]
4647    pub const fn new(
4648        added: Vec<WorkspaceFolder>,
4649        removed: Vec<WorkspaceFolder>,
4650    ) -> Self {
4651        Self { added, removed }
4652    }
4653}
4654
4655#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
4656#[serde(rename_all = "camelCase")]
4657pub struct ConfigurationItem {
4658    /// The scope to get the configuration section for.
4659    #[serde(skip_serializing_if = "Option::is_none")]
4660    pub scope_uri: Option<Uri>,
4661    /// The configuration section asked for.
4662    #[serde(skip_serializing_if = "Option::is_none")]
4663    pub section: Option<String>,
4664}
4665impl ConfigurationItem {
4666    #[must_use]
4667    pub const fn new(scope_uri: Option<Uri>, section: Option<String>) -> Self {
4668        Self { scope_uri, section }
4669    }
4670}
4671
4672/// A literal to identify a text document in the client.
4673#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
4674#[serde(rename_all = "camelCase")]
4675pub struct TextDocumentIdentifier {
4676    /// The text document's uri.
4677    pub uri: Uri,
4678}
4679impl TextDocumentIdentifier {
4680    #[must_use]
4681    pub const fn new(uri: Uri) -> Self {
4682        Self { uri }
4683    }
4684}
4685
4686/// Represents a color in RGBA space.
4687#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Default, Copy)]
4688#[serde(rename_all = "camelCase")]
4689pub struct Color {
4690    /// The red component of this color in the range [0-1].
4691    pub red: f32,
4692    /// The green component of this color in the range [0-1].
4693    pub green: f32,
4694    /// The blue component of this color in the range [0-1].
4695    pub blue: f32,
4696    /// The alpha component of this color in the range [0-1].
4697    pub alpha: f32,
4698}
4699impl Color {
4700    #[must_use]
4701    pub const fn new(red: f32, green: f32, blue: f32, alpha: f32) -> Self {
4702        Self { red, green, blue, alpha }
4703    }
4704}
4705
4706#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
4707#[serde(rename_all = "camelCase")]
4708pub struct DocumentColorOptions {
4709    #[serde(flatten)]
4710    pub work_done_progress_options: WorkDoneProgressOptions,
4711}
4712impl DocumentColorOptions {
4713    #[must_use]
4714    pub const fn new(work_done_progress_options: WorkDoneProgressOptions) -> Self {
4715        Self { work_done_progress_options }
4716    }
4717}
4718
4719#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
4720#[serde(rename_all = "camelCase")]
4721pub struct FoldingRangeOptions {
4722    #[serde(flatten)]
4723    pub work_done_progress_options: WorkDoneProgressOptions,
4724}
4725impl FoldingRangeOptions {
4726    #[must_use]
4727    pub const fn new(work_done_progress_options: WorkDoneProgressOptions) -> Self {
4728        Self { work_done_progress_options }
4729    }
4730}
4731
4732#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
4733#[serde(rename_all = "camelCase")]
4734pub struct DeclarationOptions {
4735    #[serde(flatten)]
4736    pub work_done_progress_options: WorkDoneProgressOptions,
4737}
4738impl DeclarationOptions {
4739    #[must_use]
4740    pub const fn new(work_done_progress_options: WorkDoneProgressOptions) -> Self {
4741        Self { work_done_progress_options }
4742    }
4743}
4744
4745/// Position in a text document expressed as zero-based line and character
4746/// offset. Prior to 3.17 the offsets were always based on a UTF-16 string
4747/// representation. So a string of the form `a𐐀b` the character offset of the
4748/// character `a` is 0, the character offset of `𐐀` is 1 and the character
4749/// offset of b is 3 since `𐐀` is represented using two code units in UTF-16.
4750/// Since 3.17 clients and servers can agree on a different string encoding
4751/// representation (e.g. UTF-8). The client announces it's supported encoding
4752/// via the client capability [`general.positionEncodings`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#clientCapabilities).
4753/// The value is an array of position encodings the client supports, with
4754/// decreasing preference (e.g. the encoding at index `0` is the most preferred
4755/// one). To stay backwards compatible the only mandatory encoding is UTF-16
4756/// represented via the string `utf-16`. The server can pick one of the
4757/// encodings offered by the client and signals that encoding back to the
4758/// client via the initialize result's property
4759/// [`capabilities.positionEncoding`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#serverCapabilities). If the string value
4760/// `utf-16` is missing from the client's capability `general.positionEncodings`
4761/// servers can safely assume that the client supports UTF-16. If the server
4762/// omits the position encoding in its initialize result the encoding defaults
4763/// to the string value `utf-16`. Implementation considerations: since the
4764/// conversion from one encoding into another requires the content of the
4765/// file / line the conversion is best done where the file is read which is
4766/// usually on the server side.
4767///
4768/// Positions are line end character agnostic. So you can not specify a position
4769/// that denotes `\r|\n` or `\n|` where `|` represents the character offset.
4770///
4771/// @since 3.17.0 - support for negotiated position encoding.
4772#[derive(
4773    Serialize,
4774    Deserialize,
4775    PartialEq,
4776    Debug,
4777    Clone,
4778    Eq,
4779    Hash,
4780    Default,
4781    Copy,
4782    PartialOrd,
4783    Ord
4784)]
4785#[serde(rename_all = "camelCase")]
4786pub struct Position {
4787    /// Line position in a document (zero-based).
4788    pub line: u32,
4789    /// Character offset on a line in a document (zero-based).
4790    ///
4791    /// The meaning of this offset is determined by the negotiated
4792    /// `PositionEncodingKind`.
4793    pub character: u32,
4794}
4795impl Position {
4796    #[must_use]
4797    pub const fn new(line: u32, character: u32) -> Self {
4798        Self { line, character }
4799    }
4800}
4801
4802#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
4803#[serde(rename_all = "camelCase")]
4804pub struct SelectionRangeOptions {
4805    #[serde(flatten)]
4806    pub work_done_progress_options: WorkDoneProgressOptions,
4807}
4808impl SelectionRangeOptions {
4809    #[must_use]
4810    pub const fn new(work_done_progress_options: WorkDoneProgressOptions) -> Self {
4811        Self { work_done_progress_options }
4812    }
4813}
4814
4815/// Call hierarchy options used during static registration.
4816///
4817/// @since 3.16.0
4818#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
4819#[serde(rename_all = "camelCase")]
4820pub struct CallHierarchyOptions {
4821    #[serde(flatten)]
4822    pub work_done_progress_options: WorkDoneProgressOptions,
4823}
4824impl CallHierarchyOptions {
4825    #[must_use]
4826    pub const fn new(work_done_progress_options: WorkDoneProgressOptions) -> Self {
4827        Self { work_done_progress_options }
4828    }
4829}
4830
4831/// @since 3.16.0
4832#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
4833#[serde(rename_all = "camelCase")]
4834pub struct SemanticTokensOptions {
4835    /// The legend used by the server
4836    pub legend: SemanticTokensLegend,
4837    /// Server supports providing semantic tokens for a specific range
4838    /// of a document.
4839    #[serde(skip_serializing_if = "Option::is_none")]
4840    pub range: Option<SemanticTokensOptionsRange>,
4841    /// Server supports providing semantic tokens for a full document.
4842    #[serde(skip_serializing_if = "Option::is_none")]
4843    pub full: Option<Full>,
4844    #[serde(flatten)]
4845    pub work_done_progress_options: WorkDoneProgressOptions,
4846}
4847impl SemanticTokensOptions {
4848    #[must_use]
4849    pub const fn new(
4850        legend: SemanticTokensLegend,
4851        range: Option<SemanticTokensOptionsRange>,
4852        full: Option<Full>,
4853        work_done_progress_options: WorkDoneProgressOptions,
4854    ) -> Self {
4855        Self {
4856            legend,
4857            range,
4858            full,
4859            work_done_progress_options,
4860        }
4861    }
4862}
4863
4864/// @since 3.16.0
4865#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
4866#[serde(rename_all = "camelCase")]
4867pub struct SemanticTokensEdit {
4868    /// The start offset of the edit.
4869    pub start: u32,
4870    /// The count of elements to remove.
4871    pub delete_count: u32,
4872    /// The elements to insert.
4873    #[serde(
4874        default,
4875        skip_serializing_if = "Option::is_none",
4876        deserialize_with = "SemanticToken::deserialize_optional_tokens",
4877        serialize_with = "SemanticToken::serialize_optional_tokens"
4878    )]
4879    pub data: Option<Vec<SemanticToken>>,
4880}
4881impl SemanticTokensEdit {
4882    #[must_use]
4883    pub const fn new(
4884        start: u32,
4885        delete_count: u32,
4886        data: Option<Vec<SemanticToken>>,
4887    ) -> Self {
4888        Self { start, delete_count, data }
4889    }
4890}
4891
4892#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
4893#[serde(rename_all = "camelCase")]
4894pub struct LinkedEditingRangeOptions {
4895    #[serde(flatten)]
4896    pub work_done_progress_options: WorkDoneProgressOptions,
4897}
4898impl LinkedEditingRangeOptions {
4899    #[must_use]
4900    pub const fn new(work_done_progress_options: WorkDoneProgressOptions) -> Self {
4901        Self { work_done_progress_options }
4902    }
4903}
4904
4905/// Represents information on a file/folder create.
4906///
4907/// @since 3.16.0
4908#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
4909#[serde(rename_all = "camelCase")]
4910pub struct FileCreate {
4911    /// A file:// URI for the location of the file/folder being created.
4912    pub uri: String,
4913}
4914impl FileCreate {
4915    #[must_use]
4916    pub const fn new(uri: String) -> Self {
4917        Self { uri }
4918    }
4919}
4920
4921/// Describes textual changes on a text document. A TextDocumentEdit describes all changes
4922/// on a document version Si and after they are applied move the document to version Si+1.
4923/// So the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any
4924/// kind of ordering. However the edits must be non overlapping.
4925#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
4926#[serde(rename_all = "camelCase")]
4927pub struct TextDocumentEdit {
4928    /// The text document to change.
4929    pub text_document: OptionalVersionedTextDocumentIdentifier,
4930    /// The edits to be applied.
4931    ///
4932    /// @since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a
4933    /// client capability.
4934    ///
4935    /// @since 3.18.0 - support for SnippetTextEdit. This is guarded using a
4936    /// client capability.
4937    pub edits: Vec<Edit>,
4938}
4939impl TextDocumentEdit {
4940    #[must_use]
4941    pub const fn new(
4942        text_document: OptionalVersionedTextDocumentIdentifier,
4943        edits: Vec<Edit>,
4944    ) -> Self {
4945        Self { text_document, edits }
4946    }
4947}
4948
4949/// Create file operation.
4950#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
4951#[serde(rename_all = "camelCase")]
4952#[serde(try_from = "ShadowCreateFile", into = "ShadowCreateFile")]
4953pub struct CreateFile {
4954    /// The resource to create.
4955    pub uri: Uri,
4956    /// Additional options
4957    #[serde(skip_serializing_if = "Option::is_none")]
4958    pub options: Option<CreateFileOptions>,
4959    /// An optional annotation identifier describing the operation.
4960    ///
4961    /// @since 3.16.0
4962    #[serde(skip_serializing_if = "Option::is_none")]
4963    pub annotation_id: Option<ChangeAnnotationIdentifier>,
4964}
4965#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
4966#[serde(rename_all = "camelCase")]
4967struct ShadowCreateFile {
4968    /// The resource to create.
4969    pub uri: Uri,
4970    /// Additional options
4971    #[serde(skip_serializing_if = "Option::is_none")]
4972    pub options: Option<CreateFileOptions>,
4973    /// An optional annotation identifier describing the operation.
4974    ///
4975    /// @since 3.16.0
4976    #[serde(skip_serializing_if = "Option::is_none")]
4977    pub annotation_id: Option<ChangeAnnotationIdentifier>,
4978    pub kind: String,
4979}
4980impl TryFrom<ShadowCreateFile> for CreateFile {
4981    type Error = String;
4982    fn try_from(shadow: ShadowCreateFile) -> Result<Self, Self::Error> {
4983        if shadow.kind != "create" {
4984            return Err(format!("Invalid value for prop kind: {}", shadow.kind));
4985        }
4986        Ok(Self {
4987            uri: shadow.uri,
4988            options: shadow.options,
4989            annotation_id: shadow.annotation_id,
4990        })
4991    }
4992}
4993impl From<CreateFile> for ShadowCreateFile {
4994    fn from(original: CreateFile) -> Self {
4995        Self {
4996            uri: original.uri,
4997            options: original.options,
4998            annotation_id: original.annotation_id,
4999            kind: "create".to_string(),
5000        }
5001    }
5002}
5003impl CreateFile {
5004    #[must_use]
5005    pub const fn new(
5006        uri: Uri,
5007        options: Option<CreateFileOptions>,
5008        annotation_id: Option<ChangeAnnotationIdentifier>,
5009    ) -> Self {
5010        Self {
5011            uri,
5012            options,
5013            annotation_id,
5014        }
5015    }
5016}
5017
5018/// Rename file operation
5019#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
5020#[serde(rename_all = "camelCase")]
5021#[serde(try_from = "ShadowRenameFile", into = "ShadowRenameFile")]
5022pub struct RenameFile {
5023    /// The old (existing) location.
5024    pub old_uri: Uri,
5025    /// The new location.
5026    pub new_uri: Uri,
5027    /// Rename options.
5028    #[serde(skip_serializing_if = "Option::is_none")]
5029    pub options: Option<RenameFileOptions>,
5030    /// An optional annotation identifier describing the operation.
5031    ///
5032    /// @since 3.16.0
5033    #[serde(skip_serializing_if = "Option::is_none")]
5034    pub annotation_id: Option<ChangeAnnotationIdentifier>,
5035}
5036#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
5037#[serde(rename_all = "camelCase")]
5038struct ShadowRenameFile {
5039    /// The old (existing) location.
5040    pub old_uri: Uri,
5041    /// The new location.
5042    pub new_uri: Uri,
5043    /// Rename options.
5044    #[serde(skip_serializing_if = "Option::is_none")]
5045    pub options: Option<RenameFileOptions>,
5046    /// An optional annotation identifier describing the operation.
5047    ///
5048    /// @since 3.16.0
5049    #[serde(skip_serializing_if = "Option::is_none")]
5050    pub annotation_id: Option<ChangeAnnotationIdentifier>,
5051    pub kind: String,
5052}
5053impl TryFrom<ShadowRenameFile> for RenameFile {
5054    type Error = String;
5055    fn try_from(shadow: ShadowRenameFile) -> Result<Self, Self::Error> {
5056        if shadow.kind != "rename" {
5057            return Err(format!("Invalid value for prop kind: {}", shadow.kind));
5058        }
5059        Ok(Self {
5060            old_uri: shadow.old_uri,
5061            new_uri: shadow.new_uri,
5062            options: shadow.options,
5063            annotation_id: shadow.annotation_id,
5064        })
5065    }
5066}
5067impl From<RenameFile> for ShadowRenameFile {
5068    fn from(original: RenameFile) -> Self {
5069        Self {
5070            old_uri: original.old_uri,
5071            new_uri: original.new_uri,
5072            options: original.options,
5073            annotation_id: original.annotation_id,
5074            kind: "rename".to_string(),
5075        }
5076    }
5077}
5078impl RenameFile {
5079    #[must_use]
5080    pub const fn new(
5081        old_uri: Uri,
5082        new_uri: Uri,
5083        options: Option<RenameFileOptions>,
5084        annotation_id: Option<ChangeAnnotationIdentifier>,
5085    ) -> Self {
5086        Self {
5087            old_uri,
5088            new_uri,
5089            options,
5090            annotation_id,
5091        }
5092    }
5093}
5094
5095/// Delete file operation
5096#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
5097#[serde(rename_all = "camelCase")]
5098#[serde(try_from = "ShadowDeleteFile", into = "ShadowDeleteFile")]
5099pub struct DeleteFile {
5100    /// The file to delete.
5101    pub uri: Uri,
5102    /// Delete options.
5103    #[serde(skip_serializing_if = "Option::is_none")]
5104    pub options: Option<DeleteFileOptions>,
5105    /// An optional annotation identifier describing the operation.
5106    ///
5107    /// @since 3.16.0
5108    #[serde(skip_serializing_if = "Option::is_none")]
5109    pub annotation_id: Option<ChangeAnnotationIdentifier>,
5110}
5111#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
5112#[serde(rename_all = "camelCase")]
5113struct ShadowDeleteFile {
5114    /// The file to delete.
5115    pub uri: Uri,
5116    /// Delete options.
5117    #[serde(skip_serializing_if = "Option::is_none")]
5118    pub options: Option<DeleteFileOptions>,
5119    /// An optional annotation identifier describing the operation.
5120    ///
5121    /// @since 3.16.0
5122    #[serde(skip_serializing_if = "Option::is_none")]
5123    pub annotation_id: Option<ChangeAnnotationIdentifier>,
5124    pub kind: String,
5125}
5126impl TryFrom<ShadowDeleteFile> for DeleteFile {
5127    type Error = String;
5128    fn try_from(shadow: ShadowDeleteFile) -> Result<Self, Self::Error> {
5129        if shadow.kind != "delete" {
5130            return Err(format!("Invalid value for prop kind: {}", shadow.kind));
5131        }
5132        Ok(Self {
5133            uri: shadow.uri,
5134            options: shadow.options,
5135            annotation_id: shadow.annotation_id,
5136        })
5137    }
5138}
5139impl From<DeleteFile> for ShadowDeleteFile {
5140    fn from(original: DeleteFile) -> Self {
5141        Self {
5142            uri: original.uri,
5143            options: original.options,
5144            annotation_id: original.annotation_id,
5145            kind: "delete".to_string(),
5146        }
5147    }
5148}
5149impl DeleteFile {
5150    #[must_use]
5151    pub const fn new(
5152        uri: Uri,
5153        options: Option<DeleteFileOptions>,
5154        annotation_id: Option<ChangeAnnotationIdentifier>,
5155    ) -> Self {
5156        Self {
5157            uri,
5158            options,
5159            annotation_id,
5160        }
5161    }
5162}
5163
5164/// Additional information that describes document changes.
5165///
5166/// @since 3.16.0
5167#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
5168#[serde(rename_all = "camelCase")]
5169pub struct ChangeAnnotation {
5170    /// A human-readable string describing the actual change. The string
5171    /// is rendered prominent in the user interface.
5172    pub label: String,
5173    /// A flag which indicates that user confirmation is needed
5174    /// before applying the change.
5175    #[serde(skip_serializing_if = "Option::is_none")]
5176    pub needs_confirmation: Option<bool>,
5177    /// A human-readable string which is rendered less prominent in
5178    /// the user interface.
5179    #[serde(skip_serializing_if = "Option::is_none")]
5180    pub description: Option<String>,
5181}
5182impl ChangeAnnotation {
5183    #[must_use]
5184    pub const fn new(
5185        label: String,
5186        needs_confirmation: Option<bool>,
5187        description: Option<String>,
5188    ) -> Self {
5189        Self {
5190            label,
5191            needs_confirmation,
5192            description,
5193        }
5194    }
5195}
5196
5197/// A filter to describe in which file operation requests or notifications
5198/// the server is interested in receiving.
5199///
5200/// @since 3.16.0
5201#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
5202#[serde(rename_all = "camelCase")]
5203pub struct FileOperationFilter {
5204    /// A Uri scheme like `file` or `untitled`.
5205    #[serde(skip_serializing_if = "Option::is_none")]
5206    pub scheme: Option<String>,
5207    /// The actual file operation pattern.
5208    pub pattern: FileOperationPattern,
5209}
5210impl FileOperationFilter {
5211    #[must_use]
5212    pub const fn new(scheme: Option<String>, pattern: FileOperationPattern) -> Self {
5213        Self { scheme, pattern }
5214    }
5215}
5216
5217/// Represents information on a file/folder rename.
5218///
5219/// @since 3.16.0
5220#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
5221#[serde(rename_all = "camelCase")]
5222pub struct FileRename {
5223    /// A file:// URI for the original location of the file/folder being renamed.
5224    pub old_uri: String,
5225    /// A file:// URI for the new location of the file/folder being renamed.
5226    pub new_uri: String,
5227}
5228impl FileRename {
5229    #[must_use]
5230    pub const fn new(old_uri: String, new_uri: String) -> Self {
5231        Self { old_uri, new_uri }
5232    }
5233}
5234
5235/// Represents information on a file/folder delete.
5236///
5237/// @since 3.16.0
5238#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
5239#[serde(rename_all = "camelCase")]
5240pub struct FileDelete {
5241    /// A file:// URI for the location of the file/folder being deleted.
5242    pub uri: String,
5243}
5244impl FileDelete {
5245    #[must_use]
5246    pub const fn new(uri: String) -> Self {
5247        Self { uri }
5248    }
5249}
5250
5251#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
5252#[serde(rename_all = "camelCase")]
5253pub struct MonikerOptions {
5254    #[serde(flatten)]
5255    pub work_done_progress_options: WorkDoneProgressOptions,
5256}
5257impl MonikerOptions {
5258    #[must_use]
5259    pub const fn new(work_done_progress_options: WorkDoneProgressOptions) -> Self {
5260        Self { work_done_progress_options }
5261    }
5262}
5263
5264/// Type hierarchy options used during static registration.
5265///
5266/// @since 3.17.0
5267#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
5268#[serde(rename_all = "camelCase")]
5269pub struct TypeHierarchyOptions {
5270    #[serde(flatten)]
5271    pub work_done_progress_options: WorkDoneProgressOptions,
5272}
5273impl TypeHierarchyOptions {
5274    #[must_use]
5275    pub const fn new(work_done_progress_options: WorkDoneProgressOptions) -> Self {
5276        Self { work_done_progress_options }
5277    }
5278}
5279
5280/// @since 3.17.0
5281#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
5282#[serde(rename_all = "camelCase")]
5283pub struct InlineValueContext {
5284    /// The stack frame (as a DAP Id) where the execution has stopped.
5285    pub frame_id: i32,
5286    /// The document range where execution has stopped.
5287    /// Typically the end position of the range denotes the line where the inline values are shown.
5288    pub stopped_location: Range,
5289}
5290impl InlineValueContext {
5291    #[must_use]
5292    pub const fn new(frame_id: i32, stopped_location: Range) -> Self {
5293        Self { frame_id, stopped_location }
5294    }
5295}
5296
5297/// Provide inline value as text.
5298///
5299/// @since 3.17.0
5300#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
5301#[serde(rename_all = "camelCase")]
5302pub struct InlineValueText {
5303    /// The document range for which the inline value applies.
5304    pub range: Range,
5305    /// The text of the inline value.
5306    pub text: String,
5307}
5308impl InlineValueText {
5309    #[must_use]
5310    pub const fn new(range: Range, text: String) -> Self {
5311        Self { range, text }
5312    }
5313}
5314
5315/// Provide inline value through a variable lookup.
5316/// If only a range is specified, the variable name will be extracted from the underlying document.
5317/// An optional variable name can be used to override the extracted name.
5318///
5319/// @since 3.17.0
5320#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
5321#[serde(rename_all = "camelCase")]
5322pub struct InlineValueVariableLookup {
5323    /// The document range for which the inline value applies.
5324    /// The range is used to extract the variable name from the underlying document.
5325    pub range: Range,
5326    /// If specified the name of the variable to look up.
5327    #[serde(skip_serializing_if = "Option::is_none")]
5328    pub variable_name: Option<String>,
5329    /// How to perform the lookup.
5330    pub case_sensitive_lookup: bool,
5331}
5332impl InlineValueVariableLookup {
5333    #[must_use]
5334    pub const fn new(
5335        range: Range,
5336        variable_name: Option<String>,
5337        case_sensitive_lookup: bool,
5338    ) -> Self {
5339        Self {
5340            range,
5341            variable_name,
5342            case_sensitive_lookup,
5343        }
5344    }
5345}
5346
5347/// Provide an inline value through an expression evaluation.
5348/// If only a range is specified, the expression will be extracted from the underlying document.
5349/// An optional expression can be used to override the extracted expression.
5350///
5351/// @since 3.17.0
5352#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
5353#[serde(rename_all = "camelCase")]
5354pub struct InlineValueEvaluatableExpression {
5355    /// The document range for which the inline value applies.
5356    /// The range is used to extract the evaluatable expression from the underlying document.
5357    pub range: Range,
5358    /// If specified the expression overrides the extracted expression.
5359    #[serde(skip_serializing_if = "Option::is_none")]
5360    pub expression: Option<String>,
5361}
5362impl InlineValueEvaluatableExpression {
5363    #[must_use]
5364    pub const fn new(range: Range, expression: Option<String>) -> Self {
5365        Self { range, expression }
5366    }
5367}
5368
5369/// Inline value options used during static registration.
5370///
5371/// @since 3.17.0
5372#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
5373#[serde(rename_all = "camelCase")]
5374pub struct InlineValueOptions {
5375    #[serde(flatten)]
5376    pub work_done_progress_options: WorkDoneProgressOptions,
5377}
5378impl InlineValueOptions {
5379    #[must_use]
5380    pub const fn new(work_done_progress_options: WorkDoneProgressOptions) -> Self {
5381        Self { work_done_progress_options }
5382    }
5383}
5384
5385/// An inlay hint label part allows for interactive and composite labels
5386/// of inlay hints.
5387///
5388/// @since 3.17.0
5389#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
5390#[serde(rename_all = "camelCase")]
5391pub struct InlayHintLabelPart {
5392    /// The value of this label part.
5393    pub value: String,
5394    /// The tooltip text when you hover over this label part. Depending on
5395    /// the client capability `inlayHint.resolveSupport` clients might resolve
5396    /// this property late using the resolve request.
5397    #[serde(skip_serializing_if = "Option::is_none")]
5398    pub tooltip: Option<Tooltip>,
5399    /// An optional source code location that represents this
5400    /// label part.
5401    ///
5402    /// The editor will use this location for the hover and for code navigation
5403    /// features: This part will become a clickable link that resolves to the
5404    /// definition of the symbol at the given location (not necessarily the
5405    /// location itself), it shows the hover that shows at the given location,
5406    /// and it shows a context menu with further code navigation commands.
5407    ///
5408    /// Depending on the client capability `inlayHint.resolveSupport` clients
5409    /// might resolve this property late using the resolve request.
5410    #[serde(skip_serializing_if = "Option::is_none")]
5411    pub location: Option<Location>,
5412    /// An optional command for this label part.
5413    ///
5414    /// Depending on the client capability `inlayHint.resolveSupport` clients
5415    /// might resolve this property late using the resolve request.
5416    #[serde(skip_serializing_if = "Option::is_none")]
5417    pub command: Option<Command>,
5418}
5419impl InlayHintLabelPart {
5420    #[must_use]
5421    pub const fn new(
5422        value: String,
5423        tooltip: Option<Tooltip>,
5424        location: Option<Location>,
5425        command: Option<Command>,
5426    ) -> Self {
5427        Self {
5428            value,
5429            tooltip,
5430            location,
5431            command,
5432        }
5433    }
5434}
5435
5436/// A `MarkupContent` literal represents a string value which content is interpreted base on its
5437/// kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds.
5438///
5439/// If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues.
5440/// See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
5441///
5442/// Here is an example how such a string can be constructed using JavaScript / TypeScript:
5443/// ```ts
5444/// let markdown: MarkdownContent = {
5445///  kind: MarkupKind.Markdown,
5446///  value: [
5447///    '# Header',
5448///    'Some text',
5449///    '```typescript',
5450///    'someCode();',
5451///    '```'
5452///  ].join('\n')
5453/// };
5454/// ```
5455///
5456/// *Please Note* that clients might sanitize the return markdown. A client could decide to
5457/// remove HTML from the markdown to avoid script execution.
5458#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
5459#[serde(rename_all = "camelCase")]
5460pub struct MarkupContent {
5461    /// The type of the Markup
5462    pub kind: MarkupKind,
5463    /// The content itself
5464    pub value: String,
5465}
5466impl MarkupContent {
5467    #[must_use]
5468    pub const fn new(kind: MarkupKind, value: String) -> Self {
5469        Self { kind, value }
5470    }
5471}
5472
5473/// Inlay hint options used during static registration.
5474///
5475/// @since 3.17.0
5476#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
5477#[serde(rename_all = "camelCase")]
5478pub struct InlayHintOptions {
5479    /// The server provides support to resolve additional
5480    /// information for an inlay hint item.
5481    #[serde(skip_serializing_if = "Option::is_none")]
5482    pub resolve_provider: Option<bool>,
5483    #[serde(flatten)]
5484    pub work_done_progress_options: WorkDoneProgressOptions,
5485}
5486impl InlayHintOptions {
5487    #[must_use]
5488    pub const fn new(
5489        resolve_provider: Option<bool>,
5490        work_done_progress_options: WorkDoneProgressOptions,
5491    ) -> Self {
5492        Self {
5493            resolve_provider,
5494            work_done_progress_options,
5495        }
5496    }
5497}
5498
5499/// A full diagnostic report with a set of related documents.
5500///
5501/// @since 3.17.0
5502#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
5503#[serde(rename_all = "camelCase")]
5504pub struct RelatedFullDocumentDiagnosticReport {
5505    /// Diagnostics of related documents. This information is useful
5506    /// in programming languages where code in a file A can generate
5507    /// diagnostics in a file B which A depends on. An example of
5508    /// such a language is C/C++ where marco definitions in a file
5509    /// a.cpp and result in errors in a header file b.hpp.
5510    ///
5511    /// @since 3.17.0
5512    #[serde(skip_serializing_if = "Option::is_none")]
5513    pub related_documents: Option<HashMap<Uri, RelatedDocument>>,
5514    #[serde(flatten)]
5515    pub full_document_diagnostic_report: FullDocumentDiagnosticReport,
5516}
5517impl RelatedFullDocumentDiagnosticReport {
5518    #[must_use]
5519    pub const fn new(
5520        related_documents: Option<HashMap<Uri, RelatedDocument>>,
5521        full_document_diagnostic_report: FullDocumentDiagnosticReport,
5522    ) -> Self {
5523        Self {
5524            related_documents,
5525            full_document_diagnostic_report,
5526        }
5527    }
5528}
5529
5530/// An unchanged diagnostic report with a set of related documents.
5531///
5532/// @since 3.17.0
5533#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
5534#[serde(rename_all = "camelCase")]
5535pub struct RelatedUnchangedDocumentDiagnosticReport {
5536    /// Diagnostics of related documents. This information is useful
5537    /// in programming languages where code in a file A can generate
5538    /// diagnostics in a file B which A depends on. An example of
5539    /// such a language is C/C++ where marco definitions in a file
5540    /// a.cpp and result in errors in a header file b.hpp.
5541    ///
5542    /// @since 3.17.0
5543    #[serde(skip_serializing_if = "Option::is_none")]
5544    pub related_documents: Option<HashMap<Uri, RelatedDocument>>,
5545    #[serde(flatten)]
5546    pub unchanged_document_diagnostic_report: UnchangedDocumentDiagnosticReport,
5547}
5548impl RelatedUnchangedDocumentDiagnosticReport {
5549    #[must_use]
5550    pub const fn new(
5551        related_documents: Option<HashMap<Uri, RelatedDocument>>,
5552        unchanged_document_diagnostic_report: UnchangedDocumentDiagnosticReport,
5553    ) -> Self {
5554        Self {
5555            related_documents,
5556            unchanged_document_diagnostic_report,
5557        }
5558    }
5559}
5560
5561/// A diagnostic report with a full set of problems.
5562///
5563/// @since 3.17.0
5564#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
5565#[serde(rename_all = "camelCase")]
5566#[serde(
5567    try_from = "ShadowFullDocumentDiagnosticReport",
5568    into = "ShadowFullDocumentDiagnosticReport"
5569)]
5570pub struct FullDocumentDiagnosticReport {
5571    /// An optional result id. If provided it will
5572    /// be sent on the next diagnostic request for the
5573    /// same document.
5574    #[serde(skip_serializing_if = "Option::is_none")]
5575    pub result_id: Option<String>,
5576    /// The actual items.
5577    pub items: Vec<Diagnostic>,
5578}
5579#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
5580#[serde(rename_all = "camelCase")]
5581struct ShadowFullDocumentDiagnosticReport {
5582    /// An optional result id. If provided it will
5583    /// be sent on the next diagnostic request for the
5584    /// same document.
5585    #[serde(skip_serializing_if = "Option::is_none")]
5586    pub result_id: Option<String>,
5587    /// The actual items.
5588    pub items: Vec<Diagnostic>,
5589    pub kind: String,
5590}
5591impl TryFrom<ShadowFullDocumentDiagnosticReport> for FullDocumentDiagnosticReport {
5592    type Error = String;
5593    fn try_from(
5594        shadow: ShadowFullDocumentDiagnosticReport,
5595    ) -> Result<Self, Self::Error> {
5596        if shadow.kind != "full" {
5597            return Err(format!("Invalid value for prop kind: {}", shadow.kind));
5598        }
5599        Ok(Self {
5600            result_id: shadow.result_id,
5601            items: shadow.items,
5602        })
5603    }
5604}
5605impl From<FullDocumentDiagnosticReport> for ShadowFullDocumentDiagnosticReport {
5606    fn from(original: FullDocumentDiagnosticReport) -> Self {
5607        Self {
5608            result_id: original.result_id,
5609            items: original.items,
5610            kind: "full".to_string(),
5611        }
5612    }
5613}
5614impl FullDocumentDiagnosticReport {
5615    #[must_use]
5616    pub const fn new(result_id: Option<String>, items: Vec<Diagnostic>) -> Self {
5617        Self { result_id, items }
5618    }
5619}
5620
5621/// A diagnostic report indicating that the last returned
5622/// report is still accurate.
5623///
5624/// @since 3.17.0
5625#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
5626#[serde(rename_all = "camelCase")]
5627#[serde(
5628    try_from = "ShadowUnchangedDocumentDiagnosticReport",
5629    into = "ShadowUnchangedDocumentDiagnosticReport"
5630)]
5631pub struct UnchangedDocumentDiagnosticReport {
5632    /// A result id which will be sent on the next
5633    /// diagnostic request for the same document.
5634    pub result_id: String,
5635}
5636#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
5637#[serde(rename_all = "camelCase")]
5638struct ShadowUnchangedDocumentDiagnosticReport {
5639    /// A result id which will be sent on the next
5640    /// diagnostic request for the same document.
5641    pub result_id: String,
5642    pub kind: String,
5643}
5644impl TryFrom<ShadowUnchangedDocumentDiagnosticReport>
5645for UnchangedDocumentDiagnosticReport {
5646    type Error = String;
5647    fn try_from(
5648        shadow: ShadowUnchangedDocumentDiagnosticReport,
5649    ) -> Result<Self, Self::Error> {
5650        if shadow.kind != "unchanged" {
5651            return Err(format!("Invalid value for prop kind: {}", shadow.kind));
5652        }
5653        Ok(Self {
5654            result_id: shadow.result_id,
5655        })
5656    }
5657}
5658impl From<UnchangedDocumentDiagnosticReport>
5659for ShadowUnchangedDocumentDiagnosticReport {
5660    fn from(original: UnchangedDocumentDiagnosticReport) -> Self {
5661        Self {
5662            result_id: original.result_id,
5663            kind: "unchanged".to_string(),
5664        }
5665    }
5666}
5667impl UnchangedDocumentDiagnosticReport {
5668    #[must_use]
5669    pub const fn new(result_id: String) -> Self {
5670        Self { result_id }
5671    }
5672}
5673
5674/// Diagnostic options.
5675///
5676/// @since 3.17.0
5677#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
5678#[serde(rename_all = "camelCase")]
5679pub struct DiagnosticOptions {
5680    /// An optional identifier under which the diagnostics are
5681    /// managed by the client.
5682    #[serde(skip_serializing_if = "Option::is_none")]
5683    pub identifier: Option<String>,
5684    /// Whether the language has inter file dependencies meaning that
5685    /// editing code in one file can result in a different diagnostic
5686    /// set in another file. Inter file dependencies are common for
5687    /// most programming languages and typically uncommon for linters.
5688    pub inter_file_dependencies: bool,
5689    /// The server provides support for workspace diagnostics as well.
5690    pub workspace_diagnostics: bool,
5691    #[serde(flatten)]
5692    pub work_done_progress_options: WorkDoneProgressOptions,
5693}
5694impl DiagnosticOptions {
5695    #[must_use]
5696    pub const fn new(
5697        identifier: Option<String>,
5698        inter_file_dependencies: bool,
5699        workspace_diagnostics: bool,
5700        work_done_progress_options: WorkDoneProgressOptions,
5701    ) -> Self {
5702        Self {
5703            identifier,
5704            inter_file_dependencies,
5705            workspace_diagnostics,
5706            work_done_progress_options,
5707        }
5708    }
5709}
5710
5711/// A previous result id in a workspace pull request.
5712///
5713/// @since 3.17.0
5714#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
5715#[serde(rename_all = "camelCase")]
5716pub struct PreviousResultId {
5717    /// The URI for which the client knowns a
5718    /// result id.
5719    pub uri: Uri,
5720    /// The value of the previous result id.
5721    pub value: String,
5722}
5723impl PreviousResultId {
5724    #[must_use]
5725    pub const fn new(uri: Uri, value: String) -> Self {
5726        Self { uri, value }
5727    }
5728}
5729
5730/// A notebook document.
5731///
5732/// @since 3.17.0
5733#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
5734#[serde(rename_all = "camelCase")]
5735pub struct NotebookDocument {
5736    /// The notebook document's uri.
5737    pub uri: Uri,
5738    /// The type of the notebook.
5739    pub notebook_type: String,
5740    /// The version number of this document (it will increase after each
5741    /// change, including undo/redo).
5742    pub version: i32,
5743    /// Additional metadata stored with the notebook
5744    /// document.
5745    ///
5746    /// Note: should always be an object literal (e.g. LSPObject)
5747    #[serde(skip_serializing_if = "Option::is_none")]
5748    pub metadata: Option<LspObject>,
5749    /// The cells of a notebook.
5750    pub cells: Vec<NotebookCell>,
5751}
5752impl NotebookDocument {
5753    #[must_use]
5754    pub const fn new(
5755        uri: Uri,
5756        notebook_type: String,
5757        version: i32,
5758        metadata: Option<LspObject>,
5759        cells: Vec<NotebookCell>,
5760    ) -> Self {
5761        Self {
5762            uri,
5763            notebook_type,
5764            version,
5765            metadata,
5766            cells,
5767        }
5768    }
5769}
5770
5771/// An item to transfer a text document from the client to the
5772/// server.
5773#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
5774#[serde(rename_all = "camelCase")]
5775pub struct TextDocumentItem {
5776    /// The text document's uri.
5777    pub uri: Uri,
5778    /// The text document's language identifier.
5779    pub language_id: LanguageKind,
5780    /// The version number of this document (it will increase after each
5781    /// change, including undo/redo).
5782    pub version: i32,
5783    /// The content of the opened text document.
5784    pub text: String,
5785}
5786impl TextDocumentItem {
5787    #[must_use]
5788    pub const fn new(
5789        uri: Uri,
5790        language_id: LanguageKind,
5791        version: i32,
5792        text: String,
5793    ) -> Self {
5794        Self {
5795            uri,
5796            language_id,
5797            version,
5798            text,
5799        }
5800    }
5801}
5802
5803/// Options specific to a notebook plus its cells
5804/// to be synced to the server.
5805///
5806/// If a selector provides a notebook document
5807/// filter but no cell selector all cells of a
5808/// matching notebook document will be synced.
5809///
5810/// If a selector provides no notebook document
5811/// filter but only a cell selector all notebook
5812/// document that contain at least one matching
5813/// cell will be synced.
5814///
5815/// @since 3.17.0
5816#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
5817#[serde(rename_all = "camelCase")]
5818pub struct NotebookDocumentSyncOptions {
5819    /// The notebooks to be synced
5820    pub notebook_selector: Vec<NotebookSelector>,
5821    /// Whether save notification should be forwarded to
5822    /// the server. Will only be honored if mode === `notebook`.
5823    #[serde(skip_serializing_if = "Option::is_none")]
5824    pub save: Option<bool>,
5825}
5826impl NotebookDocumentSyncOptions {
5827    #[must_use]
5828    pub const fn new(
5829        notebook_selector: Vec<NotebookSelector>,
5830        save: Option<bool>,
5831    ) -> Self {
5832        Self { notebook_selector, save }
5833    }
5834}
5835
5836/// A versioned notebook document identifier.
5837///
5838/// @since 3.17.0
5839#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
5840#[serde(rename_all = "camelCase")]
5841pub struct VersionedNotebookDocumentIdentifier {
5842    /// The version number of this notebook document.
5843    pub version: i32,
5844    /// The notebook document's uri.
5845    pub uri: Uri,
5846}
5847impl VersionedNotebookDocumentIdentifier {
5848    #[must_use]
5849    pub const fn new(version: i32, uri: Uri) -> Self {
5850        Self { version, uri }
5851    }
5852}
5853
5854/// A change event for a notebook document.
5855///
5856/// @since 3.17.0
5857#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
5858#[serde(rename_all = "camelCase")]
5859pub struct NotebookDocumentChangeEvent {
5860    /// The changed meta data if any.
5861    ///
5862    /// Note: should always be an object literal (e.g. LSPObject)
5863    #[serde(skip_serializing_if = "Option::is_none")]
5864    pub metadata: Option<LspObject>,
5865    /// Changes to cells
5866    #[serde(skip_serializing_if = "Option::is_none")]
5867    pub cells: Option<NotebookDocumentCellChanges>,
5868}
5869impl NotebookDocumentChangeEvent {
5870    #[must_use]
5871    pub const fn new(
5872        metadata: Option<LspObject>,
5873        cells: Option<NotebookDocumentCellChanges>,
5874    ) -> Self {
5875        Self { metadata, cells }
5876    }
5877}
5878
5879/// A literal to identify a notebook document in the client.
5880///
5881/// @since 3.17.0
5882#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
5883#[serde(rename_all = "camelCase")]
5884pub struct NotebookDocumentIdentifier {
5885    /// The notebook document's uri.
5886    pub uri: Uri,
5887}
5888impl NotebookDocumentIdentifier {
5889    #[must_use]
5890    pub const fn new(uri: Uri) -> Self {
5891        Self { uri }
5892    }
5893}
5894
5895/// Provides information about the context in which an inline completion was requested.
5896///
5897/// @since 3.18.0
5898/// @proposed
5899#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
5900#[serde(rename_all = "camelCase")]
5901pub struct InlineCompletionContext {
5902    /// Describes how the inline completion was triggered.
5903    pub trigger_kind: InlineCompletionTriggerKind,
5904    /// Provides information about the currently selected item in the autocomplete widget if it is visible.
5905    #[serde(skip_serializing_if = "Option::is_none")]
5906    pub selected_completion_info: Option<SelectedCompletionInfo>,
5907}
5908impl InlineCompletionContext {
5909    #[must_use]
5910    pub const fn new(
5911        trigger_kind: InlineCompletionTriggerKind,
5912        selected_completion_info: Option<SelectedCompletionInfo>,
5913    ) -> Self {
5914        Self {
5915            trigger_kind,
5916            selected_completion_info,
5917        }
5918    }
5919}
5920
5921/// A string value used as a snippet is a template which allows to insert text
5922/// and to control the editor cursor when insertion happens.
5923///
5924/// A snippet can define tab stops and placeholders with `$1`, `$2`
5925/// and `${3:foo}`. `$0` defines the final tab stop, it defaults to
5926/// the end of the snippet. Variables are defined with `$name` and
5927/// `${name:default value}`.
5928///
5929/// @since 3.18.0
5930/// @proposed
5931#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
5932#[serde(rename_all = "camelCase")]
5933#[serde(try_from = "ShadowStringValue", into = "ShadowStringValue")]
5934pub struct StringValue {
5935    /// The snippet string.
5936    pub value: String,
5937}
5938#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
5939#[serde(rename_all = "camelCase")]
5940struct ShadowStringValue {
5941    /// The snippet string.
5942    pub value: String,
5943    pub kind: String,
5944}
5945impl TryFrom<ShadowStringValue> for StringValue {
5946    type Error = String;
5947    fn try_from(shadow: ShadowStringValue) -> Result<Self, Self::Error> {
5948        if shadow.kind != "snippet" {
5949            return Err(format!("Invalid value for prop kind: {}", shadow.kind));
5950        }
5951        Ok(Self { value: shadow.value })
5952    }
5953}
5954impl From<StringValue> for ShadowStringValue {
5955    fn from(original: StringValue) -> Self {
5956        Self {
5957            value: original.value,
5958            kind: "snippet".to_string(),
5959        }
5960    }
5961}
5962impl StringValue {
5963    #[must_use]
5964    pub const fn new(value: String) -> Self {
5965        Self { value }
5966    }
5967}
5968
5969/// Inline completion options used during static registration.
5970///
5971/// @since 3.18.0
5972/// @proposed
5973#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
5974#[serde(rename_all = "camelCase")]
5975pub struct InlineCompletionOptions {
5976    #[serde(flatten)]
5977    pub work_done_progress_options: WorkDoneProgressOptions,
5978}
5979impl InlineCompletionOptions {
5980    #[must_use]
5981    pub const fn new(work_done_progress_options: WorkDoneProgressOptions) -> Self {
5982        Self { work_done_progress_options }
5983    }
5984}
5985
5986/// Text document content provider options.
5987///
5988/// @since 3.18.0
5989/// @proposed
5990#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
5991#[serde(rename_all = "camelCase")]
5992pub struct TextDocumentContentOptions {
5993    /// The schemes for which the server provides content.
5994    pub schemes: Vec<String>,
5995}
5996impl TextDocumentContentOptions {
5997    #[must_use]
5998    pub const fn new(schemes: Vec<String>) -> Self {
5999        Self { schemes }
6000    }
6001}
6002
6003/// General parameters to register for a notification or to register a provider.
6004#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
6005#[serde(rename_all = "camelCase")]
6006pub struct Registration {
6007    /// The id used to register the request. The id can be used to deregister
6008    /// the request again.
6009    pub id: String,
6010    /// The method / capability to register for.
6011    pub method: String,
6012    /// Options necessary for the registration.
6013    #[serde(skip_serializing_if = "Option::is_none")]
6014    pub register_options: Option<LspAny>,
6015}
6016impl Registration {
6017    #[must_use]
6018    pub const fn new(
6019        id: String,
6020        method: String,
6021        register_options: Option<LspAny>,
6022    ) -> Self {
6023        Self {
6024            id,
6025            method,
6026            register_options,
6027        }
6028    }
6029}
6030
6031/// General parameters to unregister a request or notification.
6032#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
6033#[serde(rename_all = "camelCase")]
6034pub struct Unregistration {
6035    /// The id used to unregister the request or notification. Usually an id
6036    /// provided during the register request.
6037    pub id: String,
6038    /// The method to unregister for.
6039    pub method: String,
6040}
6041impl Unregistration {
6042    #[must_use]
6043    pub const fn new(id: String, method: String) -> Self {
6044        Self { id, method }
6045    }
6046}
6047
6048#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
6049#[serde(rename_all = "camelCase")]
6050pub struct WorkspaceFoldersInitializeParams {
6051    /// The workspace folders configured in the client when the server starts.
6052    ///
6053    /// This property is only available if the client supports workspace folders.
6054    /// It can be `null` if the client supports workspace folders but none are
6055    /// configured.
6056    ///
6057    /// @since 3.6.0
6058    #[serde(default, deserialize_with = "deserialize_some")]
6059    #[serde(skip_serializing_if = "Option::is_none")]
6060    pub workspace_folders: Option<WorkspaceFolders>,
6061}
6062impl WorkspaceFoldersInitializeParams {
6063    #[must_use]
6064    pub const fn new(workspace_folders: Option<WorkspaceFolders>) -> Self {
6065        Self { workspace_folders }
6066    }
6067}
6068
6069/// Defines the capabilities provided by a language
6070/// server.
6071#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
6072#[serde(rename_all = "camelCase")]
6073pub struct ServerCapabilities {
6074    /// The position encoding the server picked from the encodings offered
6075    /// by the client via the client capability `general.positionEncodings`.
6076    ///
6077    /// If the client didn't provide any position encodings the only valid
6078    /// value that a server can return is 'utf-16'.
6079    ///
6080    /// If omitted it defaults to 'utf-16'.
6081    ///
6082    /// @since 3.17.0
6083    #[serde(skip_serializing_if = "Option::is_none")]
6084    pub position_encoding: Option<PositionEncodingKind>,
6085    /// Defines how text documents are synced. Is either a detailed structure
6086    /// defining each notification or for backwards compatibility the
6087    /// TextDocumentSyncKind number.
6088    #[serde(skip_serializing_if = "Option::is_none")]
6089    pub text_document_sync: Option<TextDocumentSync>,
6090    /// Defines how notebook documents are synced.
6091    ///
6092    /// @since 3.17.0
6093    #[serde(skip_serializing_if = "Option::is_none")]
6094    pub notebook_document_sync: Option<NotebookDocumentSync>,
6095    /// The server provides completion support.
6096    #[serde(skip_serializing_if = "Option::is_none")]
6097    pub completion_provider: Option<CompletionOptions>,
6098    /// The server provides hover support.
6099    #[serde(skip_serializing_if = "Option::is_none")]
6100    pub hover_provider: Option<HoverProvider>,
6101    /// The server provides signature help support.
6102    #[serde(skip_serializing_if = "Option::is_none")]
6103    pub signature_help_provider: Option<SignatureHelpOptions>,
6104    /// The server provides Goto Declaration support.
6105    #[serde(skip_serializing_if = "Option::is_none")]
6106    pub declaration_provider: Option<DeclarationProvider>,
6107    /// The server provides goto definition support.
6108    #[serde(skip_serializing_if = "Option::is_none")]
6109    pub definition_provider: Option<DefinitionProvider>,
6110    /// The server provides Goto Type Definition support.
6111    #[serde(skip_serializing_if = "Option::is_none")]
6112    pub type_definition_provider: Option<TypeDefinitionProvider>,
6113    /// The server provides Goto Implementation support.
6114    #[serde(skip_serializing_if = "Option::is_none")]
6115    pub implementation_provider: Option<ImplementationProvider>,
6116    /// The server provides find references support.
6117    #[serde(skip_serializing_if = "Option::is_none")]
6118    pub references_provider: Option<ReferencesProvider>,
6119    /// The server provides document highlight support.
6120    #[serde(skip_serializing_if = "Option::is_none")]
6121    pub document_highlight_provider: Option<DocumentHighlightProvider>,
6122    /// The server provides document symbol support.
6123    #[serde(skip_serializing_if = "Option::is_none")]
6124    pub document_symbol_provider: Option<DocumentSymbolProvider>,
6125    /// The server provides code actions. CodeActionOptions may only be
6126    /// specified if the client states that it supports
6127    /// `codeActionLiteralSupport` in its initial `initialize` request.
6128    #[serde(skip_serializing_if = "Option::is_none")]
6129    pub code_action_provider: Option<CodeActionProvider>,
6130    /// The server provides code lens.
6131    #[serde(skip_serializing_if = "Option::is_none")]
6132    pub code_lens_provider: Option<CodeLensOptions>,
6133    /// The server provides document link support.
6134    #[serde(skip_serializing_if = "Option::is_none")]
6135    pub document_link_provider: Option<DocumentLinkOptions>,
6136    /// The server provides color provider support.
6137    #[serde(skip_serializing_if = "Option::is_none")]
6138    pub color_provider: Option<ColorProvider>,
6139    /// The server provides workspace symbol support.
6140    #[serde(skip_serializing_if = "Option::is_none")]
6141    pub workspace_symbol_provider: Option<WorkspaceSymbolProvider>,
6142    /// The server provides document formatting.
6143    #[serde(skip_serializing_if = "Option::is_none")]
6144    pub document_formatting_provider: Option<DocumentFormattingProvider>,
6145    /// The server provides document range formatting.
6146    #[serde(skip_serializing_if = "Option::is_none")]
6147    pub document_range_formatting_provider: Option<DocumentRangeFormattingProvider>,
6148    /// The server provides document formatting on typing.
6149    #[serde(skip_serializing_if = "Option::is_none")]
6150    pub document_on_type_formatting_provider: Option<DocumentOnTypeFormattingOptions>,
6151    /// The server provides rename support. RenameOptions may only be
6152    /// specified if the client states that it supports
6153    /// `prepareSupport` in its initial `initialize` request.
6154    #[serde(skip_serializing_if = "Option::is_none")]
6155    pub rename_provider: Option<RenameProvider>,
6156    /// The server provides folding provider support.
6157    #[serde(skip_serializing_if = "Option::is_none")]
6158    pub folding_range_provider: Option<FoldingRangeProvider>,
6159    /// The server provides selection range support.
6160    #[serde(skip_serializing_if = "Option::is_none")]
6161    pub selection_range_provider: Option<SelectionRangeProvider>,
6162    /// The server provides execute command support.
6163    #[serde(skip_serializing_if = "Option::is_none")]
6164    pub execute_command_provider: Option<ExecuteCommandOptions>,
6165    /// The server provides call hierarchy support.
6166    ///
6167    /// @since 3.16.0
6168    #[serde(skip_serializing_if = "Option::is_none")]
6169    pub call_hierarchy_provider: Option<CallHierarchyProvider>,
6170    /// The server provides linked editing range support.
6171    ///
6172    /// @since 3.16.0
6173    #[serde(skip_serializing_if = "Option::is_none")]
6174    pub linked_editing_range_provider: Option<LinkedEditingRangeProvider>,
6175    /// The server provides semantic tokens support.
6176    ///
6177    /// @since 3.16.0
6178    #[serde(skip_serializing_if = "Option::is_none")]
6179    pub semantic_tokens_provider: Option<SemanticTokensProvider>,
6180    /// The server provides moniker support.
6181    ///
6182    /// @since 3.16.0
6183    #[serde(skip_serializing_if = "Option::is_none")]
6184    pub moniker_provider: Option<MonikerProvider>,
6185    /// The server provides type hierarchy support.
6186    ///
6187    /// @since 3.17.0
6188    #[serde(skip_serializing_if = "Option::is_none")]
6189    pub type_hierarchy_provider: Option<TypeHierarchyProvider>,
6190    /// The server provides inline values.
6191    ///
6192    /// @since 3.17.0
6193    #[serde(skip_serializing_if = "Option::is_none")]
6194    pub inline_value_provider: Option<InlineValueProvider>,
6195    /// The server provides inlay hints.
6196    ///
6197    /// @since 3.17.0
6198    #[serde(skip_serializing_if = "Option::is_none")]
6199    pub inlay_hint_provider: Option<InlayHintProvider>,
6200    /// The server has support for pull model diagnostics.
6201    ///
6202    /// @since 3.17.0
6203    #[serde(skip_serializing_if = "Option::is_none")]
6204    pub diagnostic_provider: Option<DiagnosticProvider>,
6205    /// Inline completion options used during static registration.
6206    ///
6207    /// @since 3.18.0
6208    /// @proposed
6209    #[serde(skip_serializing_if = "Option::is_none")]
6210    pub inline_completion_provider: Option<InlineCompletionProvider>,
6211    /// Workspace specific server capabilities.
6212    #[serde(skip_serializing_if = "Option::is_none")]
6213    pub workspace: Option<WorkspaceOptions>,
6214    /// Experimental server capabilities.
6215    #[serde(skip_serializing_if = "Option::is_none")]
6216    pub experimental: Option<LspAny>,
6217}
6218impl ServerCapabilities {
6219    #[must_use]
6220    pub const fn new(
6221        position_encoding: Option<PositionEncodingKind>,
6222        text_document_sync: Option<TextDocumentSync>,
6223        notebook_document_sync: Option<NotebookDocumentSync>,
6224        completion_provider: Option<CompletionOptions>,
6225        hover_provider: Option<HoverProvider>,
6226        signature_help_provider: Option<SignatureHelpOptions>,
6227        declaration_provider: Option<DeclarationProvider>,
6228        definition_provider: Option<DefinitionProvider>,
6229        type_definition_provider: Option<TypeDefinitionProvider>,
6230        implementation_provider: Option<ImplementationProvider>,
6231        references_provider: Option<ReferencesProvider>,
6232        document_highlight_provider: Option<DocumentHighlightProvider>,
6233        document_symbol_provider: Option<DocumentSymbolProvider>,
6234        code_action_provider: Option<CodeActionProvider>,
6235        code_lens_provider: Option<CodeLensOptions>,
6236        document_link_provider: Option<DocumentLinkOptions>,
6237        color_provider: Option<ColorProvider>,
6238        workspace_symbol_provider: Option<WorkspaceSymbolProvider>,
6239        document_formatting_provider: Option<DocumentFormattingProvider>,
6240        document_range_formatting_provider: Option<DocumentRangeFormattingProvider>,
6241        document_on_type_formatting_provider: Option<DocumentOnTypeFormattingOptions>,
6242        rename_provider: Option<RenameProvider>,
6243        folding_range_provider: Option<FoldingRangeProvider>,
6244        selection_range_provider: Option<SelectionRangeProvider>,
6245        execute_command_provider: Option<ExecuteCommandOptions>,
6246        call_hierarchy_provider: Option<CallHierarchyProvider>,
6247        linked_editing_range_provider: Option<LinkedEditingRangeProvider>,
6248        semantic_tokens_provider: Option<SemanticTokensProvider>,
6249        moniker_provider: Option<MonikerProvider>,
6250        type_hierarchy_provider: Option<TypeHierarchyProvider>,
6251        inline_value_provider: Option<InlineValueProvider>,
6252        inlay_hint_provider: Option<InlayHintProvider>,
6253        diagnostic_provider: Option<DiagnosticProvider>,
6254        inline_completion_provider: Option<InlineCompletionProvider>,
6255        workspace: Option<WorkspaceOptions>,
6256        experimental: Option<LspAny>,
6257    ) -> Self {
6258        Self {
6259            position_encoding,
6260            text_document_sync,
6261            notebook_document_sync,
6262            completion_provider,
6263            hover_provider,
6264            signature_help_provider,
6265            declaration_provider,
6266            definition_provider,
6267            type_definition_provider,
6268            implementation_provider,
6269            references_provider,
6270            document_highlight_provider,
6271            document_symbol_provider,
6272            code_action_provider,
6273            code_lens_provider,
6274            document_link_provider,
6275            color_provider,
6276            workspace_symbol_provider,
6277            document_formatting_provider,
6278            document_range_formatting_provider,
6279            document_on_type_formatting_provider,
6280            rename_provider,
6281            folding_range_provider,
6282            selection_range_provider,
6283            execute_command_provider,
6284            call_hierarchy_provider,
6285            linked_editing_range_provider,
6286            semantic_tokens_provider,
6287            moniker_provider,
6288            type_hierarchy_provider,
6289            inline_value_provider,
6290            inlay_hint_provider,
6291            diagnostic_provider,
6292            inline_completion_provider,
6293            workspace,
6294            experimental,
6295        }
6296    }
6297}
6298
6299/// Information about the server
6300///
6301/// @since 3.15.0
6302/// @since 3.18.0 ServerInfo type name added.
6303#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
6304#[serde(rename_all = "camelCase")]
6305pub struct ServerInfo {
6306    /// The name of the server as defined by the server.
6307    pub name: String,
6308    /// The server's version as defined by the server.
6309    #[serde(skip_serializing_if = "Option::is_none")]
6310    pub version: Option<String>,
6311}
6312impl ServerInfo {
6313    #[must_use]
6314    pub const fn new(name: String, version: Option<String>) -> Self {
6315        Self { name, version }
6316    }
6317}
6318
6319/// A text document identifier to denote a specific version of a text document.
6320#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
6321#[serde(rename_all = "camelCase")]
6322pub struct VersionedTextDocumentIdentifier {
6323    /// The version number of this document.
6324    pub version: i32,
6325    #[serde(flatten)]
6326    pub text_document_identifier: TextDocumentIdentifier,
6327}
6328impl VersionedTextDocumentIdentifier {
6329    #[must_use]
6330    pub const fn new(
6331        version: i32,
6332        text_document_identifier: TextDocumentIdentifier,
6333    ) -> Self {
6334        Self {
6335            version,
6336            text_document_identifier,
6337        }
6338    }
6339}
6340
6341/// Save options.
6342#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
6343#[serde(rename_all = "camelCase")]
6344pub struct SaveOptions {
6345    /// The client is supposed to include the content on save.
6346    #[serde(skip_serializing_if = "Option::is_none")]
6347    pub include_text: Option<bool>,
6348}
6349impl SaveOptions {
6350    #[must_use]
6351    pub const fn new(include_text: Option<bool>) -> Self {
6352        Self { include_text }
6353    }
6354}
6355
6356/// An event describing a file change.
6357#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
6358#[serde(rename_all = "camelCase")]
6359pub struct FileEvent {
6360    /// The file's uri.
6361    pub uri: Uri,
6362    /// The change type.
6363    #[serde(rename = "type")]
6364    pub kind: FileChangeType,
6365}
6366impl FileEvent {
6367    #[must_use]
6368    pub const fn new(uri: Uri, kind: FileChangeType) -> Self {
6369        Self { uri, kind }
6370    }
6371}
6372
6373#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
6374#[serde(rename_all = "camelCase")]
6375pub struct FileSystemWatcher {
6376    /// The glob pattern to watch. See [glob pattern][GlobPattern] for more detail.
6377    ///
6378    /// @since 3.17.0 support for relative patterns.
6379    pub glob_pattern: GlobPattern,
6380    /// The kind of events of interest. If omitted it defaults
6381    /// to WatchKind.Create | WatchKind.Change | WatchKind.Delete
6382    /// which is 7.
6383    #[serde(skip_serializing_if = "Option::is_none")]
6384    pub kind: Option<WatchKind>,
6385}
6386impl FileSystemWatcher {
6387    #[must_use]
6388    pub const fn new(glob_pattern: GlobPattern, kind: Option<WatchKind>) -> Self {
6389        Self { glob_pattern, kind }
6390    }
6391}
6392
6393/// Represents a diagnostic, such as a compiler error or warning. Diagnostic objects
6394/// are only valid in the scope of a resource.
6395#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
6396#[serde(rename_all = "camelCase")]
6397pub struct Diagnostic {
6398    /// The range at which the message applies
6399    pub range: Range,
6400    /// The diagnostic's severity. To avoid interpretation mismatches when a
6401    /// server is used with different clients it is highly recommended that servers
6402    /// always provide a severity value.
6403    #[serde(skip_serializing_if = "Option::is_none")]
6404    pub severity: Option<DiagnosticSeverity>,
6405    /// The diagnostic's code, which usually appear in the user interface.
6406    #[serde(skip_serializing_if = "Option::is_none")]
6407    pub code: Option<Code>,
6408    /// An optional property to describe the error code.
6409    /// Requires the code field (above) to be present/not null.
6410    ///
6411    /// @since 3.16.0
6412    #[serde(skip_serializing_if = "Option::is_none")]
6413    pub code_description: Option<CodeDescription>,
6414    /// A human-readable string describing the source of this
6415    /// diagnostic, e.g. 'typescript' or 'super lint'. It usually
6416    /// appears in the user interface.
6417    #[serde(skip_serializing_if = "Option::is_none")]
6418    pub source: Option<String>,
6419    /// The diagnostic's message. It usually appears in the user interface.
6420    ///
6421    /// @since 3.18.0 - support for MarkupContent. This is guarded by the client
6422    /// capability `textDocument.diagnostic.markupMessageSupport`.
6423    pub message: Message,
6424    /// Additional metadata about the diagnostic.
6425    ///
6426    /// @since 3.15.0
6427    #[serde(skip_serializing_if = "Option::is_none")]
6428    pub tags: Option<Vec<DiagnosticTag>>,
6429    /// An array of related diagnostic information, e.g. when symbol-names within
6430    /// a scope collide all definitions can be marked via this property.
6431    #[serde(skip_serializing_if = "Option::is_none")]
6432    pub related_information: Option<Vec<DiagnosticRelatedInformation>>,
6433    /// A data entry field that is preserved between a `textDocument/publishDiagnostics`
6434    /// notification and `textDocument/codeAction` request.
6435    ///
6436    /// @since 3.16.0
6437    #[serde(skip_serializing_if = "Option::is_none")]
6438    pub data: Option<LspAny>,
6439}
6440impl Diagnostic {
6441    #[must_use]
6442    pub const fn new(
6443        range: Range,
6444        severity: Option<DiagnosticSeverity>,
6445        code: Option<Code>,
6446        code_description: Option<CodeDescription>,
6447        source: Option<String>,
6448        message: Message,
6449        tags: Option<Vec<DiagnosticTag>>,
6450        related_information: Option<Vec<DiagnosticRelatedInformation>>,
6451        data: Option<LspAny>,
6452    ) -> Self {
6453        Self {
6454            range,
6455            severity,
6456            code,
6457            code_description,
6458            source,
6459            message,
6460            tags,
6461            related_information,
6462            data,
6463        }
6464    }
6465}
6466
6467/// Contains additional information about the context in which a completion request is triggered.
6468#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
6469#[serde(rename_all = "camelCase")]
6470pub struct CompletionContext {
6471    /// How the completion was triggered.
6472    pub trigger_kind: CompletionTriggerKind,
6473    /// The trigger character (a single character) that has trigger code complete.
6474    /// Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`
6475    #[serde(skip_serializing_if = "Option::is_none")]
6476    pub trigger_character: Option<String>,
6477}
6478impl CompletionContext {
6479    #[must_use]
6480    pub const fn new(
6481        trigger_kind: CompletionTriggerKind,
6482        trigger_character: Option<String>,
6483    ) -> Self {
6484        Self {
6485            trigger_kind,
6486            trigger_character,
6487        }
6488    }
6489}
6490
6491/// Additional details for a completion item label.
6492///
6493/// @since 3.17.0
6494#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
6495#[serde(rename_all = "camelCase")]
6496pub struct CompletionItemLabelDetails {
6497    /// An optional string which is rendered less prominently directly after [label][`CompletionItem::label`],
6498    /// without any spacing. Should be used for function signatures and type annotations.
6499    #[serde(skip_serializing_if = "Option::is_none")]
6500    pub detail: Option<String>,
6501    /// An optional string which is rendered less prominently after [`CompletionItem::detail`]. Should be used
6502    /// for fully qualified names and file paths.
6503    #[serde(skip_serializing_if = "Option::is_none")]
6504    pub description: Option<String>,
6505}
6506impl CompletionItemLabelDetails {
6507    #[must_use]
6508    pub const fn new(detail: Option<String>, description: Option<String>) -> Self {
6509        Self { detail, description }
6510    }
6511}
6512
6513/// A special text edit to provide an insert and a replace operation.
6514///
6515/// @since 3.16.0
6516#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
6517#[serde(rename_all = "camelCase")]
6518pub struct InsertReplaceEdit {
6519    /// The string to be inserted.
6520    pub new_text: String,
6521    /// The range if the insert is requested
6522    pub insert: Range,
6523    /// The range if the replace is requested.
6524    pub replace: Range,
6525}
6526impl InsertReplaceEdit {
6527    #[must_use]
6528    pub const fn new(new_text: String, insert: Range, replace: Range) -> Self {
6529        Self { new_text, insert, replace }
6530    }
6531}
6532
6533/// In many cases the items of an actual completion result share the same
6534/// value for properties like `commitCharacters` or the range of a text
6535/// edit. A completion list can therefore define item defaults which will
6536/// be used if a completion item itself doesn't specify the value.
6537///
6538/// If a completion list specifies a default value and a completion item
6539/// also specifies a corresponding value, the rules for combining these are
6540/// defined by `applyKinds` (if the client supports it), defaulting to
6541/// ApplyKind.Replace.
6542///
6543/// Servers are only allowed to return default values if the client
6544/// signals support for this via the `completionList.itemDefaults`
6545/// capability.
6546///
6547/// @since 3.17.0
6548#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
6549#[serde(rename_all = "camelCase")]
6550pub struct CompletionItemDefaults {
6551    /// A default commit character set.
6552    ///
6553    /// @since 3.17.0
6554    #[serde(skip_serializing_if = "Option::is_none")]
6555    pub commit_characters: Option<Vec<String>>,
6556    /// A default edit range.
6557    ///
6558    /// @since 3.17.0
6559    #[serde(skip_serializing_if = "Option::is_none")]
6560    pub edit_range: Option<EditRange>,
6561    /// A default insert text format.
6562    ///
6563    /// @since 3.17.0
6564    #[serde(skip_serializing_if = "Option::is_none")]
6565    pub insert_text_format: Option<InsertTextFormat>,
6566    /// A default insert text mode.
6567    ///
6568    /// @since 3.17.0
6569    #[serde(skip_serializing_if = "Option::is_none")]
6570    pub insert_text_mode: Option<InsertTextMode>,
6571    /// A default data value.
6572    ///
6573    /// @since 3.17.0
6574    #[serde(skip_serializing_if = "Option::is_none")]
6575    pub data: Option<LspAny>,
6576}
6577impl CompletionItemDefaults {
6578    #[must_use]
6579    pub const fn new(
6580        commit_characters: Option<Vec<String>>,
6581        edit_range: Option<EditRange>,
6582        insert_text_format: Option<InsertTextFormat>,
6583        insert_text_mode: Option<InsertTextMode>,
6584        data: Option<LspAny>,
6585    ) -> Self {
6586        Self {
6587            commit_characters,
6588            edit_range,
6589            insert_text_format,
6590            insert_text_mode,
6591            data,
6592        }
6593    }
6594}
6595
6596/// Specifies how fields from a completion item should be combined with those
6597/// from `completionList.itemDefaults`.
6598///
6599/// If unspecified, all fields will be treated as ApplyKind.Replace.
6600///
6601/// If a field's value is ApplyKind.Replace, the value from a completion item (if
6602/// provided and not `null`) will always be used instead of the value from
6603/// `completionItem.itemDefaults`.
6604///
6605/// If a field's value is ApplyKind.Merge, the values will be merged using the rules
6606/// defined against each field below.
6607///
6608/// Servers are only allowed to return `applyKind` if the client
6609/// signals support for this via the `completionList.applyKindSupport`
6610/// capability.
6611///
6612/// @since 3.18.0
6613#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
6614#[serde(rename_all = "camelCase")]
6615pub struct CompletionItemApplyKinds {
6616    /// Specifies whether commitCharacters on a completion will replace or be
6617    /// merged with those in `completionList.itemDefaults.commitCharacters`.
6618    ///
6619    /// If ApplyKind.Replace, the commit characters from the completion item will
6620    /// always be used unless not provided, in which case those from
6621    /// `completionList.itemDefaults.commitCharacters` will be used. An
6622    /// empty list can be used if a completion item does not have any commit
6623    /// characters and also should not use those from
6624    /// `completionList.itemDefaults.commitCharacters`.
6625    ///
6626    /// If ApplyKind.Merge the commitCharacters for the completion will be the
6627    /// union of all values in both `completionList.itemDefaults.commitCharacters`
6628    /// and the completion's own `commitCharacters`.
6629    ///
6630    /// @since 3.18.0
6631    #[serde(skip_serializing_if = "Option::is_none")]
6632    pub commit_characters: Option<ApplyKind>,
6633    /// Specifies whether the `data` field on a completion will replace or
6634    /// be merged with data from `completionList.itemDefaults.data`.
6635    ///
6636    /// If ApplyKind.Replace, the data from the completion item will be used if
6637    /// provided (and not `null`), otherwise
6638    /// `completionList.itemDefaults.data` will be used. An empty object can
6639    /// be used if a completion item does not have any data but also should
6640    /// not use the value from `completionList.itemDefaults.data`.
6641    ///
6642    /// If ApplyKind.Merge, a shallow merge will be performed between
6643    /// `completionList.itemDefaults.data` and the completion's own data
6644    /// using the following rules:
6645    ///
6646    /// - If a completion's `data` field is not provided (or `null`), the
6647    ///   entire `data` field from `completionList.itemDefaults.data` will be
6648    ///   used as-is.
6649    /// - If a completion's `data` field is provided, each field will
6650    ///   overwrite the field of the same name in
6651    ///   `completionList.itemDefaults.data` but no merging of nested fields
6652    ///   within that value will occur.
6653    ///
6654    /// @since 3.18.0
6655    #[serde(skip_serializing_if = "Option::is_none")]
6656    pub data: Option<ApplyKind>,
6657}
6658impl CompletionItemApplyKinds {
6659    #[must_use]
6660    pub const fn new(
6661        commit_characters: Option<ApplyKind>,
6662        data: Option<ApplyKind>,
6663    ) -> Self {
6664        Self { commit_characters, data }
6665    }
6666}
6667
6668/// Completion options.
6669#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
6670#[serde(rename_all = "camelCase")]
6671pub struct CompletionOptions {
6672    /// Most tools trigger completion request automatically without explicitly requesting
6673    /// it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user
6674    /// starts to type an identifier. For example if the user types `c` in a JavaScript file
6675    /// code complete will automatically pop up present `console` besides others as a
6676    /// completion item. Characters that make up identifiers don't need to be listed here.
6677    ///
6678    /// If code complete should automatically be trigger on characters not being valid inside
6679    /// an identifier (for example `.` in JavaScript) list them in `triggerCharacters`.
6680    #[serde(skip_serializing_if = "Option::is_none")]
6681    pub trigger_characters: Option<Vec<String>>,
6682    /// The list of all possible characters that commit a completion. This field can be used
6683    /// if clients don't support individual commit characters per completion item. See
6684    /// `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport`
6685    ///
6686    /// If a server provides both `allCommitCharacters` and commit characters on an individual
6687    /// completion item the ones on the completion item win.
6688    ///
6689    /// @since 3.2.0
6690    #[serde(skip_serializing_if = "Option::is_none")]
6691    pub all_commit_characters: Option<Vec<String>>,
6692    /// The server provides support to resolve additional
6693    /// information for a completion item.
6694    #[serde(skip_serializing_if = "Option::is_none")]
6695    pub resolve_provider: Option<bool>,
6696    /// The server supports the following `CompletionItem` specific
6697    /// capabilities.
6698    ///
6699    /// @since 3.17.0
6700    #[serde(skip_serializing_if = "Option::is_none")]
6701    pub completion_item: Option<ServerCompletionItemOptions>,
6702    #[serde(flatten)]
6703    pub work_done_progress_options: WorkDoneProgressOptions,
6704}
6705impl CompletionOptions {
6706    #[must_use]
6707    pub const fn new(
6708        trigger_characters: Option<Vec<String>>,
6709        all_commit_characters: Option<Vec<String>>,
6710        resolve_provider: Option<bool>,
6711        completion_item: Option<ServerCompletionItemOptions>,
6712        work_done_progress_options: WorkDoneProgressOptions,
6713    ) -> Self {
6714        Self {
6715            trigger_characters,
6716            all_commit_characters,
6717            resolve_provider,
6718            completion_item,
6719            work_done_progress_options,
6720        }
6721    }
6722}
6723
6724/// Hover options.
6725#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
6726#[serde(rename_all = "camelCase")]
6727pub struct HoverOptions {
6728    #[serde(flatten)]
6729    pub work_done_progress_options: WorkDoneProgressOptions,
6730}
6731impl HoverOptions {
6732    #[must_use]
6733    pub const fn new(work_done_progress_options: WorkDoneProgressOptions) -> Self {
6734        Self { work_done_progress_options }
6735    }
6736}
6737
6738/// Additional information about the context in which a signature help request was triggered.
6739///
6740/// @since 3.15.0
6741#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
6742#[serde(rename_all = "camelCase")]
6743pub struct SignatureHelpContext {
6744    /// Action that caused signature help to be triggered.
6745    pub trigger_kind: SignatureHelpTriggerKind,
6746    /// Character that caused signature help to be triggered.
6747    ///
6748    /// This is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter`
6749    #[serde(skip_serializing_if = "Option::is_none")]
6750    pub trigger_character: Option<String>,
6751    /// `true` if signature help was already showing when it was triggered.
6752    ///
6753    /// Retriggers occurs when the signature help is already active and can be caused by actions such as
6754    /// typing a trigger character, a cursor move, or document content changes.
6755    pub is_retrigger: bool,
6756    /// The currently active `SignatureHelp`.
6757    ///
6758    /// The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on
6759    /// the user navigating through available signatures.
6760    #[serde(skip_serializing_if = "Option::is_none")]
6761    pub active_signature_help: Option<SignatureHelp>,
6762}
6763impl SignatureHelpContext {
6764    #[must_use]
6765    pub const fn new(
6766        trigger_kind: SignatureHelpTriggerKind,
6767        trigger_character: Option<String>,
6768        is_retrigger: bool,
6769        active_signature_help: Option<SignatureHelp>,
6770    ) -> Self {
6771        Self {
6772            trigger_kind,
6773            trigger_character,
6774            is_retrigger,
6775            active_signature_help,
6776        }
6777    }
6778}
6779
6780/// Represents the signature of something callable. A signature
6781/// can have a label, like a function-name, a doc-comment, and
6782/// a set of parameters.
6783#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
6784#[serde(rename_all = "camelCase")]
6785pub struct SignatureInformation {
6786    /// The label of this signature. Will be shown in
6787    /// the UI.
6788    pub label: String,
6789    /// The human-readable doc-comment of this signature. Will be shown
6790    /// in the UI but can be omitted.
6791    #[serde(skip_serializing_if = "Option::is_none")]
6792    pub documentation: Option<Documentation>,
6793    /// The parameters of this signature.
6794    #[serde(skip_serializing_if = "Option::is_none")]
6795    pub parameters: Option<Vec<ParameterInformation>>,
6796    /// The index of the active parameter.
6797    ///
6798    /// If `null`, no parameter of the signature is active (for example a named
6799    /// argument that does not match any declared parameters). This is only valid
6800    /// if the client specifies the client capability
6801    /// `textDocument.signatureHelp.noActiveParameterSupport === true`
6802    ///
6803    /// If provided (or `null`), this is used in place of
6804    /// `SignatureHelp.activeParameter`.
6805    ///
6806    /// @since 3.16.0
6807    #[serde(default, deserialize_with = "deserialize_some")]
6808    #[serde(skip_serializing_if = "Option::is_none")]
6809    pub active_parameter: Option<ActiveParameter>,
6810}
6811impl SignatureInformation {
6812    #[must_use]
6813    pub const fn new(
6814        label: String,
6815        documentation: Option<Documentation>,
6816        parameters: Option<Vec<ParameterInformation>>,
6817        active_parameter: Option<ActiveParameter>,
6818    ) -> Self {
6819        Self {
6820            label,
6821            documentation,
6822            parameters,
6823            active_parameter,
6824        }
6825    }
6826}
6827
6828/// Server Capabilities for a [`SignatureHelpRequest`].
6829#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
6830#[serde(rename_all = "camelCase")]
6831pub struct SignatureHelpOptions {
6832    /// List of characters that trigger signature help automatically.
6833    #[serde(skip_serializing_if = "Option::is_none")]
6834    pub trigger_characters: Option<Vec<String>>,
6835    /// List of characters that re-trigger signature help.
6836    ///
6837    /// These trigger characters are only active when signature help is already showing. All trigger characters
6838    /// are also counted as re-trigger characters.
6839    ///
6840    /// @since 3.15.0
6841    #[serde(skip_serializing_if = "Option::is_none")]
6842    pub retrigger_characters: Option<Vec<String>>,
6843    #[serde(flatten)]
6844    pub work_done_progress_options: WorkDoneProgressOptions,
6845}
6846impl SignatureHelpOptions {
6847    #[must_use]
6848    pub const fn new(
6849        trigger_characters: Option<Vec<String>>,
6850        retrigger_characters: Option<Vec<String>>,
6851        work_done_progress_options: WorkDoneProgressOptions,
6852    ) -> Self {
6853        Self {
6854            trigger_characters,
6855            retrigger_characters,
6856            work_done_progress_options,
6857        }
6858    }
6859}
6860
6861/// Server Capabilities for a [`DefinitionRequest`].
6862#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
6863#[serde(rename_all = "camelCase")]
6864pub struct DefinitionOptions {
6865    #[serde(flatten)]
6866    pub work_done_progress_options: WorkDoneProgressOptions,
6867}
6868impl DefinitionOptions {
6869    #[must_use]
6870    pub const fn new(work_done_progress_options: WorkDoneProgressOptions) -> Self {
6871        Self { work_done_progress_options }
6872    }
6873}
6874
6875/// Value-object that contains additional information when
6876/// requesting references.
6877#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
6878#[serde(rename_all = "camelCase")]
6879pub struct ReferenceContext {
6880    /// Include the declaration of the current symbol.
6881    pub include_declaration: bool,
6882}
6883impl ReferenceContext {
6884    #[must_use]
6885    pub const fn new(include_declaration: bool) -> Self {
6886        Self { include_declaration }
6887    }
6888}
6889
6890/// Reference options.
6891#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
6892#[serde(rename_all = "camelCase")]
6893pub struct ReferenceOptions {
6894    #[serde(flatten)]
6895    pub work_done_progress_options: WorkDoneProgressOptions,
6896}
6897impl ReferenceOptions {
6898    #[must_use]
6899    pub const fn new(work_done_progress_options: WorkDoneProgressOptions) -> Self {
6900        Self { work_done_progress_options }
6901    }
6902}
6903
6904/// Provider options for a [`DocumentHighlightRequest`].
6905#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
6906#[serde(rename_all = "camelCase")]
6907pub struct DocumentHighlightOptions {
6908    #[serde(flatten)]
6909    pub work_done_progress_options: WorkDoneProgressOptions,
6910}
6911impl DocumentHighlightOptions {
6912    #[must_use]
6913    pub const fn new(work_done_progress_options: WorkDoneProgressOptions) -> Self {
6914        Self { work_done_progress_options }
6915    }
6916}
6917
6918/// A base for all symbol information.
6919#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
6920#[serde(rename_all = "camelCase")]
6921pub struct BaseSymbolInformation {
6922    /// The name of this symbol.
6923    pub name: String,
6924    /// The kind of this symbol.
6925    pub kind: SymbolKind,
6926    /// Tags for this symbol.
6927    ///
6928    /// @since 3.16.0
6929    #[serde(skip_serializing_if = "Option::is_none")]
6930    pub tags: Option<Vec<SymbolTag>>,
6931    /// The name of the symbol containing this symbol. This information is for
6932    /// user interface purposes (e.g. to render a qualifier in the user interface
6933    /// if necessary). It can't be used to re-infer a hierarchy for the document
6934    /// symbols.
6935    #[serde(skip_serializing_if = "Option::is_none")]
6936    pub container_name: Option<String>,
6937}
6938impl BaseSymbolInformation {
6939    #[must_use]
6940    pub const fn new(
6941        name: String,
6942        kind: SymbolKind,
6943        tags: Option<Vec<SymbolTag>>,
6944        container_name: Option<String>,
6945    ) -> Self {
6946        Self {
6947            name,
6948            kind,
6949            tags,
6950            container_name,
6951        }
6952    }
6953}
6954
6955/// Provider options for a [`DocumentSymbolRequest`].
6956#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
6957#[serde(rename_all = "camelCase")]
6958pub struct DocumentSymbolOptions {
6959    /// A human-readable string that is shown when multiple outlines trees
6960    /// are shown for the same document.
6961    ///
6962    /// @since 3.16.0
6963    #[serde(skip_serializing_if = "Option::is_none")]
6964    pub label: Option<String>,
6965    #[serde(flatten)]
6966    pub work_done_progress_options: WorkDoneProgressOptions,
6967}
6968impl DocumentSymbolOptions {
6969    #[must_use]
6970    pub const fn new(
6971        label: Option<String>,
6972        work_done_progress_options: WorkDoneProgressOptions,
6973    ) -> Self {
6974        Self {
6975            label,
6976            work_done_progress_options,
6977        }
6978    }
6979}
6980
6981/// Contains additional diagnostic information about the context in which
6982/// a [code action][`CodeActionProvider::provideCodeActions`] is run.
6983#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
6984#[serde(rename_all = "camelCase")]
6985pub struct CodeActionContext {
6986    /// An array of diagnostics known on the client side overlapping the range provided to the
6987    /// `textDocument/codeAction` request. They are provided so that the server knows which
6988    /// errors are currently presented to the user for the given range. There is no guarantee
6989    /// that these accurately reflect the error state of the resource. The primary parameter
6990    /// to compute code actions is the provided range.
6991    pub diagnostics: Vec<Diagnostic>,
6992    /// Requested kind of actions to return.
6993    ///
6994    /// Actions not of this kind are filtered out by the client before being shown. So servers
6995    /// can omit computing them.
6996    #[serde(skip_serializing_if = "Option::is_none")]
6997    pub only: Option<Vec<CodeActionKind>>,
6998    /// The reason why code actions were requested.
6999    ///
7000    /// @since 3.17.0
7001    #[serde(skip_serializing_if = "Option::is_none")]
7002    pub trigger_kind: Option<CodeActionTriggerKind>,
7003}
7004impl CodeActionContext {
7005    #[must_use]
7006    pub const fn new(
7007        diagnostics: Vec<Diagnostic>,
7008        only: Option<Vec<CodeActionKind>>,
7009        trigger_kind: Option<CodeActionTriggerKind>,
7010    ) -> Self {
7011        Self {
7012            diagnostics,
7013            only,
7014            trigger_kind,
7015        }
7016    }
7017}
7018
7019/// Captures why the code action is currently disabled.
7020///
7021/// @since 3.18.0
7022#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
7023#[serde(rename_all = "camelCase")]
7024pub struct CodeActionDisabled {
7025    /// Human readable description of why the code action is currently disabled.
7026    ///
7027    /// This is displayed in the code actions UI.
7028    pub reason: String,
7029}
7030impl CodeActionDisabled {
7031    #[must_use]
7032    pub const fn new(reason: String) -> Self {
7033        Self { reason }
7034    }
7035}
7036
7037/// Provider options for a [`CodeActionRequest`].
7038#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
7039#[serde(rename_all = "camelCase")]
7040pub struct CodeActionOptions {
7041    /// CodeActionKinds that this server may return.
7042    ///
7043    /// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server
7044    /// may list out every specific kind they provide.
7045    #[serde(skip_serializing_if = "Option::is_none")]
7046    pub code_action_kinds: Option<Vec<CodeActionKind>>,
7047    /// Static documentation for a class of code actions.
7048    ///
7049    /// Documentation from the provider should be shown in the code actions menu if either:
7050    ///
7051    /// - Code actions of `kind` are requested by the editor. In this case, the editor will show the documentation that
7052    ///   most closely matches the requested code action kind. For example, if a provider has documentation for
7053    ///   both `Refactor` and `RefactorExtract`, when the user requests code actions for `RefactorExtract`,
7054    ///   the editor will use the documentation for `RefactorExtract` instead of the documentation for `Refactor`.
7055    ///
7056    /// - Any code actions of `kind` are returned by the provider.
7057    ///
7058    /// At most one documentation entry should be shown per provider.
7059    ///
7060    /// @since 3.18.0
7061    /// @proposed
7062    #[serde(skip_serializing_if = "Option::is_none")]
7063    pub documentation: Option<Vec<CodeActionKindDocumentation>>,
7064    /// The server provides support to resolve additional
7065    /// information for a code action.
7066    ///
7067    /// @since 3.16.0
7068    #[serde(skip_serializing_if = "Option::is_none")]
7069    pub resolve_provider: Option<bool>,
7070    #[serde(flatten)]
7071    pub work_done_progress_options: WorkDoneProgressOptions,
7072}
7073impl CodeActionOptions {
7074    #[must_use]
7075    pub const fn new(
7076        code_action_kinds: Option<Vec<CodeActionKind>>,
7077        documentation: Option<Vec<CodeActionKindDocumentation>>,
7078        resolve_provider: Option<bool>,
7079        work_done_progress_options: WorkDoneProgressOptions,
7080    ) -> Self {
7081        Self {
7082            code_action_kinds,
7083            documentation,
7084            resolve_provider,
7085            work_done_progress_options,
7086        }
7087    }
7088}
7089
7090/// Location with only uri and does not include range.
7091///
7092/// @since 3.18.0
7093#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
7094#[serde(rename_all = "camelCase")]
7095pub struct LocationUriOnly {
7096    pub uri: Uri,
7097}
7098impl LocationUriOnly {
7099    #[must_use]
7100    pub const fn new(uri: Uri) -> Self {
7101        Self { uri }
7102    }
7103}
7104
7105/// Server capabilities for a [`WorkspaceSymbolRequest`].
7106#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
7107#[serde(rename_all = "camelCase")]
7108pub struct WorkspaceSymbolOptions {
7109    /// The server provides support to resolve additional
7110    /// information for a workspace symbol.
7111    ///
7112    /// @since 3.17.0
7113    #[serde(skip_serializing_if = "Option::is_none")]
7114    pub resolve_provider: Option<bool>,
7115    #[serde(flatten)]
7116    pub work_done_progress_options: WorkDoneProgressOptions,
7117}
7118impl WorkspaceSymbolOptions {
7119    #[must_use]
7120    pub const fn new(
7121        resolve_provider: Option<bool>,
7122        work_done_progress_options: WorkDoneProgressOptions,
7123    ) -> Self {
7124        Self {
7125            resolve_provider,
7126            work_done_progress_options,
7127        }
7128    }
7129}
7130
7131/// Code Lens provider options of a [`CodeLensRequest`].
7132#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
7133#[serde(rename_all = "camelCase")]
7134pub struct CodeLensOptions {
7135    /// Code lens has a resolve provider as well.
7136    #[serde(skip_serializing_if = "Option::is_none")]
7137    pub resolve_provider: Option<bool>,
7138    #[serde(flatten)]
7139    pub work_done_progress_options: WorkDoneProgressOptions,
7140}
7141impl CodeLensOptions {
7142    #[must_use]
7143    pub const fn new(
7144        resolve_provider: Option<bool>,
7145        work_done_progress_options: WorkDoneProgressOptions,
7146    ) -> Self {
7147        Self {
7148            resolve_provider,
7149            work_done_progress_options,
7150        }
7151    }
7152}
7153
7154/// Provider options for a [`DocumentLinkRequest`].
7155#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
7156#[serde(rename_all = "camelCase")]
7157pub struct DocumentLinkOptions {
7158    /// Document links have a resolve provider as well.
7159    #[serde(skip_serializing_if = "Option::is_none")]
7160    pub resolve_provider: Option<bool>,
7161    #[serde(flatten)]
7162    pub work_done_progress_options: WorkDoneProgressOptions,
7163}
7164impl DocumentLinkOptions {
7165    #[must_use]
7166    pub const fn new(
7167        resolve_provider: Option<bool>,
7168        work_done_progress_options: WorkDoneProgressOptions,
7169    ) -> Self {
7170        Self {
7171            resolve_provider,
7172            work_done_progress_options,
7173        }
7174    }
7175}
7176
7177/// Value-object describing what options formatting should use.
7178#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
7179#[serde(rename_all = "camelCase")]
7180pub struct FormattingOptions {
7181    /// Size of a tab in spaces.
7182    pub tab_size: u32,
7183    /// Prefer spaces over tabs.
7184    pub insert_spaces: bool,
7185    /// Trim trailing whitespace on a line.
7186    ///
7187    /// @since 3.15.0
7188    #[serde(skip_serializing_if = "Option::is_none")]
7189    pub trim_trailing_whitespace: Option<bool>,
7190    /// Insert a newline character at the end of the file if one does not exist.
7191    ///
7192    /// @since 3.15.0
7193    #[serde(skip_serializing_if = "Option::is_none")]
7194    pub insert_final_newline: Option<bool>,
7195    /// Trim all newlines after the final newline at the end of the file.
7196    ///
7197    /// @since 3.15.0
7198    #[serde(skip_serializing_if = "Option::is_none")]
7199    pub trim_final_newlines: Option<bool>,
7200}
7201impl FormattingOptions {
7202    #[must_use]
7203    pub const fn new(
7204        tab_size: u32,
7205        insert_spaces: bool,
7206        trim_trailing_whitespace: Option<bool>,
7207        insert_final_newline: Option<bool>,
7208        trim_final_newlines: Option<bool>,
7209    ) -> Self {
7210        Self {
7211            tab_size,
7212            insert_spaces,
7213            trim_trailing_whitespace,
7214            insert_final_newline,
7215            trim_final_newlines,
7216        }
7217    }
7218}
7219
7220/// Provider options for a [`DocumentFormattingRequest`].
7221#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
7222#[serde(rename_all = "camelCase")]
7223pub struct DocumentFormattingOptions {
7224    #[serde(flatten)]
7225    pub work_done_progress_options: WorkDoneProgressOptions,
7226}
7227impl DocumentFormattingOptions {
7228    #[must_use]
7229    pub const fn new(work_done_progress_options: WorkDoneProgressOptions) -> Self {
7230        Self { work_done_progress_options }
7231    }
7232}
7233
7234/// Provider options for a [`DocumentRangeFormattingRequest`].
7235#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
7236#[serde(rename_all = "camelCase")]
7237pub struct DocumentRangeFormattingOptions {
7238    /// Whether the server supports formatting multiple ranges at once.
7239    ///
7240    /// @since 3.18.0
7241    /// @proposed
7242    #[serde(skip_serializing_if = "Option::is_none")]
7243    pub ranges_support: Option<bool>,
7244    #[serde(flatten)]
7245    pub work_done_progress_options: WorkDoneProgressOptions,
7246}
7247impl DocumentRangeFormattingOptions {
7248    #[must_use]
7249    pub const fn new(
7250        ranges_support: Option<bool>,
7251        work_done_progress_options: WorkDoneProgressOptions,
7252    ) -> Self {
7253        Self {
7254            ranges_support,
7255            work_done_progress_options,
7256        }
7257    }
7258}
7259
7260/// Provider options for a [`DocumentOnTypeFormattingRequest`].
7261#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
7262#[serde(rename_all = "camelCase")]
7263pub struct DocumentOnTypeFormattingOptions {
7264    /// A character on which formatting should be triggered, like `{`.
7265    pub first_trigger_character: String,
7266    /// More trigger characters.
7267    #[serde(skip_serializing_if = "Option::is_none")]
7268    pub more_trigger_character: Option<Vec<String>>,
7269}
7270impl DocumentOnTypeFormattingOptions {
7271    #[must_use]
7272    pub const fn new(
7273        first_trigger_character: String,
7274        more_trigger_character: Option<Vec<String>>,
7275    ) -> Self {
7276        Self {
7277            first_trigger_character,
7278            more_trigger_character,
7279        }
7280    }
7281}
7282
7283/// Provider options for a [`RenameRequest`].
7284#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
7285#[serde(rename_all = "camelCase")]
7286pub struct RenameOptions {
7287    /// Renames should be checked and tested before being executed.
7288    ///
7289    /// @since version 3.12.0
7290    #[serde(skip_serializing_if = "Option::is_none")]
7291    pub prepare_provider: Option<bool>,
7292    #[serde(flatten)]
7293    pub work_done_progress_options: WorkDoneProgressOptions,
7294}
7295impl RenameOptions {
7296    #[must_use]
7297    pub const fn new(
7298        prepare_provider: Option<bool>,
7299        work_done_progress_options: WorkDoneProgressOptions,
7300    ) -> Self {
7301        Self {
7302            prepare_provider,
7303            work_done_progress_options,
7304        }
7305    }
7306}
7307
7308/// @since 3.18.0
7309#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
7310#[serde(rename_all = "camelCase")]
7311pub struct PrepareRenamePlaceholder {
7312    pub range: Range,
7313    pub placeholder: String,
7314}
7315impl PrepareRenamePlaceholder {
7316    #[must_use]
7317    pub const fn new(range: Range, placeholder: String) -> Self {
7318        Self { range, placeholder }
7319    }
7320}
7321
7322/// @since 3.18.0
7323#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
7324#[serde(rename_all = "camelCase")]
7325pub struct PrepareRenameDefaultBehavior {
7326    pub default_behavior: bool,
7327}
7328impl PrepareRenameDefaultBehavior {
7329    #[must_use]
7330    pub const fn new(default_behavior: bool) -> Self {
7331        Self { default_behavior }
7332    }
7333}
7334
7335/// The server capabilities of a [`ExecuteCommandRequest`].
7336#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
7337#[serde(rename_all = "camelCase")]
7338pub struct ExecuteCommandOptions {
7339    /// The commands to be executed on the server
7340    pub commands: Vec<String>,
7341    #[serde(flatten)]
7342    pub work_done_progress_options: WorkDoneProgressOptions,
7343}
7344impl ExecuteCommandOptions {
7345    #[must_use]
7346    pub const fn new(
7347        commands: Vec<String>,
7348        work_done_progress_options: WorkDoneProgressOptions,
7349    ) -> Self {
7350        Self {
7351            commands,
7352            work_done_progress_options,
7353        }
7354    }
7355}
7356
7357/// Additional data about a workspace edit.
7358///
7359/// @since 3.18.0
7360/// @proposed
7361#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
7362#[serde(rename_all = "camelCase")]
7363pub struct WorkspaceEditMetadata {
7364    /// Signal to the editor that this edit is a refactoring.
7365    #[serde(skip_serializing_if = "Option::is_none")]
7366    pub is_refactoring: Option<bool>,
7367}
7368impl WorkspaceEditMetadata {
7369    #[must_use]
7370    pub const fn new(is_refactoring: Option<bool>) -> Self {
7371        Self { is_refactoring }
7372    }
7373}
7374
7375/// @since 3.16.0
7376#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
7377#[serde(rename_all = "camelCase")]
7378pub struct SemanticTokensLegend {
7379    /// The token types a server uses.
7380    pub token_types: Vec<String>,
7381    /// The token modifiers a server uses.
7382    pub token_modifiers: Vec<String>,
7383}
7384impl SemanticTokensLegend {
7385    #[must_use]
7386    pub const fn new(token_types: Vec<String>, token_modifiers: Vec<String>) -> Self {
7387        Self {
7388            token_types,
7389            token_modifiers,
7390        }
7391    }
7392}
7393
7394/// Semantic tokens options to support deltas for full documents
7395///
7396/// @since 3.18.0
7397#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
7398#[serde(rename_all = "camelCase")]
7399pub struct SemanticTokensFullDelta {
7400    /// The server supports deltas for full documents.
7401    #[serde(skip_serializing_if = "Option::is_none")]
7402    pub delta: Option<bool>,
7403}
7404impl SemanticTokensFullDelta {
7405    #[must_use]
7406    pub const fn new(delta: Option<bool>) -> Self {
7407        Self { delta }
7408    }
7409}
7410
7411/// A text document identifier to optionally denote a specific version of a text document.
7412#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
7413#[serde(rename_all = "camelCase")]
7414pub struct OptionalVersionedTextDocumentIdentifier {
7415    /// The version number of this document. If a versioned text document identifier
7416    /// is sent from the server to the client and the file is not open in the editor
7417    /// (the server has not received an open notification before) the server can send
7418    /// `null` to indicate that the version is unknown and the content on disk is the
7419    /// truth (as specified with document content ownership).
7420    pub version: Option<i32>,
7421    #[serde(flatten)]
7422    pub text_document_identifier: TextDocumentIdentifier,
7423}
7424impl OptionalVersionedTextDocumentIdentifier {
7425    #[must_use]
7426    pub const fn new(
7427        version: Option<i32>,
7428        text_document_identifier: TextDocumentIdentifier,
7429    ) -> Self {
7430        Self {
7431            version,
7432            text_document_identifier,
7433        }
7434    }
7435}
7436
7437/// A special text edit with an additional change annotation.
7438///
7439/// @since 3.16.0.
7440#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
7441#[serde(rename_all = "camelCase")]
7442pub struct AnnotatedTextEdit {
7443    /// The actual identifier of the change annotation
7444    pub annotation_id: ChangeAnnotationIdentifier,
7445    #[serde(flatten)]
7446    pub text_edit: TextEdit,
7447}
7448impl AnnotatedTextEdit {
7449    #[must_use]
7450    pub const fn new(
7451        annotation_id: ChangeAnnotationIdentifier,
7452        text_edit: TextEdit,
7453    ) -> Self {
7454        Self { annotation_id, text_edit }
7455    }
7456}
7457
7458/// An interactive text edit.
7459///
7460/// @since 3.18.0
7461/// @proposed
7462#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
7463#[serde(rename_all = "camelCase")]
7464pub struct SnippetTextEdit {
7465    /// The range of the text document to be manipulated.
7466    pub range: Range,
7467    /// The snippet to be inserted.
7468    pub snippet: StringValue,
7469    /// The actual identifier of the snippet edit.
7470    #[serde(skip_serializing_if = "Option::is_none")]
7471    pub annotation_id: Option<ChangeAnnotationIdentifier>,
7472}
7473impl SnippetTextEdit {
7474    #[must_use]
7475    pub const fn new(
7476        range: Range,
7477        snippet: StringValue,
7478        annotation_id: Option<ChangeAnnotationIdentifier>,
7479    ) -> Self {
7480        Self {
7481            range,
7482            snippet,
7483            annotation_id,
7484        }
7485    }
7486}
7487
7488/// A generic resource operation.
7489#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
7490#[serde(rename_all = "camelCase")]
7491pub struct ResourceOperation {
7492    /// The resource operation kind.
7493    pub kind: String,
7494    /// An optional annotation identifier describing the operation.
7495    ///
7496    /// @since 3.16.0
7497    #[serde(skip_serializing_if = "Option::is_none")]
7498    pub annotation_id: Option<ChangeAnnotationIdentifier>,
7499}
7500impl ResourceOperation {
7501    #[must_use]
7502    pub const fn new(
7503        kind: String,
7504        annotation_id: Option<ChangeAnnotationIdentifier>,
7505    ) -> Self {
7506        Self { kind, annotation_id }
7507    }
7508}
7509
7510/// Options to create a file.
7511#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
7512#[serde(rename_all = "camelCase")]
7513pub struct CreateFileOptions {
7514    /// Overwrite existing file. Overwrite wins over `ignoreIfExists`
7515    #[serde(skip_serializing_if = "Option::is_none")]
7516    pub overwrite: Option<bool>,
7517    /// Ignore if exists.
7518    #[serde(skip_serializing_if = "Option::is_none")]
7519    pub ignore_if_exists: Option<bool>,
7520}
7521impl CreateFileOptions {
7522    #[must_use]
7523    pub const fn new(overwrite: Option<bool>, ignore_if_exists: Option<bool>) -> Self {
7524        Self {
7525            overwrite,
7526            ignore_if_exists,
7527        }
7528    }
7529}
7530
7531/// Rename file options
7532#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
7533#[serde(rename_all = "camelCase")]
7534pub struct RenameFileOptions {
7535    /// Overwrite target if existing. Overwrite wins over `ignoreIfExists`
7536    #[serde(skip_serializing_if = "Option::is_none")]
7537    pub overwrite: Option<bool>,
7538    /// Ignores if target exists.
7539    #[serde(skip_serializing_if = "Option::is_none")]
7540    pub ignore_if_exists: Option<bool>,
7541}
7542impl RenameFileOptions {
7543    #[must_use]
7544    pub const fn new(overwrite: Option<bool>, ignore_if_exists: Option<bool>) -> Self {
7545        Self {
7546            overwrite,
7547            ignore_if_exists,
7548        }
7549    }
7550}
7551
7552/// Delete file options
7553#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
7554#[serde(rename_all = "camelCase")]
7555pub struct DeleteFileOptions {
7556    /// Delete the content recursively if a folder is denoted.
7557    #[serde(skip_serializing_if = "Option::is_none")]
7558    pub recursive: Option<bool>,
7559    /// Ignore the operation if the file doesn't exist.
7560    #[serde(skip_serializing_if = "Option::is_none")]
7561    pub ignore_if_not_exists: Option<bool>,
7562}
7563impl DeleteFileOptions {
7564    #[must_use]
7565    pub const fn new(
7566        recursive: Option<bool>,
7567        ignore_if_not_exists: Option<bool>,
7568    ) -> Self {
7569        Self {
7570            recursive,
7571            ignore_if_not_exists,
7572        }
7573    }
7574}
7575
7576/// A pattern to describe in which file operation requests or notifications
7577/// the server is interested in receiving.
7578///
7579/// @since 3.16.0
7580#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
7581#[serde(rename_all = "camelCase")]
7582pub struct FileOperationPattern {
7583    /// The glob pattern to match. Glob patterns can have the following syntax:
7584    /// - `*` to match one or more characters in a path segment
7585    /// - `?` to match on one character in a path segment
7586    /// - `**` to match any number of path segments, including none
7587    /// - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files)
7588    /// - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
7589    /// - `[!...]` 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`)
7590    pub glob: String,
7591    /// Whether to match files or folders with this pattern.
7592    ///
7593    /// Matches both if undefined.
7594    #[serde(skip_serializing_if = "Option::is_none")]
7595    pub matches: Option<FileOperationPatternKind>,
7596    /// Additional options used during matching.
7597    #[serde(skip_serializing_if = "Option::is_none")]
7598    pub options: Option<FileOperationPatternOptions>,
7599}
7600impl FileOperationPattern {
7601    #[must_use]
7602    pub const fn new(
7603        glob: String,
7604        matches: Option<FileOperationPatternKind>,
7605        options: Option<FileOperationPatternOptions>,
7606    ) -> Self {
7607        Self { glob, matches, options }
7608    }
7609}
7610
7611/// A full document diagnostic report for a workspace diagnostic result.
7612///
7613/// @since 3.17.0
7614#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
7615#[serde(rename_all = "camelCase")]
7616pub struct WorkspaceFullDocumentDiagnosticReport {
7617    /// The URI for which diagnostic information is reported.
7618    pub uri: Uri,
7619    /// The version number for which the diagnostics are reported.
7620    /// If the document is not marked as open `null` can be provided.
7621    pub version: Option<i32>,
7622    #[serde(flatten)]
7623    pub full_document_diagnostic_report: FullDocumentDiagnosticReport,
7624}
7625impl WorkspaceFullDocumentDiagnosticReport {
7626    #[must_use]
7627    pub const fn new(
7628        uri: Uri,
7629        version: Option<i32>,
7630        full_document_diagnostic_report: FullDocumentDiagnosticReport,
7631    ) -> Self {
7632        Self {
7633            uri,
7634            version,
7635            full_document_diagnostic_report,
7636        }
7637    }
7638}
7639
7640/// An unchanged document diagnostic report for a workspace diagnostic result.
7641///
7642/// @since 3.17.0
7643#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
7644#[serde(rename_all = "camelCase")]
7645pub struct WorkspaceUnchangedDocumentDiagnosticReport {
7646    /// The URI for which diagnostic information is reported.
7647    pub uri: Uri,
7648    /// The version number for which the diagnostics are reported.
7649    /// If the document is not marked as open `null` can be provided.
7650    pub version: Option<i32>,
7651    #[serde(flatten)]
7652    pub unchanged_document_diagnostic_report: UnchangedDocumentDiagnosticReport,
7653}
7654impl WorkspaceUnchangedDocumentDiagnosticReport {
7655    #[must_use]
7656    pub const fn new(
7657        uri: Uri,
7658        version: Option<i32>,
7659        unchanged_document_diagnostic_report: UnchangedDocumentDiagnosticReport,
7660    ) -> Self {
7661        Self {
7662            uri,
7663            version,
7664            unchanged_document_diagnostic_report,
7665        }
7666    }
7667}
7668
7669/// A notebook cell.
7670///
7671/// A cell's document URI must be unique across ALL notebook
7672/// cells and can therefore be used to uniquely identify a
7673/// notebook cell or the cell's text document.
7674///
7675/// @since 3.17.0
7676#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
7677#[serde(rename_all = "camelCase")]
7678pub struct NotebookCell {
7679    /// The cell's kind
7680    pub kind: NotebookCellKind,
7681    /// The URI of the cell's text document
7682    /// content.
7683    pub document: Uri,
7684    /// Additional metadata stored with the cell.
7685    ///
7686    /// Note: should always be an object literal (e.g. LSPObject)
7687    #[serde(skip_serializing_if = "Option::is_none")]
7688    pub metadata: Option<LspObject>,
7689    /// Additional execution summary information
7690    /// if supported by the client.
7691    #[serde(skip_serializing_if = "Option::is_none")]
7692    pub execution_summary: Option<ExecutionSummary>,
7693}
7694impl NotebookCell {
7695    #[must_use]
7696    pub const fn new(
7697        kind: NotebookCellKind,
7698        document: Uri,
7699        metadata: Option<LspObject>,
7700        execution_summary: Option<ExecutionSummary>,
7701    ) -> Self {
7702        Self {
7703            kind,
7704            document,
7705            metadata,
7706            execution_summary,
7707        }
7708    }
7709}
7710
7711/// @since 3.18.0
7712#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
7713#[serde(rename_all = "camelCase")]
7714pub struct NotebookDocumentFilterWithNotebook {
7715    /// The notebook to be synced If a string
7716    /// value is provided it matches against the
7717    /// notebook type. '*' matches every notebook.
7718    pub notebook: Notebook,
7719    /// The cells of the matching notebook to be synced.
7720    #[serde(skip_serializing_if = "Option::is_none")]
7721    pub cells: Option<Vec<NotebookCellLanguage>>,
7722}
7723impl NotebookDocumentFilterWithNotebook {
7724    #[must_use]
7725    pub const fn new(
7726        notebook: Notebook,
7727        cells: Option<Vec<NotebookCellLanguage>>,
7728    ) -> Self {
7729        Self { notebook, cells }
7730    }
7731}
7732
7733/// @since 3.18.0
7734#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
7735#[serde(rename_all = "camelCase")]
7736pub struct NotebookDocumentFilterWithCells {
7737    /// The notebook to be synced If a string
7738    /// value is provided it matches against the
7739    /// notebook type. '*' matches every notebook.
7740    #[serde(skip_serializing_if = "Option::is_none")]
7741    pub notebook: Option<Notebook>,
7742    /// The cells of the matching notebook to be synced.
7743    pub cells: Vec<NotebookCellLanguage>,
7744}
7745impl NotebookDocumentFilterWithCells {
7746    #[must_use]
7747    pub const fn new(
7748        notebook: Option<Notebook>,
7749        cells: Vec<NotebookCellLanguage>,
7750    ) -> Self {
7751        Self { notebook, cells }
7752    }
7753}
7754
7755/// Cell changes to a notebook document.
7756///
7757/// @since 3.18.0
7758#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
7759#[serde(rename_all = "camelCase")]
7760pub struct NotebookDocumentCellChanges {
7761    /// Changes to the cell structure to add or
7762    /// remove cells.
7763    #[serde(skip_serializing_if = "Option::is_none")]
7764    pub structure: Option<NotebookDocumentCellChangeStructure>,
7765    /// Changes to notebook cells properties like its
7766    /// kind, execution summary or metadata.
7767    #[serde(skip_serializing_if = "Option::is_none")]
7768    pub data: Option<Vec<NotebookCell>>,
7769    /// Changes to the text content of notebook cells.
7770    #[serde(skip_serializing_if = "Option::is_none")]
7771    pub text_content: Option<Vec<NotebookDocumentCellContentChanges>>,
7772}
7773impl NotebookDocumentCellChanges {
7774    #[must_use]
7775    pub const fn new(
7776        structure: Option<NotebookDocumentCellChangeStructure>,
7777        data: Option<Vec<NotebookCell>>,
7778        text_content: Option<Vec<NotebookDocumentCellContentChanges>>,
7779    ) -> Self {
7780        Self {
7781            structure,
7782            data,
7783            text_content,
7784        }
7785    }
7786}
7787
7788/// Describes the currently selected completion item.
7789///
7790/// @since 3.18.0
7791/// @proposed
7792#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
7793#[serde(rename_all = "camelCase")]
7794pub struct SelectedCompletionInfo {
7795    /// The range that will be replaced if this completion item is accepted.
7796    pub range: Range,
7797    /// The text the range will be replaced with if this completion is accepted.
7798    pub text: String,
7799}
7800impl SelectedCompletionInfo {
7801    #[must_use]
7802    pub const fn new(range: Range, text: String) -> Self {
7803        Self { range, text }
7804    }
7805}
7806
7807/// Information about the client
7808///
7809/// @since 3.15.0
7810/// @since 3.18.0 ClientInfo type name added.
7811#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
7812#[serde(rename_all = "camelCase")]
7813pub struct ClientInfo {
7814    /// The name of the client as defined by the client.
7815    pub name: String,
7816    /// The client's version as defined by the client.
7817    #[serde(skip_serializing_if = "Option::is_none")]
7818    pub version: Option<String>,
7819}
7820impl ClientInfo {
7821    #[must_use]
7822    pub const fn new(name: String, version: Option<String>) -> Self {
7823        Self { name, version }
7824    }
7825}
7826
7827/// Defines the capabilities provided by the client.
7828#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
7829#[serde(rename_all = "camelCase")]
7830pub struct ClientCapabilities {
7831    /// Workspace specific client capabilities.
7832    #[serde(skip_serializing_if = "Option::is_none")]
7833    pub workspace: Option<WorkspaceClientCapabilities>,
7834    /// Text document specific client capabilities.
7835    #[serde(skip_serializing_if = "Option::is_none")]
7836    pub text_document: Option<TextDocumentClientCapabilities>,
7837    /// Capabilities specific to the notebook document support.
7838    ///
7839    /// @since 3.17.0
7840    #[serde(skip_serializing_if = "Option::is_none")]
7841    pub notebook_document: Option<NotebookDocumentClientCapabilities>,
7842    /// Window specific client capabilities.
7843    #[serde(skip_serializing_if = "Option::is_none")]
7844    pub window: Option<WindowClientCapabilities>,
7845    /// General client capabilities.
7846    ///
7847    /// @since 3.16.0
7848    #[serde(skip_serializing_if = "Option::is_none")]
7849    pub general: Option<GeneralClientCapabilities>,
7850    /// Experimental client capabilities.
7851    #[serde(skip_serializing_if = "Option::is_none")]
7852    pub experimental: Option<LspAny>,
7853}
7854impl ClientCapabilities {
7855    #[must_use]
7856    pub const fn new(
7857        workspace: Option<WorkspaceClientCapabilities>,
7858        text_document: Option<TextDocumentClientCapabilities>,
7859        notebook_document: Option<NotebookDocumentClientCapabilities>,
7860        window: Option<WindowClientCapabilities>,
7861        general: Option<GeneralClientCapabilities>,
7862        experimental: Option<LspAny>,
7863    ) -> Self {
7864        Self {
7865            workspace,
7866            text_document,
7867            notebook_document,
7868            window,
7869            general,
7870            experimental,
7871        }
7872    }
7873}
7874
7875#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
7876#[serde(rename_all = "camelCase")]
7877pub struct TextDocumentSyncOptions {
7878    /// Open and close notifications are sent to the server. If omitted open close notification should not
7879    /// be sent.
7880    #[serde(skip_serializing_if = "Option::is_none")]
7881    pub open_close: Option<bool>,
7882    /// Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full
7883    /// and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None.
7884    #[serde(skip_serializing_if = "Option::is_none")]
7885    pub change: Option<TextDocumentSyncKind>,
7886    /// If present will save notifications are sent to the server. If omitted the notification should not be
7887    /// sent.
7888    #[serde(skip_serializing_if = "Option::is_none")]
7889    pub will_save: Option<bool>,
7890    /// If present will save wait until requests are sent to the server. If omitted the request should not be
7891    /// sent.
7892    #[serde(skip_serializing_if = "Option::is_none")]
7893    pub will_save_wait_until: Option<bool>,
7894    /// If present save notifications are sent to the server. If omitted the notification should not be
7895    /// sent.
7896    #[serde(skip_serializing_if = "Option::is_none")]
7897    pub save: Option<Save>,
7898}
7899impl TextDocumentSyncOptions {
7900    #[must_use]
7901    pub const fn new(
7902        open_close: Option<bool>,
7903        change: Option<TextDocumentSyncKind>,
7904        will_save: Option<bool>,
7905        will_save_wait_until: Option<bool>,
7906        save: Option<Save>,
7907    ) -> Self {
7908        Self {
7909            open_close,
7910            change,
7911            will_save,
7912            will_save_wait_until,
7913            save,
7914        }
7915    }
7916}
7917
7918/// Defines workspace specific capabilities of the server.
7919///
7920/// @since 3.18.0
7921#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
7922#[serde(rename_all = "camelCase")]
7923pub struct WorkspaceOptions {
7924    /// The server supports workspace folder.
7925    ///
7926    /// @since 3.6.0
7927    #[serde(skip_serializing_if = "Option::is_none")]
7928    pub workspace_folders: Option<WorkspaceFoldersServerCapabilities>,
7929    /// The server is interested in notifications/requests for operations on files.
7930    ///
7931    /// @since 3.16.0
7932    #[serde(skip_serializing_if = "Option::is_none")]
7933    pub file_operations: Option<FileOperationOptions>,
7934    /// The server supports the `workspace/textDocumentContent` request.
7935    ///
7936    /// @since 3.18.0
7937    /// @proposed
7938    #[serde(skip_serializing_if = "Option::is_none")]
7939    pub text_document_content: Option<TextDocumentContent>,
7940}
7941impl WorkspaceOptions {
7942    #[must_use]
7943    pub const fn new(
7944        workspace_folders: Option<WorkspaceFoldersServerCapabilities>,
7945        file_operations: Option<FileOperationOptions>,
7946        text_document_content: Option<TextDocumentContent>,
7947    ) -> Self {
7948        Self {
7949            workspace_folders,
7950            file_operations,
7951            text_document_content,
7952        }
7953    }
7954}
7955
7956/// @since 3.18.0
7957#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
7958#[serde(rename_all = "camelCase")]
7959pub struct TextDocumentContentChangePartial {
7960    /// The range of the document that changed.
7961    pub range: Range,
7962    /// The optional length of the range that got replaced.
7963    ///
7964    /// @deprecated use range instead.
7965    #[deprecated(note = "use range instead.")]
7966    #[serde(skip_serializing_if = "Option::is_none")]
7967    pub range_length: Option<u32>,
7968    /// The new text for the provided range.
7969    pub text: String,
7970}
7971impl TextDocumentContentChangePartial {
7972    #[must_use]
7973    pub const fn new(range: Range, range_length: Option<u32>, text: String) -> Self {
7974        Self { range, range_length, text }
7975    }
7976}
7977
7978/// @since 3.18.0
7979#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
7980#[serde(rename_all = "camelCase")]
7981pub struct TextDocumentContentChangeWholeDocument {
7982    /// The new text of the whole document.
7983    pub text: String,
7984}
7985impl TextDocumentContentChangeWholeDocument {
7986    #[must_use]
7987    pub const fn new(text: String) -> Self {
7988        Self { text }
7989    }
7990}
7991
7992/// Structure to capture a description for an error code.
7993///
7994/// @since 3.16.0
7995#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
7996#[serde(rename_all = "camelCase")]
7997pub struct CodeDescription {
7998    /// An URI to open with more information about the diagnostic error.
7999    pub href: Uri,
8000}
8001impl CodeDescription {
8002    #[must_use]
8003    pub const fn new(href: Uri) -> Self {
8004        Self { href }
8005    }
8006}
8007
8008/// Represents a related message and source code location for a diagnostic. This should be
8009/// used to point to code locations that cause or related to a diagnostics, e.g when duplicating
8010/// a symbol in a scope.
8011#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
8012#[serde(rename_all = "camelCase")]
8013pub struct DiagnosticRelatedInformation {
8014    /// The location of this related diagnostic information.
8015    pub location: Location,
8016    /// The message of this related diagnostic information.
8017    pub message: String,
8018}
8019impl DiagnosticRelatedInformation {
8020    #[must_use]
8021    pub const fn new(location: Location, message: String) -> Self {
8022        Self { location, message }
8023    }
8024}
8025
8026/// Edit range variant that includes ranges for insert and replace operations.
8027///
8028/// @since 3.18.0
8029#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
8030#[serde(rename_all = "camelCase")]
8031pub struct EditRangeWithInsertReplace {
8032    pub insert: Range,
8033    pub replace: Range,
8034}
8035impl EditRangeWithInsertReplace {
8036    #[must_use]
8037    pub const fn new(insert: Range, replace: Range) -> Self {
8038        Self { insert, replace }
8039    }
8040}
8041
8042/// @since 3.18.0
8043#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
8044#[serde(rename_all = "camelCase")]
8045pub struct ServerCompletionItemOptions {
8046    /// The server has support for completion item label
8047    /// details (see also `CompletionItemLabelDetails`) when
8048    /// receiving a completion item in a resolve call.
8049    ///
8050    /// @since 3.17.0
8051    #[serde(skip_serializing_if = "Option::is_none")]
8052    pub label_details_support: Option<bool>,
8053}
8054impl ServerCompletionItemOptions {
8055    #[must_use]
8056    pub const fn new(label_details_support: Option<bool>) -> Self {
8057        Self { label_details_support }
8058    }
8059}
8060
8061/// @since 3.18.0
8062/// @deprecated use MarkupContent instead.
8063#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
8064#[serde(rename_all = "camelCase")]
8065#[deprecated(note = "use MarkupContent instead.")]
8066pub struct MarkedStringWithLanguage {
8067    pub language: String,
8068    pub value: String,
8069}
8070impl MarkedStringWithLanguage {
8071    #[must_use]
8072    pub const fn new(language: String, value: String) -> Self {
8073        Self { language, value }
8074    }
8075}
8076
8077/// Represents a parameter of a callable-signature. A parameter can
8078/// have a label and a doc-comment.
8079#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
8080#[serde(rename_all = "camelCase")]
8081pub struct ParameterInformation {
8082    /// The label of this parameter information.
8083    ///
8084    /// Either a string or an inclusive start and exclusive end offsets within its containing
8085    /// signature label. (see SignatureInformation.label). The offsets are based on a UTF-16
8086    /// string representation as `Position` and `Range` does.
8087    ///
8088    /// To avoid ambiguities a server should use the [start, end] offset value instead of using
8089    /// a substring. Whether a client support this is controlled via `labelOffsetSupport` client
8090    /// capability.
8091    ///
8092    /// *Note*: a label of type string should be a substring of its containing signature label.
8093    /// Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`.
8094    pub label: ParameterInformationLabel,
8095    /// The human-readable doc-comment of this parameter. Will be shown
8096    /// in the UI but can be omitted.
8097    #[serde(skip_serializing_if = "Option::is_none")]
8098    pub documentation: Option<Documentation>,
8099}
8100impl ParameterInformation {
8101    #[must_use]
8102    pub const fn new(
8103        label: ParameterInformationLabel,
8104        documentation: Option<Documentation>,
8105    ) -> Self {
8106        Self { label, documentation }
8107    }
8108}
8109
8110/// Documentation for a class of code actions.
8111///
8112/// @since 3.18.0
8113/// @proposed
8114#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq)]
8115#[serde(rename_all = "camelCase")]
8116pub struct CodeActionKindDocumentation {
8117    /// The kind of the code action being documented.
8118    ///
8119    /// If the kind is generic, such as `CodeActionKind.Refactor`, the documentation will be shown whenever any
8120    /// refactorings are returned. If the kind if more specific, such as `CodeActionKind.RefactorExtract`, the
8121    /// documentation will only be shown when extract refactoring code actions are returned.
8122    pub kind: CodeActionKind,
8123    /// Command that is ued to display the documentation to the user.
8124    ///
8125    /// The title of this documentation code action is taken from [`Command::title`]
8126    pub command: Command,
8127}
8128impl CodeActionKindDocumentation {
8129    #[must_use]
8130    pub const fn new(kind: CodeActionKind, command: Command) -> Self {
8131        Self { kind, command }
8132    }
8133}
8134
8135/// A notebook cell text document filter denotes a cell text
8136/// document by different properties.
8137///
8138/// @since 3.17.0
8139#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
8140#[serde(rename_all = "camelCase")]
8141pub struct NotebookCellTextDocumentFilter {
8142    /// A filter that matches against the notebook
8143    /// containing the notebook cell. If a string
8144    /// value is provided it matches against the
8145    /// notebook type. '*' matches every notebook.
8146    pub notebook: Notebook,
8147    /// A language id like `python`.
8148    ///
8149    /// Will be matched against the language id of the
8150    /// notebook cell document. '*' matches every language.
8151    #[serde(skip_serializing_if = "Option::is_none")]
8152    pub language: Option<String>,
8153}
8154impl NotebookCellTextDocumentFilter {
8155    #[must_use]
8156    pub const fn new(notebook: Notebook, language: Option<String>) -> Self {
8157        Self { notebook, language }
8158    }
8159}
8160
8161/// Matching options for the file operation pattern.
8162///
8163/// @since 3.16.0
8164#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
8165#[serde(rename_all = "camelCase")]
8166pub struct FileOperationPatternOptions {
8167    /// The pattern should be matched ignoring casing.
8168    #[serde(skip_serializing_if = "Option::is_none")]
8169    pub ignore_case: Option<bool>,
8170}
8171impl FileOperationPatternOptions {
8172    #[must_use]
8173    pub const fn new(ignore_case: Option<bool>) -> Self {
8174        Self { ignore_case }
8175    }
8176}
8177
8178#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
8179#[serde(rename_all = "camelCase")]
8180pub struct ExecutionSummary {
8181    /// A strict monotonically increasing value
8182    /// indicating the execution order of a cell
8183    /// inside a notebook.
8184    pub execution_order: u32,
8185    /// Whether the execution was successful or
8186    /// not if known by the client.
8187    #[serde(skip_serializing_if = "Option::is_none")]
8188    pub success: Option<bool>,
8189}
8190impl ExecutionSummary {
8191    #[must_use]
8192    pub const fn new(execution_order: u32, success: Option<bool>) -> Self {
8193        Self { execution_order, success }
8194    }
8195}
8196
8197/// @since 3.18.0
8198#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
8199#[serde(rename_all = "camelCase")]
8200pub struct NotebookCellLanguage {
8201    pub language: String,
8202}
8203impl NotebookCellLanguage {
8204    #[must_use]
8205    pub const fn new(language: String) -> Self {
8206        Self { language }
8207    }
8208}
8209
8210/// Structural changes to cells in a notebook document.
8211///
8212/// @since 3.18.0
8213#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
8214#[serde(rename_all = "camelCase")]
8215pub struct NotebookDocumentCellChangeStructure {
8216    /// The change to the cell array.
8217    pub array: NotebookCellArrayChange,
8218    /// Additional opened cell text documents.
8219    #[serde(skip_serializing_if = "Option::is_none")]
8220    pub did_open: Option<Vec<TextDocumentItem>>,
8221    /// Additional closed cell text documents.
8222    #[serde(skip_serializing_if = "Option::is_none")]
8223    pub did_close: Option<Vec<TextDocumentIdentifier>>,
8224}
8225impl NotebookDocumentCellChangeStructure {
8226    #[must_use]
8227    pub const fn new(
8228        array: NotebookCellArrayChange,
8229        did_open: Option<Vec<TextDocumentItem>>,
8230        did_close: Option<Vec<TextDocumentIdentifier>>,
8231    ) -> Self {
8232        Self { array, did_open, did_close }
8233    }
8234}
8235
8236/// Content changes to a cell in a notebook document.
8237///
8238/// @since 3.18.0
8239#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
8240#[serde(rename_all = "camelCase")]
8241pub struct NotebookDocumentCellContentChanges {
8242    pub document: VersionedTextDocumentIdentifier,
8243    pub changes: Vec<TextDocumentContentChangeEvent>,
8244}
8245impl NotebookDocumentCellContentChanges {
8246    #[must_use]
8247    pub const fn new(
8248        document: VersionedTextDocumentIdentifier,
8249        changes: Vec<TextDocumentContentChangeEvent>,
8250    ) -> Self {
8251        Self { document, changes }
8252    }
8253}
8254
8255/// Workspace specific client capabilities.
8256#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
8257#[serde(rename_all = "camelCase")]
8258pub struct WorkspaceClientCapabilities {
8259    /// The client supports applying batch edits
8260    /// to the workspace by supporting the request
8261    /// 'workspace/applyEdit'
8262    #[serde(skip_serializing_if = "Option::is_none")]
8263    pub apply_edit: Option<bool>,
8264    /// Capabilities specific to `WorkspaceEdit`s.
8265    #[serde(skip_serializing_if = "Option::is_none")]
8266    pub workspace_edit: Option<WorkspaceEditClientCapabilities>,
8267    /// Capabilities specific to the `workspace/didChangeConfiguration` notification.
8268    #[serde(skip_serializing_if = "Option::is_none")]
8269    pub did_change_configuration: Option<DidChangeConfigurationClientCapabilities>,
8270    /// Capabilities specific to the `workspace/didChangeWatchedFiles` notification.
8271    #[serde(skip_serializing_if = "Option::is_none")]
8272    pub did_change_watched_files: Option<DidChangeWatchedFilesClientCapabilities>,
8273    /// Capabilities specific to the `workspace/symbol` request.
8274    #[serde(skip_serializing_if = "Option::is_none")]
8275    pub symbol: Option<WorkspaceSymbolClientCapabilities>,
8276    /// Capabilities specific to the `workspace/executeCommand` request.
8277    #[serde(skip_serializing_if = "Option::is_none")]
8278    pub execute_command: Option<ExecuteCommandClientCapabilities>,
8279    /// The client has support for workspace folders.
8280    ///
8281    /// @since 3.6.0
8282    #[serde(skip_serializing_if = "Option::is_none")]
8283    pub workspace_folders: Option<bool>,
8284    /// The client supports `workspace/configuration` requests.
8285    ///
8286    /// @since 3.6.0
8287    #[serde(skip_serializing_if = "Option::is_none")]
8288    pub configuration: Option<bool>,
8289    /// Capabilities specific to the semantic token requests scoped to the
8290    /// workspace.
8291    ///
8292    /// @since 3.16.0.
8293    #[serde(skip_serializing_if = "Option::is_none")]
8294    pub semantic_tokens: Option<SemanticTokensWorkspaceClientCapabilities>,
8295    /// Capabilities specific to the code lens requests scoped to the
8296    /// workspace.
8297    ///
8298    /// @since 3.16.0.
8299    #[serde(skip_serializing_if = "Option::is_none")]
8300    pub code_lens: Option<CodeLensWorkspaceClientCapabilities>,
8301    /// The client has support for file notifications/requests for user operations on files.
8302    ///
8303    /// Since 3.16.0
8304    #[serde(skip_serializing_if = "Option::is_none")]
8305    pub file_operations: Option<FileOperationClientCapabilities>,
8306    /// Capabilities specific to the inline values requests scoped to the
8307    /// workspace.
8308    ///
8309    /// @since 3.17.0.
8310    #[serde(skip_serializing_if = "Option::is_none")]
8311    pub inline_value: Option<InlineValueWorkspaceClientCapabilities>,
8312    /// Capabilities specific to the inlay hint requests scoped to the
8313    /// workspace.
8314    ///
8315    /// @since 3.17.0.
8316    #[serde(skip_serializing_if = "Option::is_none")]
8317    pub inlay_hint: Option<InlayHintWorkspaceClientCapabilities>,
8318    /// Capabilities specific to the diagnostic requests scoped to the
8319    /// workspace.
8320    ///
8321    /// @since 3.17.0.
8322    #[serde(skip_serializing_if = "Option::is_none")]
8323    pub diagnostics: Option<DiagnosticWorkspaceClientCapabilities>,
8324    /// Capabilities specific to the folding range requests scoped to the workspace.
8325    ///
8326    /// @since 3.18.0
8327    /// @proposed
8328    #[serde(skip_serializing_if = "Option::is_none")]
8329    pub folding_range: Option<FoldingRangeWorkspaceClientCapabilities>,
8330    /// Capabilities specific to the `workspace/textDocumentContent` request.
8331    ///
8332    /// @since 3.18.0
8333    /// @proposed
8334    #[serde(skip_serializing_if = "Option::is_none")]
8335    pub text_document_content: Option<TextDocumentContentClientCapabilities>,
8336}
8337impl WorkspaceClientCapabilities {
8338    #[must_use]
8339    pub const fn new(
8340        apply_edit: Option<bool>,
8341        workspace_edit: Option<WorkspaceEditClientCapabilities>,
8342        did_change_configuration: Option<DidChangeConfigurationClientCapabilities>,
8343        did_change_watched_files: Option<DidChangeWatchedFilesClientCapabilities>,
8344        symbol: Option<WorkspaceSymbolClientCapabilities>,
8345        execute_command: Option<ExecuteCommandClientCapabilities>,
8346        workspace_folders: Option<bool>,
8347        configuration: Option<bool>,
8348        semantic_tokens: Option<SemanticTokensWorkspaceClientCapabilities>,
8349        code_lens: Option<CodeLensWorkspaceClientCapabilities>,
8350        file_operations: Option<FileOperationClientCapabilities>,
8351        inline_value: Option<InlineValueWorkspaceClientCapabilities>,
8352        inlay_hint: Option<InlayHintWorkspaceClientCapabilities>,
8353        diagnostics: Option<DiagnosticWorkspaceClientCapabilities>,
8354        folding_range: Option<FoldingRangeWorkspaceClientCapabilities>,
8355        text_document_content: Option<TextDocumentContentClientCapabilities>,
8356    ) -> Self {
8357        Self {
8358            apply_edit,
8359            workspace_edit,
8360            did_change_configuration,
8361            did_change_watched_files,
8362            symbol,
8363            execute_command,
8364            workspace_folders,
8365            configuration,
8366            semantic_tokens,
8367            code_lens,
8368            file_operations,
8369            inline_value,
8370            inlay_hint,
8371            diagnostics,
8372            folding_range,
8373            text_document_content,
8374        }
8375    }
8376}
8377
8378/// Text document specific client capabilities.
8379#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
8380#[serde(rename_all = "camelCase")]
8381pub struct TextDocumentClientCapabilities {
8382    /// Defines which synchronization capabilities the client supports.
8383    #[serde(skip_serializing_if = "Option::is_none")]
8384    pub synchronization: Option<TextDocumentSyncClientCapabilities>,
8385    /// Defines which filters the client supports.
8386    ///
8387    /// @since 3.18.0
8388    #[serde(skip_serializing_if = "Option::is_none")]
8389    pub filters: Option<TextDocumentFilterClientCapabilities>,
8390    /// Capabilities specific to the `textDocument/completion` request.
8391    #[serde(skip_serializing_if = "Option::is_none")]
8392    pub completion: Option<CompletionClientCapabilities>,
8393    /// Capabilities specific to the `textDocument/hover` request.
8394    #[serde(skip_serializing_if = "Option::is_none")]
8395    pub hover: Option<HoverClientCapabilities>,
8396    /// Capabilities specific to the `textDocument/signatureHelp` request.
8397    #[serde(skip_serializing_if = "Option::is_none")]
8398    pub signature_help: Option<SignatureHelpClientCapabilities>,
8399    /// Capabilities specific to the `textDocument/declaration` request.
8400    ///
8401    /// @since 3.14.0
8402    #[serde(skip_serializing_if = "Option::is_none")]
8403    pub declaration: Option<DeclarationClientCapabilities>,
8404    /// Capabilities specific to the `textDocument/definition` request.
8405    #[serde(skip_serializing_if = "Option::is_none")]
8406    pub definition: Option<DefinitionClientCapabilities>,
8407    /// Capabilities specific to the `textDocument/typeDefinition` request.
8408    ///
8409    /// @since 3.6.0
8410    #[serde(skip_serializing_if = "Option::is_none")]
8411    pub type_definition: Option<TypeDefinitionClientCapabilities>,
8412    /// Capabilities specific to the `textDocument/implementation` request.
8413    ///
8414    /// @since 3.6.0
8415    #[serde(skip_serializing_if = "Option::is_none")]
8416    pub implementation: Option<ImplementationClientCapabilities>,
8417    /// Capabilities specific to the `textDocument/references` request.
8418    #[serde(skip_serializing_if = "Option::is_none")]
8419    pub references: Option<ReferenceClientCapabilities>,
8420    /// Capabilities specific to the `textDocument/documentHighlight` request.
8421    #[serde(skip_serializing_if = "Option::is_none")]
8422    pub document_highlight: Option<DocumentHighlightClientCapabilities>,
8423    /// Capabilities specific to the `textDocument/documentSymbol` request.
8424    #[serde(skip_serializing_if = "Option::is_none")]
8425    pub document_symbol: Option<DocumentSymbolClientCapabilities>,
8426    /// Capabilities specific to the `textDocument/codeAction` request.
8427    #[serde(skip_serializing_if = "Option::is_none")]
8428    pub code_action: Option<CodeActionClientCapabilities>,
8429    /// Capabilities specific to the `textDocument/codeLens` request.
8430    #[serde(skip_serializing_if = "Option::is_none")]
8431    pub code_lens: Option<CodeLensClientCapabilities>,
8432    /// Capabilities specific to the `textDocument/documentLink` request.
8433    #[serde(skip_serializing_if = "Option::is_none")]
8434    pub document_link: Option<DocumentLinkClientCapabilities>,
8435    /// Capabilities specific to the `textDocument/documentColor` and the
8436    /// `textDocument/colorPresentation` request.
8437    ///
8438    /// @since 3.6.0
8439    #[serde(skip_serializing_if = "Option::is_none")]
8440    pub color_provider: Option<DocumentColorClientCapabilities>,
8441    /// Capabilities specific to the `textDocument/formatting` request.
8442    #[serde(skip_serializing_if = "Option::is_none")]
8443    pub formatting: Option<DocumentFormattingClientCapabilities>,
8444    /// Capabilities specific to the `textDocument/rangeFormatting` request.
8445    #[serde(skip_serializing_if = "Option::is_none")]
8446    pub range_formatting: Option<DocumentRangeFormattingClientCapabilities>,
8447    /// Capabilities specific to the `textDocument/onTypeFormatting` request.
8448    #[serde(skip_serializing_if = "Option::is_none")]
8449    pub on_type_formatting: Option<DocumentOnTypeFormattingClientCapabilities>,
8450    /// Capabilities specific to the `textDocument/rename` request.
8451    #[serde(skip_serializing_if = "Option::is_none")]
8452    pub rename: Option<RenameClientCapabilities>,
8453    /// Capabilities specific to the `textDocument/foldingRange` request.
8454    ///
8455    /// @since 3.10.0
8456    #[serde(skip_serializing_if = "Option::is_none")]
8457    pub folding_range: Option<FoldingRangeClientCapabilities>,
8458    /// Capabilities specific to the `textDocument/selectionRange` request.
8459    ///
8460    /// @since 3.15.0
8461    #[serde(skip_serializing_if = "Option::is_none")]
8462    pub selection_range: Option<SelectionRangeClientCapabilities>,
8463    /// Capabilities specific to the `textDocument/publishDiagnostics` notification.
8464    #[serde(skip_serializing_if = "Option::is_none")]
8465    pub publish_diagnostics: Option<PublishDiagnosticsClientCapabilities>,
8466    /// Capabilities specific to the various call hierarchy requests.
8467    ///
8468    /// @since 3.16.0
8469    #[serde(skip_serializing_if = "Option::is_none")]
8470    pub call_hierarchy: Option<CallHierarchyClientCapabilities>,
8471    /// Capabilities specific to the various semantic token request.
8472    ///
8473    /// @since 3.16.0
8474    #[serde(skip_serializing_if = "Option::is_none")]
8475    pub semantic_tokens: Option<SemanticTokensClientCapabilities>,
8476    /// Capabilities specific to the `textDocument/linkedEditingRange` request.
8477    ///
8478    /// @since 3.16.0
8479    #[serde(skip_serializing_if = "Option::is_none")]
8480    pub linked_editing_range: Option<LinkedEditingRangeClientCapabilities>,
8481    /// Client capabilities specific to the `textDocument/moniker` request.
8482    ///
8483    /// @since 3.16.0
8484    #[serde(skip_serializing_if = "Option::is_none")]
8485    pub moniker: Option<MonikerClientCapabilities>,
8486    /// Capabilities specific to the various type hierarchy requests.
8487    ///
8488    /// @since 3.17.0
8489    #[serde(skip_serializing_if = "Option::is_none")]
8490    pub type_hierarchy: Option<TypeHierarchyClientCapabilities>,
8491    /// Capabilities specific to the `textDocument/inlineValue` request.
8492    ///
8493    /// @since 3.17.0
8494    #[serde(skip_serializing_if = "Option::is_none")]
8495    pub inline_value: Option<InlineValueClientCapabilities>,
8496    /// Capabilities specific to the `textDocument/inlayHint` request.
8497    ///
8498    /// @since 3.17.0
8499    #[serde(skip_serializing_if = "Option::is_none")]
8500    pub inlay_hint: Option<InlayHintClientCapabilities>,
8501    /// Capabilities specific to the diagnostic pull model.
8502    ///
8503    /// @since 3.17.0
8504    #[serde(skip_serializing_if = "Option::is_none")]
8505    pub diagnostic: Option<DiagnosticClientCapabilities>,
8506    /// Client capabilities specific to inline completions.
8507    ///
8508    /// @since 3.18.0
8509    /// @proposed
8510    #[serde(skip_serializing_if = "Option::is_none")]
8511    pub inline_completion: Option<InlineCompletionClientCapabilities>,
8512}
8513impl TextDocumentClientCapabilities {
8514    #[must_use]
8515    pub const fn new(
8516        synchronization: Option<TextDocumentSyncClientCapabilities>,
8517        filters: Option<TextDocumentFilterClientCapabilities>,
8518        completion: Option<CompletionClientCapabilities>,
8519        hover: Option<HoverClientCapabilities>,
8520        signature_help: Option<SignatureHelpClientCapabilities>,
8521        declaration: Option<DeclarationClientCapabilities>,
8522        definition: Option<DefinitionClientCapabilities>,
8523        type_definition: Option<TypeDefinitionClientCapabilities>,
8524        implementation: Option<ImplementationClientCapabilities>,
8525        references: Option<ReferenceClientCapabilities>,
8526        document_highlight: Option<DocumentHighlightClientCapabilities>,
8527        document_symbol: Option<DocumentSymbolClientCapabilities>,
8528        code_action: Option<CodeActionClientCapabilities>,
8529        code_lens: Option<CodeLensClientCapabilities>,
8530        document_link: Option<DocumentLinkClientCapabilities>,
8531        color_provider: Option<DocumentColorClientCapabilities>,
8532        formatting: Option<DocumentFormattingClientCapabilities>,
8533        range_formatting: Option<DocumentRangeFormattingClientCapabilities>,
8534        on_type_formatting: Option<DocumentOnTypeFormattingClientCapabilities>,
8535        rename: Option<RenameClientCapabilities>,
8536        folding_range: Option<FoldingRangeClientCapabilities>,
8537        selection_range: Option<SelectionRangeClientCapabilities>,
8538        publish_diagnostics: Option<PublishDiagnosticsClientCapabilities>,
8539        call_hierarchy: Option<CallHierarchyClientCapabilities>,
8540        semantic_tokens: Option<SemanticTokensClientCapabilities>,
8541        linked_editing_range: Option<LinkedEditingRangeClientCapabilities>,
8542        moniker: Option<MonikerClientCapabilities>,
8543        type_hierarchy: Option<TypeHierarchyClientCapabilities>,
8544        inline_value: Option<InlineValueClientCapabilities>,
8545        inlay_hint: Option<InlayHintClientCapabilities>,
8546        diagnostic: Option<DiagnosticClientCapabilities>,
8547        inline_completion: Option<InlineCompletionClientCapabilities>,
8548    ) -> Self {
8549        Self {
8550            synchronization,
8551            filters,
8552            completion,
8553            hover,
8554            signature_help,
8555            declaration,
8556            definition,
8557            type_definition,
8558            implementation,
8559            references,
8560            document_highlight,
8561            document_symbol,
8562            code_action,
8563            code_lens,
8564            document_link,
8565            color_provider,
8566            formatting,
8567            range_formatting,
8568            on_type_formatting,
8569            rename,
8570            folding_range,
8571            selection_range,
8572            publish_diagnostics,
8573            call_hierarchy,
8574            semantic_tokens,
8575            linked_editing_range,
8576            moniker,
8577            type_hierarchy,
8578            inline_value,
8579            inlay_hint,
8580            diagnostic,
8581            inline_completion,
8582        }
8583    }
8584}
8585
8586/// Capabilities specific to the notebook document support.
8587///
8588/// @since 3.17.0
8589#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
8590#[serde(rename_all = "camelCase")]
8591pub struct NotebookDocumentClientCapabilities {
8592    /// Capabilities specific to notebook document synchronization
8593    ///
8594    /// @since 3.17.0
8595    pub synchronization: NotebookDocumentSyncClientCapabilities,
8596}
8597impl NotebookDocumentClientCapabilities {
8598    #[must_use]
8599    pub const fn new(synchronization: NotebookDocumentSyncClientCapabilities) -> Self {
8600        Self { synchronization }
8601    }
8602}
8603
8604#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
8605#[serde(rename_all = "camelCase")]
8606pub struct WindowClientCapabilities {
8607    /// It indicates whether the client supports server initiated
8608    /// progress using the `window/workDoneProgress/create` request.
8609    ///
8610    /// The capability also controls Whether client supports handling
8611    /// of progress notifications. If set servers are allowed to report a
8612    /// `workDoneProgress` property in the request specific server
8613    /// capabilities.
8614    ///
8615    /// @since 3.15.0
8616    #[serde(skip_serializing_if = "Option::is_none")]
8617    pub work_done_progress: Option<bool>,
8618    /// Capabilities specific to the showMessage request.
8619    ///
8620    /// @since 3.16.0
8621    #[serde(skip_serializing_if = "Option::is_none")]
8622    pub show_message: Option<ShowMessageRequestClientCapabilities>,
8623    /// Capabilities specific to the showDocument request.
8624    ///
8625    /// @since 3.16.0
8626    #[serde(skip_serializing_if = "Option::is_none")]
8627    pub show_document: Option<ShowDocumentClientCapabilities>,
8628}
8629impl WindowClientCapabilities {
8630    #[must_use]
8631    pub const fn new(
8632        work_done_progress: Option<bool>,
8633        show_message: Option<ShowMessageRequestClientCapabilities>,
8634        show_document: Option<ShowDocumentClientCapabilities>,
8635    ) -> Self {
8636        Self {
8637            work_done_progress,
8638            show_message,
8639            show_document,
8640        }
8641    }
8642}
8643
8644/// General client capabilities.
8645///
8646/// @since 3.16.0
8647#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
8648#[serde(rename_all = "camelCase")]
8649pub struct GeneralClientCapabilities {
8650    /// Client capability that signals how the client
8651    /// handles stale requests (e.g. a request
8652    /// for which the client will not process the response
8653    /// anymore since the information is outdated).
8654    ///
8655    /// @since 3.17.0
8656    #[serde(skip_serializing_if = "Option::is_none")]
8657    pub stale_request_support: Option<StaleRequestSupportOptions>,
8658    /// Client capabilities specific to regular expressions.
8659    ///
8660    /// @since 3.16.0
8661    #[serde(skip_serializing_if = "Option::is_none")]
8662    pub regular_expressions: Option<RegularExpressionsClientCapabilities>,
8663    /// Client capabilities specific to the client's markdown parser.
8664    ///
8665    /// @since 3.16.0
8666    #[serde(skip_serializing_if = "Option::is_none")]
8667    pub markdown: Option<MarkdownClientCapabilities>,
8668    /// The position encodings supported by the client. Client and server
8669    /// have to agree on the same position encoding to ensure that offsets
8670    /// (e.g. character position in a line) are interpreted the same on both
8671    /// sides.
8672    ///
8673    /// To keep the protocol backwards compatible the following applies: if
8674    /// the value 'utf-16' is missing from the array of position encodings
8675    /// servers can assume that the client supports UTF-16. UTF-16 is
8676    /// therefore a mandatory encoding.
8677    ///
8678    /// If omitted it defaults to ['utf-16'].
8679    ///
8680    /// Implementation considerations: since the conversion from one encoding
8681    /// into another requires the content of the file / line the conversion
8682    /// is best done where the file is read which is usually on the server
8683    /// side.
8684    ///
8685    /// @since 3.17.0
8686    #[serde(skip_serializing_if = "Option::is_none")]
8687    pub position_encodings: Option<Vec<PositionEncodingKind>>,
8688}
8689impl GeneralClientCapabilities {
8690    #[must_use]
8691    pub const fn new(
8692        stale_request_support: Option<StaleRequestSupportOptions>,
8693        regular_expressions: Option<RegularExpressionsClientCapabilities>,
8694        markdown: Option<MarkdownClientCapabilities>,
8695        position_encodings: Option<Vec<PositionEncodingKind>>,
8696    ) -> Self {
8697        Self {
8698            stale_request_support,
8699            regular_expressions,
8700            markdown,
8701            position_encodings,
8702        }
8703    }
8704}
8705
8706#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
8707#[serde(rename_all = "camelCase")]
8708pub struct WorkspaceFoldersServerCapabilities {
8709    /// The server has support for workspace folders
8710    #[serde(skip_serializing_if = "Option::is_none")]
8711    pub supported: Option<bool>,
8712    /// Whether the server wants to receive workspace folder
8713    /// change notifications.
8714    ///
8715    /// If a string is provided the string is treated as an ID
8716    /// under which the notification is registered on the client
8717    /// side. The ID can be used to unregister for these events
8718    /// using the `client/unregisterCapability` request.
8719    #[serde(skip_serializing_if = "Option::is_none")]
8720    pub change_notifications: Option<ChangeNotifications>,
8721}
8722impl WorkspaceFoldersServerCapabilities {
8723    #[must_use]
8724    pub const fn new(
8725        supported: Option<bool>,
8726        change_notifications: Option<ChangeNotifications>,
8727    ) -> Self {
8728        Self {
8729            supported,
8730            change_notifications,
8731        }
8732    }
8733}
8734
8735/// Options for notifications/requests for user operations on files.
8736///
8737/// @since 3.16.0
8738#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
8739#[serde(rename_all = "camelCase")]
8740pub struct FileOperationOptions {
8741    /// The server is interested in receiving didCreateFiles notifications.
8742    #[serde(skip_serializing_if = "Option::is_none")]
8743    pub did_create: Option<FileOperationRegistrationOptions>,
8744    /// The server is interested in receiving willCreateFiles requests.
8745    #[serde(skip_serializing_if = "Option::is_none")]
8746    pub will_create: Option<FileOperationRegistrationOptions>,
8747    /// The server is interested in receiving didRenameFiles notifications.
8748    #[serde(skip_serializing_if = "Option::is_none")]
8749    pub did_rename: Option<FileOperationRegistrationOptions>,
8750    /// The server is interested in receiving willRenameFiles requests.
8751    #[serde(skip_serializing_if = "Option::is_none")]
8752    pub will_rename: Option<FileOperationRegistrationOptions>,
8753    /// The server is interested in receiving didDeleteFiles file notifications.
8754    #[serde(skip_serializing_if = "Option::is_none")]
8755    pub did_delete: Option<FileOperationRegistrationOptions>,
8756    /// The server is interested in receiving willDeleteFiles file requests.
8757    #[serde(skip_serializing_if = "Option::is_none")]
8758    pub will_delete: Option<FileOperationRegistrationOptions>,
8759}
8760impl FileOperationOptions {
8761    #[must_use]
8762    pub const fn new(
8763        did_create: Option<FileOperationRegistrationOptions>,
8764        will_create: Option<FileOperationRegistrationOptions>,
8765        did_rename: Option<FileOperationRegistrationOptions>,
8766        will_rename: Option<FileOperationRegistrationOptions>,
8767        did_delete: Option<FileOperationRegistrationOptions>,
8768        will_delete: Option<FileOperationRegistrationOptions>,
8769    ) -> Self {
8770        Self {
8771            did_create,
8772            will_create,
8773            did_rename,
8774            will_rename,
8775            did_delete,
8776            will_delete,
8777        }
8778    }
8779}
8780
8781/// A relative pattern is a helper to construct glob patterns that are matched
8782/// relatively to a base URI. The common value for a `baseUri` is a workspace
8783/// folder root, but it can be another absolute URI as well.
8784///
8785/// @since 3.17.0
8786#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
8787#[serde(rename_all = "camelCase")]
8788pub struct RelativePattern {
8789    /// A workspace folder or a base URI to which this pattern will be matched
8790    /// against relatively.
8791    pub base_uri: BaseUri,
8792    /// The actual glob pattern;
8793    pub pattern: Pattern,
8794}
8795impl RelativePattern {
8796    #[must_use]
8797    pub const fn new(base_uri: BaseUri, pattern: Pattern) -> Self {
8798        Self { base_uri, pattern }
8799    }
8800}
8801
8802/// A document filter where `language` is required field.
8803///
8804/// @since 3.18.0
8805#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
8806#[serde(rename_all = "camelCase")]
8807pub struct TextDocumentFilterLanguage {
8808    /// A language id, like `typescript`.
8809    pub language: String,
8810    /// A Uri [scheme][`Uri::scheme`], like `file` or `untitled`.
8811    #[serde(skip_serializing_if = "Option::is_none")]
8812    pub scheme: Option<String>,
8813    /// A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples.
8814    ///
8815    /// @since 3.18.0 - support for relative patterns. Whether clients support
8816    /// relative patterns depends on the client capability
8817    /// `textDocuments.filters.relativePatternSupport`.
8818    #[serde(skip_serializing_if = "Option::is_none")]
8819    pub pattern: Option<GlobPattern>,
8820}
8821impl TextDocumentFilterLanguage {
8822    #[must_use]
8823    pub const fn new(
8824        language: String,
8825        scheme: Option<String>,
8826        pattern: Option<GlobPattern>,
8827    ) -> Self {
8828        Self { language, scheme, pattern }
8829    }
8830}
8831
8832/// A document filter where `scheme` is required field.
8833///
8834/// @since 3.18.0
8835#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
8836#[serde(rename_all = "camelCase")]
8837pub struct TextDocumentFilterScheme {
8838    /// A language id, like `typescript`.
8839    #[serde(skip_serializing_if = "Option::is_none")]
8840    pub language: Option<String>,
8841    /// A Uri [scheme][`Uri::scheme`], like `file` or `untitled`.
8842    pub scheme: String,
8843    /// A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples.
8844    ///
8845    /// @since 3.18.0 - support for relative patterns. Whether clients support
8846    /// relative patterns depends on the client capability
8847    /// `textDocuments.filters.relativePatternSupport`.
8848    #[serde(skip_serializing_if = "Option::is_none")]
8849    pub pattern: Option<GlobPattern>,
8850}
8851impl TextDocumentFilterScheme {
8852    #[must_use]
8853    pub const fn new(
8854        language: Option<String>,
8855        scheme: String,
8856        pattern: Option<GlobPattern>,
8857    ) -> Self {
8858        Self { language, scheme, pattern }
8859    }
8860}
8861
8862/// A document filter where `pattern` is required field.
8863///
8864/// @since 3.18.0
8865#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
8866#[serde(rename_all = "camelCase")]
8867pub struct TextDocumentFilterPattern {
8868    /// A language id, like `typescript`.
8869    #[serde(skip_serializing_if = "Option::is_none")]
8870    pub language: Option<String>,
8871    /// A Uri [scheme][`Uri::scheme`], like `file` or `untitled`.
8872    #[serde(skip_serializing_if = "Option::is_none")]
8873    pub scheme: Option<String>,
8874    /// A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples.
8875    ///
8876    /// @since 3.18.0 - support for relative patterns. Whether clients support
8877    /// relative patterns depends on the client capability
8878    /// `textDocuments.filters.relativePatternSupport`.
8879    pub pattern: GlobPattern,
8880}
8881impl TextDocumentFilterPattern {
8882    #[must_use]
8883    pub const fn new(
8884        language: Option<String>,
8885        scheme: Option<String>,
8886        pattern: GlobPattern,
8887    ) -> Self {
8888        Self { language, scheme, pattern }
8889    }
8890}
8891
8892/// A notebook document filter where `notebookType` is required field.
8893///
8894/// @since 3.18.0
8895#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
8896#[serde(rename_all = "camelCase")]
8897pub struct NotebookDocumentFilterNotebookType {
8898    /// The type of the enclosing notebook.
8899    pub notebook_type: String,
8900    /// A Uri [scheme][`Uri::scheme`], like `file` or `untitled`.
8901    #[serde(skip_serializing_if = "Option::is_none")]
8902    pub scheme: Option<String>,
8903    /// A glob pattern.
8904    #[serde(skip_serializing_if = "Option::is_none")]
8905    pub pattern: Option<GlobPattern>,
8906}
8907impl NotebookDocumentFilterNotebookType {
8908    #[must_use]
8909    pub const fn new(
8910        notebook_type: String,
8911        scheme: Option<String>,
8912        pattern: Option<GlobPattern>,
8913    ) -> Self {
8914        Self {
8915            notebook_type,
8916            scheme,
8917            pattern,
8918        }
8919    }
8920}
8921
8922/// A notebook document filter where `scheme` is required field.
8923///
8924/// @since 3.18.0
8925#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
8926#[serde(rename_all = "camelCase")]
8927pub struct NotebookDocumentFilterScheme {
8928    /// The type of the enclosing notebook.
8929    #[serde(skip_serializing_if = "Option::is_none")]
8930    pub notebook_type: Option<String>,
8931    /// A Uri [scheme][`Uri::scheme`], like `file` or `untitled`.
8932    pub scheme: String,
8933    /// A glob pattern.
8934    #[serde(skip_serializing_if = "Option::is_none")]
8935    pub pattern: Option<GlobPattern>,
8936}
8937impl NotebookDocumentFilterScheme {
8938    #[must_use]
8939    pub const fn new(
8940        notebook_type: Option<String>,
8941        scheme: String,
8942        pattern: Option<GlobPattern>,
8943    ) -> Self {
8944        Self {
8945            notebook_type,
8946            scheme,
8947            pattern,
8948        }
8949    }
8950}
8951
8952/// A notebook document filter where `pattern` is required field.
8953///
8954/// @since 3.18.0
8955#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash)]
8956#[serde(rename_all = "camelCase")]
8957pub struct NotebookDocumentFilterPattern {
8958    /// The type of the enclosing notebook.
8959    #[serde(skip_serializing_if = "Option::is_none")]
8960    pub notebook_type: Option<String>,
8961    /// A Uri [scheme][`Uri::scheme`], like `file` or `untitled`.
8962    #[serde(skip_serializing_if = "Option::is_none")]
8963    pub scheme: Option<String>,
8964    /// A glob pattern.
8965    pub pattern: GlobPattern,
8966}
8967impl NotebookDocumentFilterPattern {
8968    #[must_use]
8969    pub const fn new(
8970        notebook_type: Option<String>,
8971        scheme: Option<String>,
8972        pattern: GlobPattern,
8973    ) -> Self {
8974        Self {
8975            notebook_type,
8976            scheme,
8977            pattern,
8978        }
8979    }
8980}
8981
8982/// A change describing how to move a `NotebookCell`
8983/// array from state S to S'.
8984///
8985/// @since 3.17.0
8986#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
8987#[serde(rename_all = "camelCase")]
8988pub struct NotebookCellArrayChange {
8989    /// The start oftest of the cell that changed.
8990    pub start: u32,
8991    /// The deleted cells
8992    pub delete_count: u32,
8993    /// The new cells, if any
8994    #[serde(skip_serializing_if = "Option::is_none")]
8995    pub cells: Option<Vec<NotebookCell>>,
8996}
8997impl NotebookCellArrayChange {
8998    #[must_use]
8999    pub const fn new(
9000        start: u32,
9001        delete_count: u32,
9002        cells: Option<Vec<NotebookCell>>,
9003    ) -> Self {
9004        Self { start, delete_count, cells }
9005    }
9006}
9007
9008#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
9009#[serde(rename_all = "camelCase")]
9010pub struct WorkspaceEditClientCapabilities {
9011    /// The client supports versioned document changes in `WorkspaceEdit`s
9012    #[serde(skip_serializing_if = "Option::is_none")]
9013    pub document_changes: Option<bool>,
9014    /// The resource operations the client supports. Clients should at least
9015    /// support 'create', 'rename' and 'delete' files and folders.
9016    ///
9017    /// @since 3.13.0
9018    #[serde(skip_serializing_if = "Option::is_none")]
9019    pub resource_operations: Option<Vec<ResourceOperationKind>>,
9020    /// The failure handling strategy of a client if applying the workspace edit
9021    /// fails.
9022    ///
9023    /// @since 3.13.0
9024    #[serde(skip_serializing_if = "Option::is_none")]
9025    pub failure_handling: Option<FailureHandlingKind>,
9026    /// Whether the client normalizes line endings to the client specific
9027    /// setting.
9028    /// If set to `true` the client will normalize line ending characters
9029    /// in a workspace edit to the client-specified new line
9030    /// character.
9031    ///
9032    /// @since 3.16.0
9033    #[serde(skip_serializing_if = "Option::is_none")]
9034    pub normalizes_line_endings: Option<bool>,
9035    /// Whether the client in general supports change annotations on text edits,
9036    /// create file, rename file and delete file changes.
9037    ///
9038    /// @since 3.16.0
9039    #[serde(skip_serializing_if = "Option::is_none")]
9040    pub change_annotation_support: Option<ChangeAnnotationsSupportOptions>,
9041    /// Whether the client supports `WorkspaceEditMetadata` in `WorkspaceEdit`s.
9042    ///
9043    /// @since 3.18.0
9044    /// @proposed
9045    #[serde(skip_serializing_if = "Option::is_none")]
9046    pub metadata_support: Option<bool>,
9047    /// Whether the client supports snippets as text edits.
9048    ///
9049    /// @since 3.18.0
9050    /// @proposed
9051    #[serde(skip_serializing_if = "Option::is_none")]
9052    pub snippet_edit_support: Option<bool>,
9053}
9054impl WorkspaceEditClientCapabilities {
9055    #[must_use]
9056    pub const fn new(
9057        document_changes: Option<bool>,
9058        resource_operations: Option<Vec<ResourceOperationKind>>,
9059        failure_handling: Option<FailureHandlingKind>,
9060        normalizes_line_endings: Option<bool>,
9061        change_annotation_support: Option<ChangeAnnotationsSupportOptions>,
9062        metadata_support: Option<bool>,
9063        snippet_edit_support: Option<bool>,
9064    ) -> Self {
9065        Self {
9066            document_changes,
9067            resource_operations,
9068            failure_handling,
9069            normalizes_line_endings,
9070            change_annotation_support,
9071            metadata_support,
9072            snippet_edit_support,
9073        }
9074    }
9075}
9076
9077#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9078#[serde(rename_all = "camelCase")]
9079pub struct DidChangeConfigurationClientCapabilities {
9080    /// Did change configuration notification supports dynamic registration.
9081    #[serde(skip_serializing_if = "Option::is_none")]
9082    pub dynamic_registration: Option<bool>,
9083}
9084impl DidChangeConfigurationClientCapabilities {
9085    #[must_use]
9086    pub const fn new(dynamic_registration: Option<bool>) -> Self {
9087        Self { dynamic_registration }
9088    }
9089}
9090
9091#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9092#[serde(rename_all = "camelCase")]
9093pub struct DidChangeWatchedFilesClientCapabilities {
9094    /// Did change watched files notification supports dynamic registration. Please note
9095    /// that the current protocol doesn't support static configuration for file changes
9096    /// from the server side.
9097    #[serde(skip_serializing_if = "Option::is_none")]
9098    pub dynamic_registration: Option<bool>,
9099    /// Whether the client has support for [relative pattern][RelativePattern]
9100    /// or not.
9101    ///
9102    /// @since 3.17.0
9103    #[serde(skip_serializing_if = "Option::is_none")]
9104    pub relative_pattern_support: Option<bool>,
9105}
9106impl DidChangeWatchedFilesClientCapabilities {
9107    #[must_use]
9108    pub const fn new(
9109        dynamic_registration: Option<bool>,
9110        relative_pattern_support: Option<bool>,
9111    ) -> Self {
9112        Self {
9113            dynamic_registration,
9114            relative_pattern_support,
9115        }
9116    }
9117}
9118
9119/// Client capabilities for a [`WorkspaceSymbolRequest`].
9120#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
9121#[serde(rename_all = "camelCase")]
9122pub struct WorkspaceSymbolClientCapabilities {
9123    /// Symbol request supports dynamic registration.
9124    #[serde(skip_serializing_if = "Option::is_none")]
9125    pub dynamic_registration: Option<bool>,
9126    /// Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
9127    #[serde(skip_serializing_if = "Option::is_none")]
9128    pub symbol_kind: Option<ClientSymbolKindOptions>,
9129    /// The client supports tags on `SymbolInformation`.
9130    /// Clients supporting tags have to handle unknown tags gracefully.
9131    ///
9132    /// @since 3.16.0
9133    #[serde(skip_serializing_if = "Option::is_none")]
9134    pub tag_support: Option<ClientSymbolTagOptions>,
9135    /// The client support partial workspace symbols. The client will send the
9136    /// request `workspaceSymbol/resolve` to the server to resolve additional
9137    /// properties.
9138    ///
9139    /// @since 3.17.0
9140    #[serde(skip_serializing_if = "Option::is_none")]
9141    pub resolve_support: Option<ClientSymbolResolveOptions>,
9142}
9143impl WorkspaceSymbolClientCapabilities {
9144    #[must_use]
9145    pub const fn new(
9146        dynamic_registration: Option<bool>,
9147        symbol_kind: Option<ClientSymbolKindOptions>,
9148        tag_support: Option<ClientSymbolTagOptions>,
9149        resolve_support: Option<ClientSymbolResolveOptions>,
9150    ) -> Self {
9151        Self {
9152            dynamic_registration,
9153            symbol_kind,
9154            tag_support,
9155            resolve_support,
9156        }
9157    }
9158}
9159
9160/// The client capabilities of a [`ExecuteCommandRequest`].
9161#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9162#[serde(rename_all = "camelCase")]
9163pub struct ExecuteCommandClientCapabilities {
9164    /// Execute command supports dynamic registration.
9165    #[serde(skip_serializing_if = "Option::is_none")]
9166    pub dynamic_registration: Option<bool>,
9167}
9168impl ExecuteCommandClientCapabilities {
9169    #[must_use]
9170    pub const fn new(dynamic_registration: Option<bool>) -> Self {
9171        Self { dynamic_registration }
9172    }
9173}
9174
9175/// @since 3.16.0
9176#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9177#[serde(rename_all = "camelCase")]
9178pub struct SemanticTokensWorkspaceClientCapabilities {
9179    /// Whether the client implementation supports a refresh request sent from
9180    /// the server to the client.
9181    ///
9182    /// Note that this event is global and will force the client to refresh all
9183    /// semantic tokens currently shown. It should be used with absolute care
9184    /// and is useful for situation where a server for example detects a project
9185    /// wide change that requires such a calculation.
9186    #[serde(skip_serializing_if = "Option::is_none")]
9187    pub refresh_support: Option<bool>,
9188}
9189impl SemanticTokensWorkspaceClientCapabilities {
9190    #[must_use]
9191    pub const fn new(refresh_support: Option<bool>) -> Self {
9192        Self { refresh_support }
9193    }
9194}
9195
9196/// @since 3.16.0
9197#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9198#[serde(rename_all = "camelCase")]
9199pub struct CodeLensWorkspaceClientCapabilities {
9200    /// Whether the client implementation supports a refresh request sent from the
9201    /// server to the client.
9202    ///
9203    /// Note that this event is global and will force the client to refresh all
9204    /// code lenses currently shown. It should be used with absolute care and is
9205    /// useful for situation where a server for example detect a project wide
9206    /// change that requires such a calculation.
9207    #[serde(skip_serializing_if = "Option::is_none")]
9208    pub refresh_support: Option<bool>,
9209}
9210impl CodeLensWorkspaceClientCapabilities {
9211    #[must_use]
9212    pub const fn new(refresh_support: Option<bool>) -> Self {
9213        Self { refresh_support }
9214    }
9215}
9216
9217/// Capabilities relating to events from file operations by the user in the client.
9218///
9219/// These events do not come from the file system, they come from user operations
9220/// like renaming a file in the UI.
9221///
9222/// @since 3.16.0
9223#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9224#[serde(rename_all = "camelCase")]
9225pub struct FileOperationClientCapabilities {
9226    /// Whether the client supports dynamic registration for file requests/notifications.
9227    #[serde(skip_serializing_if = "Option::is_none")]
9228    pub dynamic_registration: Option<bool>,
9229    /// The client has support for sending didCreateFiles notifications.
9230    #[serde(skip_serializing_if = "Option::is_none")]
9231    pub did_create: Option<bool>,
9232    /// The client has support for sending willCreateFiles requests.
9233    #[serde(skip_serializing_if = "Option::is_none")]
9234    pub will_create: Option<bool>,
9235    /// The client has support for sending didRenameFiles notifications.
9236    #[serde(skip_serializing_if = "Option::is_none")]
9237    pub did_rename: Option<bool>,
9238    /// The client has support for sending willRenameFiles requests.
9239    #[serde(skip_serializing_if = "Option::is_none")]
9240    pub will_rename: Option<bool>,
9241    /// The client has support for sending didDeleteFiles notifications.
9242    #[serde(skip_serializing_if = "Option::is_none")]
9243    pub did_delete: Option<bool>,
9244    /// The client has support for sending willDeleteFiles requests.
9245    #[serde(skip_serializing_if = "Option::is_none")]
9246    pub will_delete: Option<bool>,
9247}
9248impl FileOperationClientCapabilities {
9249    #[must_use]
9250    pub const fn new(
9251        dynamic_registration: Option<bool>,
9252        did_create: Option<bool>,
9253        will_create: Option<bool>,
9254        did_rename: Option<bool>,
9255        will_rename: Option<bool>,
9256        did_delete: Option<bool>,
9257        will_delete: Option<bool>,
9258    ) -> Self {
9259        Self {
9260            dynamic_registration,
9261            did_create,
9262            will_create,
9263            did_rename,
9264            will_rename,
9265            did_delete,
9266            will_delete,
9267        }
9268    }
9269}
9270
9271/// Client workspace capabilities specific to inline values.
9272///
9273/// @since 3.17.0
9274#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9275#[serde(rename_all = "camelCase")]
9276pub struct InlineValueWorkspaceClientCapabilities {
9277    /// Whether the client implementation supports a refresh request sent from the
9278    /// server to the client.
9279    ///
9280    /// Note that this event is global and will force the client to refresh all
9281    /// inline values currently shown. It should be used with absolute care and is
9282    /// useful for situation where a server for example detects a project wide
9283    /// change that requires such a calculation.
9284    #[serde(skip_serializing_if = "Option::is_none")]
9285    pub refresh_support: Option<bool>,
9286}
9287impl InlineValueWorkspaceClientCapabilities {
9288    #[must_use]
9289    pub const fn new(refresh_support: Option<bool>) -> Self {
9290        Self { refresh_support }
9291    }
9292}
9293
9294/// Client workspace capabilities specific to inlay hints.
9295///
9296/// @since 3.17.0
9297#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9298#[serde(rename_all = "camelCase")]
9299pub struct InlayHintWorkspaceClientCapabilities {
9300    /// Whether the client implementation supports a refresh request sent from
9301    /// the server to the client.
9302    ///
9303    /// Note that this event is global and will force the client to refresh all
9304    /// inlay hints currently shown. It should be used with absolute care and
9305    /// is useful for situation where a server for example detects a project wide
9306    /// change that requires such a calculation.
9307    #[serde(skip_serializing_if = "Option::is_none")]
9308    pub refresh_support: Option<bool>,
9309}
9310impl InlayHintWorkspaceClientCapabilities {
9311    #[must_use]
9312    pub const fn new(refresh_support: Option<bool>) -> Self {
9313        Self { refresh_support }
9314    }
9315}
9316
9317/// Workspace client capabilities specific to diagnostic pull requests.
9318///
9319/// @since 3.17.0
9320#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9321#[serde(rename_all = "camelCase")]
9322pub struct DiagnosticWorkspaceClientCapabilities {
9323    /// Whether the client implementation supports a refresh request sent from
9324    /// the server to the client.
9325    ///
9326    /// Note that this event is global and will force the client to refresh all
9327    /// pulled diagnostics currently shown. It should be used with absolute care and
9328    /// is useful for situation where a server for example detects a project wide
9329    /// change that requires such a calculation.
9330    #[serde(skip_serializing_if = "Option::is_none")]
9331    pub refresh_support: Option<bool>,
9332}
9333impl DiagnosticWorkspaceClientCapabilities {
9334    #[must_use]
9335    pub const fn new(refresh_support: Option<bool>) -> Self {
9336        Self { refresh_support }
9337    }
9338}
9339
9340/// Client workspace capabilities specific to folding ranges
9341///
9342/// @since 3.18.0
9343/// @proposed
9344#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9345#[serde(rename_all = "camelCase")]
9346pub struct FoldingRangeWorkspaceClientCapabilities {
9347    /// Whether the client implementation supports a refresh request sent from the
9348    /// server to the client.
9349    ///
9350    /// Note that this event is global and will force the client to refresh all
9351    /// folding ranges currently shown. It should be used with absolute care and is
9352    /// useful for situation where a server for example detects a project wide
9353    /// change that requires such a calculation.
9354    ///
9355    /// @since 3.18.0
9356    /// @proposed
9357    #[serde(skip_serializing_if = "Option::is_none")]
9358    pub refresh_support: Option<bool>,
9359}
9360impl FoldingRangeWorkspaceClientCapabilities {
9361    #[must_use]
9362    pub const fn new(refresh_support: Option<bool>) -> Self {
9363        Self { refresh_support }
9364    }
9365}
9366
9367/// Client capabilities for a text document content provider.
9368///
9369/// @since 3.18.0
9370/// @proposed
9371#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9372#[serde(rename_all = "camelCase")]
9373pub struct TextDocumentContentClientCapabilities {
9374    /// Text document content provider supports dynamic registration.
9375    #[serde(skip_serializing_if = "Option::is_none")]
9376    pub dynamic_registration: Option<bool>,
9377}
9378impl TextDocumentContentClientCapabilities {
9379    #[must_use]
9380    pub const fn new(dynamic_registration: Option<bool>) -> Self {
9381        Self { dynamic_registration }
9382    }
9383}
9384
9385#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9386#[serde(rename_all = "camelCase")]
9387pub struct TextDocumentSyncClientCapabilities {
9388    /// Whether text document synchronization supports dynamic registration.
9389    #[serde(skip_serializing_if = "Option::is_none")]
9390    pub dynamic_registration: Option<bool>,
9391    /// The client supports sending will save notifications.
9392    #[serde(skip_serializing_if = "Option::is_none")]
9393    pub will_save: Option<bool>,
9394    /// The client supports sending a will save request and
9395    /// waits for a response providing text edits which will
9396    /// be applied to the document before it is saved.
9397    #[serde(skip_serializing_if = "Option::is_none")]
9398    pub will_save_wait_until: Option<bool>,
9399    /// The client supports did save notifications.
9400    #[serde(skip_serializing_if = "Option::is_none")]
9401    pub did_save: Option<bool>,
9402}
9403impl TextDocumentSyncClientCapabilities {
9404    #[must_use]
9405    pub const fn new(
9406        dynamic_registration: Option<bool>,
9407        will_save: Option<bool>,
9408        will_save_wait_until: Option<bool>,
9409        did_save: Option<bool>,
9410    ) -> Self {
9411        Self {
9412            dynamic_registration,
9413            will_save,
9414            will_save_wait_until,
9415            did_save,
9416        }
9417    }
9418}
9419
9420#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9421#[serde(rename_all = "camelCase")]
9422pub struct TextDocumentFilterClientCapabilities {
9423    /// The client supports Relative Patterns.
9424    ///
9425    /// @since 3.18.0
9426    #[serde(skip_serializing_if = "Option::is_none")]
9427    pub relative_pattern_support: Option<bool>,
9428}
9429impl TextDocumentFilterClientCapabilities {
9430    #[must_use]
9431    pub const fn new(relative_pattern_support: Option<bool>) -> Self {
9432        Self { relative_pattern_support }
9433    }
9434}
9435
9436/// Completion client capabilities
9437#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
9438#[serde(rename_all = "camelCase")]
9439pub struct CompletionClientCapabilities {
9440    /// Whether completion supports dynamic registration.
9441    #[serde(skip_serializing_if = "Option::is_none")]
9442    pub dynamic_registration: Option<bool>,
9443    /// The client supports the following `CompletionItem` specific
9444    /// capabilities.
9445    #[serde(skip_serializing_if = "Option::is_none")]
9446    pub completion_item: Option<ClientCompletionItemOptions>,
9447    #[serde(skip_serializing_if = "Option::is_none")]
9448    pub completion_item_kind: Option<ClientCompletionItemOptionsKind>,
9449    /// Defines how the client handles whitespace and indentation
9450    /// when accepting a completion item that uses multi line
9451    /// text in either `insertText` or `textEdit`.
9452    ///
9453    /// @since 3.17.0
9454    #[serde(skip_serializing_if = "Option::is_none")]
9455    pub insert_text_mode: Option<InsertTextMode>,
9456    /// The client supports to send additional context information for a
9457    /// `textDocument/completion` request.
9458    #[serde(skip_serializing_if = "Option::is_none")]
9459    pub context_support: Option<bool>,
9460    /// The client supports the following `CompletionList` specific
9461    /// capabilities.
9462    ///
9463    /// @since 3.17.0
9464    #[serde(skip_serializing_if = "Option::is_none")]
9465    pub completion_list: Option<CompletionListCapabilities>,
9466}
9467impl CompletionClientCapabilities {
9468    #[must_use]
9469    pub const fn new(
9470        dynamic_registration: Option<bool>,
9471        completion_item: Option<ClientCompletionItemOptions>,
9472        completion_item_kind: Option<ClientCompletionItemOptionsKind>,
9473        insert_text_mode: Option<InsertTextMode>,
9474        context_support: Option<bool>,
9475        completion_list: Option<CompletionListCapabilities>,
9476    ) -> Self {
9477        Self {
9478            dynamic_registration,
9479            completion_item,
9480            completion_item_kind,
9481            insert_text_mode,
9482            context_support,
9483            completion_list,
9484        }
9485    }
9486}
9487
9488#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
9489#[serde(rename_all = "camelCase")]
9490pub struct HoverClientCapabilities {
9491    /// Whether hover supports dynamic registration.
9492    #[serde(skip_serializing_if = "Option::is_none")]
9493    pub dynamic_registration: Option<bool>,
9494    /// Client supports the following content formats for the content
9495    /// property. The order describes the preferred format of the client.
9496    #[serde(skip_serializing_if = "Option::is_none")]
9497    pub content_format: Option<Vec<MarkupKind>>,
9498}
9499impl HoverClientCapabilities {
9500    #[must_use]
9501    pub const fn new(
9502        dynamic_registration: Option<bool>,
9503        content_format: Option<Vec<MarkupKind>>,
9504    ) -> Self {
9505        Self {
9506            dynamic_registration,
9507            content_format,
9508        }
9509    }
9510}
9511
9512/// Client Capabilities for a [`SignatureHelpRequest`].
9513#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
9514#[serde(rename_all = "camelCase")]
9515pub struct SignatureHelpClientCapabilities {
9516    /// Whether signature help supports dynamic registration.
9517    #[serde(skip_serializing_if = "Option::is_none")]
9518    pub dynamic_registration: Option<bool>,
9519    /// The client supports the following `SignatureInformation`
9520    /// specific properties.
9521    #[serde(skip_serializing_if = "Option::is_none")]
9522    pub signature_information: Option<ClientSignatureInformationOptions>,
9523    /// The client supports to send additional context information for a
9524    /// `textDocument/signatureHelp` request. A client that opts into
9525    /// contextSupport will also support the `retriggerCharacters` on
9526    /// `SignatureHelpOptions`.
9527    ///
9528    /// @since 3.15.0
9529    #[serde(skip_serializing_if = "Option::is_none")]
9530    pub context_support: Option<bool>,
9531}
9532impl SignatureHelpClientCapabilities {
9533    #[must_use]
9534    pub const fn new(
9535        dynamic_registration: Option<bool>,
9536        signature_information: Option<ClientSignatureInformationOptions>,
9537        context_support: Option<bool>,
9538    ) -> Self {
9539        Self {
9540            dynamic_registration,
9541            signature_information,
9542            context_support,
9543        }
9544    }
9545}
9546
9547/// @since 3.14.0
9548#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9549#[serde(rename_all = "camelCase")]
9550pub struct DeclarationClientCapabilities {
9551    /// Whether declaration supports dynamic registration. If this is set to `true`
9552    /// the client supports the new `DeclarationRegistrationOptions` return value
9553    /// for the corresponding server capability as well.
9554    #[serde(skip_serializing_if = "Option::is_none")]
9555    pub dynamic_registration: Option<bool>,
9556    /// The client supports additional metadata in the form of declaration links.
9557    #[serde(skip_serializing_if = "Option::is_none")]
9558    pub link_support: Option<bool>,
9559}
9560impl DeclarationClientCapabilities {
9561    #[must_use]
9562    pub const fn new(
9563        dynamic_registration: Option<bool>,
9564        link_support: Option<bool>,
9565    ) -> Self {
9566        Self {
9567            dynamic_registration,
9568            link_support,
9569        }
9570    }
9571}
9572
9573/// Client Capabilities for a [`DefinitionRequest`].
9574#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9575#[serde(rename_all = "camelCase")]
9576pub struct DefinitionClientCapabilities {
9577    /// Whether definition supports dynamic registration.
9578    #[serde(skip_serializing_if = "Option::is_none")]
9579    pub dynamic_registration: Option<bool>,
9580    /// The client supports additional metadata in the form of definition links.
9581    ///
9582    /// @since 3.14.0
9583    #[serde(skip_serializing_if = "Option::is_none")]
9584    pub link_support: Option<bool>,
9585}
9586impl DefinitionClientCapabilities {
9587    #[must_use]
9588    pub const fn new(
9589        dynamic_registration: Option<bool>,
9590        link_support: Option<bool>,
9591    ) -> Self {
9592        Self {
9593            dynamic_registration,
9594            link_support,
9595        }
9596    }
9597}
9598
9599/// Since 3.6.0
9600#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9601#[serde(rename_all = "camelCase")]
9602pub struct TypeDefinitionClientCapabilities {
9603    /// Whether implementation supports dynamic registration. If this is set to `true`
9604    /// the client supports the new `TypeDefinitionRegistrationOptions` return value
9605    /// for the corresponding server capability as well.
9606    #[serde(skip_serializing_if = "Option::is_none")]
9607    pub dynamic_registration: Option<bool>,
9608    /// The client supports additional metadata in the form of definition links.
9609    ///
9610    /// Since 3.14.0
9611    #[serde(skip_serializing_if = "Option::is_none")]
9612    pub link_support: Option<bool>,
9613}
9614impl TypeDefinitionClientCapabilities {
9615    #[must_use]
9616    pub const fn new(
9617        dynamic_registration: Option<bool>,
9618        link_support: Option<bool>,
9619    ) -> Self {
9620        Self {
9621            dynamic_registration,
9622            link_support,
9623        }
9624    }
9625}
9626
9627/// @since 3.6.0
9628#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9629#[serde(rename_all = "camelCase")]
9630pub struct ImplementationClientCapabilities {
9631    /// Whether implementation supports dynamic registration. If this is set to `true`
9632    /// the client supports the new `ImplementationRegistrationOptions` return value
9633    /// for the corresponding server capability as well.
9634    #[serde(skip_serializing_if = "Option::is_none")]
9635    pub dynamic_registration: Option<bool>,
9636    /// The client supports additional metadata in the form of definition links.
9637    ///
9638    /// @since 3.14.0
9639    #[serde(skip_serializing_if = "Option::is_none")]
9640    pub link_support: Option<bool>,
9641}
9642impl ImplementationClientCapabilities {
9643    #[must_use]
9644    pub const fn new(
9645        dynamic_registration: Option<bool>,
9646        link_support: Option<bool>,
9647    ) -> Self {
9648        Self {
9649            dynamic_registration,
9650            link_support,
9651        }
9652    }
9653}
9654
9655/// Client Capabilities for a [`ReferencesRequest`].
9656#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9657#[serde(rename_all = "camelCase")]
9658pub struct ReferenceClientCapabilities {
9659    /// Whether references supports dynamic registration.
9660    #[serde(skip_serializing_if = "Option::is_none")]
9661    pub dynamic_registration: Option<bool>,
9662}
9663impl ReferenceClientCapabilities {
9664    #[must_use]
9665    pub const fn new(dynamic_registration: Option<bool>) -> Self {
9666        Self { dynamic_registration }
9667    }
9668}
9669
9670/// Client Capabilities for a [`DocumentHighlightRequest`].
9671#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9672#[serde(rename_all = "camelCase")]
9673pub struct DocumentHighlightClientCapabilities {
9674    /// Whether document highlight supports dynamic registration.
9675    #[serde(skip_serializing_if = "Option::is_none")]
9676    pub dynamic_registration: Option<bool>,
9677}
9678impl DocumentHighlightClientCapabilities {
9679    #[must_use]
9680    pub const fn new(dynamic_registration: Option<bool>) -> Self {
9681        Self { dynamic_registration }
9682    }
9683}
9684
9685/// Client Capabilities for a [`DocumentSymbolRequest`].
9686#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
9687#[serde(rename_all = "camelCase")]
9688pub struct DocumentSymbolClientCapabilities {
9689    /// Whether document symbol supports dynamic registration.
9690    #[serde(skip_serializing_if = "Option::is_none")]
9691    pub dynamic_registration: Option<bool>,
9692    /// Specific capabilities for the `SymbolKind` in the
9693    /// `textDocument/documentSymbol` request.
9694    #[serde(skip_serializing_if = "Option::is_none")]
9695    pub symbol_kind: Option<ClientSymbolKindOptions>,
9696    /// The client supports hierarchical document symbols.
9697    #[serde(skip_serializing_if = "Option::is_none")]
9698    pub hierarchical_document_symbol_support: Option<bool>,
9699    /// The client supports tags on `SymbolInformation`. Tags are supported on
9700    /// `DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true.
9701    /// Clients supporting tags have to handle unknown tags gracefully.
9702    ///
9703    /// @since 3.16.0
9704    #[serde(skip_serializing_if = "Option::is_none")]
9705    pub tag_support: Option<ClientSymbolTagOptions>,
9706    /// The client supports an additional label presented in the UI when
9707    /// registering a document symbol provider.
9708    ///
9709    /// @since 3.16.0
9710    #[serde(skip_serializing_if = "Option::is_none")]
9711    pub label_support: Option<bool>,
9712}
9713impl DocumentSymbolClientCapabilities {
9714    #[must_use]
9715    pub const fn new(
9716        dynamic_registration: Option<bool>,
9717        symbol_kind: Option<ClientSymbolKindOptions>,
9718        hierarchical_document_symbol_support: Option<bool>,
9719        tag_support: Option<ClientSymbolTagOptions>,
9720        label_support: Option<bool>,
9721    ) -> Self {
9722        Self {
9723            dynamic_registration,
9724            symbol_kind,
9725            hierarchical_document_symbol_support,
9726            tag_support,
9727            label_support,
9728        }
9729    }
9730}
9731
9732/// The Client Capabilities of a [`CodeActionRequest`].
9733#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
9734#[serde(rename_all = "camelCase")]
9735pub struct CodeActionClientCapabilities {
9736    /// Whether code action supports dynamic registration.
9737    #[serde(skip_serializing_if = "Option::is_none")]
9738    pub dynamic_registration: Option<bool>,
9739    /// The client support code action literals of type `CodeAction` as a valid
9740    /// response of the `textDocument/codeAction` request. If the property is not
9741    /// set the request can only return `Command` literals.
9742    ///
9743    /// @since 3.8.0
9744    #[serde(skip_serializing_if = "Option::is_none")]
9745    pub code_action_literal_support: Option<ClientCodeActionLiteralOptions>,
9746    /// Whether code action supports the `isPreferred` property.
9747    ///
9748    /// @since 3.15.0
9749    #[serde(skip_serializing_if = "Option::is_none")]
9750    pub is_preferred_support: Option<bool>,
9751    /// Whether code action supports the `disabled` property.
9752    ///
9753    /// @since 3.16.0
9754    #[serde(skip_serializing_if = "Option::is_none")]
9755    pub disabled_support: Option<bool>,
9756    /// Whether code action supports the `data` property which is
9757    /// preserved between a `textDocument/codeAction` and a
9758    /// `codeAction/resolve` request.
9759    ///
9760    /// @since 3.16.0
9761    #[serde(skip_serializing_if = "Option::is_none")]
9762    pub data_support: Option<bool>,
9763    /// Whether the client supports resolving additional code action
9764    /// properties via a separate `codeAction/resolve` request.
9765    ///
9766    /// @since 3.16.0
9767    #[serde(skip_serializing_if = "Option::is_none")]
9768    pub resolve_support: Option<ClientCodeActionResolveOptions>,
9769    /// Whether the client honors the change annotations in
9770    /// text edits and resource operations returned via the
9771    /// `CodeAction#edit` property by for example presenting
9772    /// the workspace edit in the user interface and asking
9773    /// for confirmation.
9774    ///
9775    /// @since 3.16.0
9776    #[serde(skip_serializing_if = "Option::is_none")]
9777    pub honors_change_annotations: Option<bool>,
9778    /// Whether the client supports documentation for a class of
9779    /// code actions.
9780    ///
9781    /// @since 3.18.0
9782    /// @proposed
9783    #[serde(skip_serializing_if = "Option::is_none")]
9784    pub documentation_support: Option<bool>,
9785    /// Client supports the tag property on a code action. Clients
9786    /// supporting tags have to handle unknown tags gracefully.
9787    ///
9788    /// @since 3.18.0 - proposed
9789    #[serde(skip_serializing_if = "Option::is_none")]
9790    pub tag_support: Option<CodeActionTagOptions>,
9791}
9792impl CodeActionClientCapabilities {
9793    #[must_use]
9794    pub const fn new(
9795        dynamic_registration: Option<bool>,
9796        code_action_literal_support: Option<ClientCodeActionLiteralOptions>,
9797        is_preferred_support: Option<bool>,
9798        disabled_support: Option<bool>,
9799        data_support: Option<bool>,
9800        resolve_support: Option<ClientCodeActionResolveOptions>,
9801        honors_change_annotations: Option<bool>,
9802        documentation_support: Option<bool>,
9803        tag_support: Option<CodeActionTagOptions>,
9804    ) -> Self {
9805        Self {
9806            dynamic_registration,
9807            code_action_literal_support,
9808            is_preferred_support,
9809            disabled_support,
9810            data_support,
9811            resolve_support,
9812            honors_change_annotations,
9813            documentation_support,
9814            tag_support,
9815        }
9816    }
9817}
9818
9819/// The client capabilities  of a [`CodeLensRequest`].
9820#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
9821#[serde(rename_all = "camelCase")]
9822pub struct CodeLensClientCapabilities {
9823    /// Whether code lens supports dynamic registration.
9824    #[serde(skip_serializing_if = "Option::is_none")]
9825    pub dynamic_registration: Option<bool>,
9826    /// Whether the client supports resolving additional code lens
9827    /// properties via a separate `codeLens/resolve` request.
9828    ///
9829    /// @since 3.18.0
9830    #[serde(skip_serializing_if = "Option::is_none")]
9831    pub resolve_support: Option<ClientCodeLensResolveOptions>,
9832}
9833impl CodeLensClientCapabilities {
9834    #[must_use]
9835    pub const fn new(
9836        dynamic_registration: Option<bool>,
9837        resolve_support: Option<ClientCodeLensResolveOptions>,
9838    ) -> Self {
9839        Self {
9840            dynamic_registration,
9841            resolve_support,
9842        }
9843    }
9844}
9845
9846/// The client capabilities of a [`DocumentLinkRequest`].
9847#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9848#[serde(rename_all = "camelCase")]
9849pub struct DocumentLinkClientCapabilities {
9850    /// Whether document link supports dynamic registration.
9851    #[serde(skip_serializing_if = "Option::is_none")]
9852    pub dynamic_registration: Option<bool>,
9853    /// Whether the client supports the `tooltip` property on `DocumentLink`.
9854    ///
9855    /// @since 3.15.0
9856    #[serde(skip_serializing_if = "Option::is_none")]
9857    pub tooltip_support: Option<bool>,
9858}
9859impl DocumentLinkClientCapabilities {
9860    #[must_use]
9861    pub const fn new(
9862        dynamic_registration: Option<bool>,
9863        tooltip_support: Option<bool>,
9864    ) -> Self {
9865        Self {
9866            dynamic_registration,
9867            tooltip_support,
9868        }
9869    }
9870}
9871
9872#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9873#[serde(rename_all = "camelCase")]
9874pub struct DocumentColorClientCapabilities {
9875    /// Whether implementation supports dynamic registration. If this is set to `true`
9876    /// the client supports the new `DocumentColorRegistrationOptions` return value
9877    /// for the corresponding server capability as well.
9878    #[serde(skip_serializing_if = "Option::is_none")]
9879    pub dynamic_registration: Option<bool>,
9880}
9881impl DocumentColorClientCapabilities {
9882    #[must_use]
9883    pub const fn new(dynamic_registration: Option<bool>) -> Self {
9884        Self { dynamic_registration }
9885    }
9886}
9887
9888/// Client capabilities of a [`DocumentFormattingRequest`].
9889#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9890#[serde(rename_all = "camelCase")]
9891pub struct DocumentFormattingClientCapabilities {
9892    /// Whether formatting supports dynamic registration.
9893    #[serde(skip_serializing_if = "Option::is_none")]
9894    pub dynamic_registration: Option<bool>,
9895}
9896impl DocumentFormattingClientCapabilities {
9897    #[must_use]
9898    pub const fn new(dynamic_registration: Option<bool>) -> Self {
9899        Self { dynamic_registration }
9900    }
9901}
9902
9903/// Client capabilities of a [`DocumentRangeFormattingRequest`].
9904#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9905#[serde(rename_all = "camelCase")]
9906pub struct DocumentRangeFormattingClientCapabilities {
9907    /// Whether range formatting supports dynamic registration.
9908    #[serde(skip_serializing_if = "Option::is_none")]
9909    pub dynamic_registration: Option<bool>,
9910    /// Whether the client supports formatting multiple ranges at once.
9911    ///
9912    /// @since 3.18.0
9913    /// @proposed
9914    #[serde(skip_serializing_if = "Option::is_none")]
9915    pub ranges_support: Option<bool>,
9916}
9917impl DocumentRangeFormattingClientCapabilities {
9918    #[must_use]
9919    pub const fn new(
9920        dynamic_registration: Option<bool>,
9921        ranges_support: Option<bool>,
9922    ) -> Self {
9923        Self {
9924            dynamic_registration,
9925            ranges_support,
9926        }
9927    }
9928}
9929
9930/// Client capabilities of a [`DocumentOnTypeFormattingRequest`].
9931#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9932#[serde(rename_all = "camelCase")]
9933pub struct DocumentOnTypeFormattingClientCapabilities {
9934    /// Whether on type formatting supports dynamic registration.
9935    #[serde(skip_serializing_if = "Option::is_none")]
9936    pub dynamic_registration: Option<bool>,
9937}
9938impl DocumentOnTypeFormattingClientCapabilities {
9939    #[must_use]
9940    pub const fn new(dynamic_registration: Option<bool>) -> Self {
9941        Self { dynamic_registration }
9942    }
9943}
9944
9945#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
9946#[serde(rename_all = "camelCase")]
9947pub struct RenameClientCapabilities {
9948    /// Whether rename supports dynamic registration.
9949    #[serde(skip_serializing_if = "Option::is_none")]
9950    pub dynamic_registration: Option<bool>,
9951    /// Client supports testing for validity of rename operations
9952    /// before execution.
9953    ///
9954    /// @since 3.12.0
9955    #[serde(skip_serializing_if = "Option::is_none")]
9956    pub prepare_support: Option<bool>,
9957    /// Client supports the default behavior result.
9958    ///
9959    /// The value indicates the default behavior used by the
9960    /// client.
9961    ///
9962    /// @since 3.16.0
9963    #[serde(skip_serializing_if = "Option::is_none")]
9964    pub prepare_support_default_behavior: Option<PrepareSupportDefaultBehavior>,
9965    /// Whether the client honors the change annotations in
9966    /// text edits and resource operations returned via the
9967    /// rename request's workspace edit by for example presenting
9968    /// the workspace edit in the user interface and asking
9969    /// for confirmation.
9970    ///
9971    /// @since 3.16.0
9972    #[serde(skip_serializing_if = "Option::is_none")]
9973    pub honors_change_annotations: Option<bool>,
9974}
9975impl RenameClientCapabilities {
9976    #[must_use]
9977    pub const fn new(
9978        dynamic_registration: Option<bool>,
9979        prepare_support: Option<bool>,
9980        prepare_support_default_behavior: Option<PrepareSupportDefaultBehavior>,
9981        honors_change_annotations: Option<bool>,
9982    ) -> Self {
9983        Self {
9984            dynamic_registration,
9985            prepare_support,
9986            prepare_support_default_behavior,
9987            honors_change_annotations,
9988        }
9989    }
9990}
9991
9992#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
9993#[serde(rename_all = "camelCase")]
9994pub struct FoldingRangeClientCapabilities {
9995    /// Whether implementation supports dynamic registration for folding range
9996    /// providers. If this is set to `true` the client supports the new
9997    /// `FoldingRangeRegistrationOptions` return value for the corresponding
9998    /// server capability as well.
9999    #[serde(skip_serializing_if = "Option::is_none")]
10000    pub dynamic_registration: Option<bool>,
10001    /// The maximum number of folding ranges that the client prefers to receive
10002    /// per document. The value serves as a hint, servers are free to follow the
10003    /// limit.
10004    #[serde(skip_serializing_if = "Option::is_none")]
10005    pub range_limit: Option<u32>,
10006    /// If set, the client signals that it only supports folding complete lines.
10007    /// If set, client will ignore specified `startCharacter` and `endCharacter`
10008    /// properties in a FoldingRange.
10009    #[serde(skip_serializing_if = "Option::is_none")]
10010    pub line_folding_only: Option<bool>,
10011    /// Specific options for the folding range kind.
10012    ///
10013    /// @since 3.17.0
10014    #[serde(skip_serializing_if = "Option::is_none")]
10015    pub folding_range_kind: Option<ClientFoldingRangeKindOptions>,
10016    /// Specific options for the folding range.
10017    ///
10018    /// @since 3.17.0
10019    #[serde(skip_serializing_if = "Option::is_none")]
10020    pub folding_range: Option<ClientFoldingRangeOptions>,
10021}
10022impl FoldingRangeClientCapabilities {
10023    #[must_use]
10024    pub const fn new(
10025        dynamic_registration: Option<bool>,
10026        range_limit: Option<u32>,
10027        line_folding_only: Option<bool>,
10028        folding_range_kind: Option<ClientFoldingRangeKindOptions>,
10029        folding_range: Option<ClientFoldingRangeOptions>,
10030    ) -> Self {
10031        Self {
10032            dynamic_registration,
10033            range_limit,
10034            line_folding_only,
10035            folding_range_kind,
10036            folding_range,
10037        }
10038    }
10039}
10040
10041#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
10042#[serde(rename_all = "camelCase")]
10043pub struct SelectionRangeClientCapabilities {
10044    /// Whether implementation supports dynamic registration for selection range providers. If this is set to `true`
10045    /// the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server
10046    /// capability as well.
10047    #[serde(skip_serializing_if = "Option::is_none")]
10048    pub dynamic_registration: Option<bool>,
10049}
10050impl SelectionRangeClientCapabilities {
10051    #[must_use]
10052    pub const fn new(dynamic_registration: Option<bool>) -> Self {
10053        Self { dynamic_registration }
10054    }
10055}
10056
10057/// The publish diagnostic client capabilities.
10058#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10059#[serde(rename_all = "camelCase")]
10060pub struct PublishDiagnosticsClientCapabilities {
10061    /// Whether the client interprets the version property of the
10062    /// `textDocument/publishDiagnostics` notification's parameter.
10063    ///
10064    /// @since 3.15.0
10065    #[serde(skip_serializing_if = "Option::is_none")]
10066    pub version_support: Option<bool>,
10067    #[serde(flatten)]
10068    pub diagnostics_capabilities: DiagnosticsCapabilities,
10069}
10070impl PublishDiagnosticsClientCapabilities {
10071    #[must_use]
10072    pub const fn new(
10073        version_support: Option<bool>,
10074        diagnostics_capabilities: DiagnosticsCapabilities,
10075    ) -> Self {
10076        Self {
10077            version_support,
10078            diagnostics_capabilities,
10079        }
10080    }
10081}
10082
10083/// @since 3.16.0
10084#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
10085#[serde(rename_all = "camelCase")]
10086pub struct CallHierarchyClientCapabilities {
10087    /// Whether implementation supports dynamic registration. If this is set to `true`
10088    /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
10089    /// return value for the corresponding server capability as well.
10090    #[serde(skip_serializing_if = "Option::is_none")]
10091    pub dynamic_registration: Option<bool>,
10092}
10093impl CallHierarchyClientCapabilities {
10094    #[must_use]
10095    pub const fn new(dynamic_registration: Option<bool>) -> Self {
10096        Self { dynamic_registration }
10097    }
10098}
10099
10100/// @since 3.16.0
10101#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
10102#[serde(rename_all = "camelCase")]
10103pub struct SemanticTokensClientCapabilities {
10104    /// Whether implementation supports dynamic registration. If this is set to `true`
10105    /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
10106    /// return value for the corresponding server capability as well.
10107    #[serde(skip_serializing_if = "Option::is_none")]
10108    pub dynamic_registration: Option<bool>,
10109    /// Which requests the client supports and might send to the server
10110    /// depending on the server's capability. Please note that clients might not
10111    /// show semantic tokens or degrade some of the user experience if a range
10112    /// or full request is advertised by the client but not provided by the
10113    /// server. If for example the client capability `requests.full` and
10114    /// `request.range` are both set to true but the server only provides a
10115    /// range provider the client might not render a minimap correctly or might
10116    /// even decide to not show any semantic tokens at all.
10117    pub requests: ClientSemanticTokensRequestOptions,
10118    /// The token types that the client supports.
10119    pub token_types: Vec<String>,
10120    /// The token modifiers that the client supports.
10121    pub token_modifiers: Vec<String>,
10122    /// The token formats the clients supports.
10123    pub formats: Vec<TokenFormat>,
10124    /// Whether the client supports tokens that can overlap each other.
10125    #[serde(skip_serializing_if = "Option::is_none")]
10126    pub overlapping_token_support: Option<bool>,
10127    /// Whether the client supports tokens that can span multiple lines.
10128    #[serde(skip_serializing_if = "Option::is_none")]
10129    pub multiline_token_support: Option<bool>,
10130    /// Whether the client allows the server to actively cancel a
10131    /// semantic token request, e.g. supports returning
10132    /// LSPErrorCodes.ServerCancelled. If a server does the client
10133    /// needs to retrigger the request.
10134    ///
10135    /// @since 3.17.0
10136    #[serde(skip_serializing_if = "Option::is_none")]
10137    pub server_cancel_support: Option<bool>,
10138    /// Whether the client uses semantic tokens to augment existing
10139    /// syntax tokens. If set to `true` client side created syntax
10140    /// tokens and semantic tokens are both used for colorization. If
10141    /// set to `false` the client only uses the returned semantic tokens
10142    /// for colorization.
10143    ///
10144    /// If the value is `undefined` then the client behavior is not
10145    /// specified.
10146    ///
10147    /// @since 3.17.0
10148    #[serde(skip_serializing_if = "Option::is_none")]
10149    pub augments_syntax_tokens: Option<bool>,
10150}
10151impl SemanticTokensClientCapabilities {
10152    #[must_use]
10153    pub const fn new(
10154        dynamic_registration: Option<bool>,
10155        requests: ClientSemanticTokensRequestOptions,
10156        token_types: Vec<String>,
10157        token_modifiers: Vec<String>,
10158        formats: Vec<TokenFormat>,
10159        overlapping_token_support: Option<bool>,
10160        multiline_token_support: Option<bool>,
10161        server_cancel_support: Option<bool>,
10162        augments_syntax_tokens: Option<bool>,
10163    ) -> Self {
10164        Self {
10165            dynamic_registration,
10166            requests,
10167            token_types,
10168            token_modifiers,
10169            formats,
10170            overlapping_token_support,
10171            multiline_token_support,
10172            server_cancel_support,
10173            augments_syntax_tokens,
10174        }
10175    }
10176}
10177
10178/// Client capabilities for the linked editing range request.
10179///
10180/// @since 3.16.0
10181#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
10182#[serde(rename_all = "camelCase")]
10183pub struct LinkedEditingRangeClientCapabilities {
10184    /// Whether implementation supports dynamic registration. If this is set to `true`
10185    /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
10186    /// return value for the corresponding server capability as well.
10187    #[serde(skip_serializing_if = "Option::is_none")]
10188    pub dynamic_registration: Option<bool>,
10189}
10190impl LinkedEditingRangeClientCapabilities {
10191    #[must_use]
10192    pub const fn new(dynamic_registration: Option<bool>) -> Self {
10193        Self { dynamic_registration }
10194    }
10195}
10196
10197/// Client capabilities specific to the moniker request.
10198///
10199/// @since 3.16.0
10200#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
10201#[serde(rename_all = "camelCase")]
10202pub struct MonikerClientCapabilities {
10203    /// Whether moniker supports dynamic registration. If this is set to `true`
10204    /// the client supports the new `MonikerRegistrationOptions` return value
10205    /// for the corresponding server capability as well.
10206    #[serde(skip_serializing_if = "Option::is_none")]
10207    pub dynamic_registration: Option<bool>,
10208}
10209impl MonikerClientCapabilities {
10210    #[must_use]
10211    pub const fn new(dynamic_registration: Option<bool>) -> Self {
10212        Self { dynamic_registration }
10213    }
10214}
10215
10216/// @since 3.17.0
10217#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
10218#[serde(rename_all = "camelCase")]
10219pub struct TypeHierarchyClientCapabilities {
10220    /// Whether implementation supports dynamic registration. If this is set to `true`
10221    /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
10222    /// return value for the corresponding server capability as well.
10223    #[serde(skip_serializing_if = "Option::is_none")]
10224    pub dynamic_registration: Option<bool>,
10225}
10226impl TypeHierarchyClientCapabilities {
10227    #[must_use]
10228    pub const fn new(dynamic_registration: Option<bool>) -> Self {
10229        Self { dynamic_registration }
10230    }
10231}
10232
10233/// Client capabilities specific to inline values.
10234///
10235/// @since 3.17.0
10236#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
10237#[serde(rename_all = "camelCase")]
10238pub struct InlineValueClientCapabilities {
10239    /// Whether implementation supports dynamic registration for inline value providers.
10240    #[serde(skip_serializing_if = "Option::is_none")]
10241    pub dynamic_registration: Option<bool>,
10242}
10243impl InlineValueClientCapabilities {
10244    #[must_use]
10245    pub const fn new(dynamic_registration: Option<bool>) -> Self {
10246        Self { dynamic_registration }
10247    }
10248}
10249
10250/// Inlay hint client capabilities.
10251///
10252/// @since 3.17.0
10253#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10254#[serde(rename_all = "camelCase")]
10255pub struct InlayHintClientCapabilities {
10256    /// Whether inlay hints support dynamic registration.
10257    #[serde(skip_serializing_if = "Option::is_none")]
10258    pub dynamic_registration: Option<bool>,
10259    /// Indicates which properties a client can resolve lazily on an inlay
10260    /// hint.
10261    #[serde(skip_serializing_if = "Option::is_none")]
10262    pub resolve_support: Option<ClientInlayHintResolveOptions>,
10263}
10264impl InlayHintClientCapabilities {
10265    #[must_use]
10266    pub const fn new(
10267        dynamic_registration: Option<bool>,
10268        resolve_support: Option<ClientInlayHintResolveOptions>,
10269    ) -> Self {
10270        Self {
10271            dynamic_registration,
10272            resolve_support,
10273        }
10274    }
10275}
10276
10277/// Client capabilities specific to diagnostic pull requests.
10278///
10279/// @since 3.17.0
10280#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10281#[serde(rename_all = "camelCase")]
10282pub struct DiagnosticClientCapabilities {
10283    /// Whether implementation supports dynamic registration. If this is set to `true`
10284    /// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
10285    /// return value for the corresponding server capability as well.
10286    #[serde(skip_serializing_if = "Option::is_none")]
10287    pub dynamic_registration: Option<bool>,
10288    /// Whether the clients supports related documents for document diagnostic pulls.
10289    #[serde(skip_serializing_if = "Option::is_none")]
10290    pub related_document_support: Option<bool>,
10291    /// Whether the client supports `MarkupContent` in diagnostic messages.
10292    ///
10293    /// @since 3.18.0
10294    /// @proposed
10295    #[serde(skip_serializing_if = "Option::is_none")]
10296    pub markup_message_support: Option<bool>,
10297    #[serde(flatten)]
10298    pub diagnostics_capabilities: DiagnosticsCapabilities,
10299}
10300impl DiagnosticClientCapabilities {
10301    #[must_use]
10302    pub const fn new(
10303        dynamic_registration: Option<bool>,
10304        related_document_support: Option<bool>,
10305        markup_message_support: Option<bool>,
10306        diagnostics_capabilities: DiagnosticsCapabilities,
10307    ) -> Self {
10308        Self {
10309            dynamic_registration,
10310            related_document_support,
10311            markup_message_support,
10312            diagnostics_capabilities,
10313        }
10314    }
10315}
10316
10317/// Client capabilities specific to inline completions.
10318///
10319/// @since 3.18.0
10320/// @proposed
10321#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
10322#[serde(rename_all = "camelCase")]
10323pub struct InlineCompletionClientCapabilities {
10324    /// Whether implementation supports dynamic registration for inline completion providers.
10325    #[serde(skip_serializing_if = "Option::is_none")]
10326    pub dynamic_registration: Option<bool>,
10327}
10328impl InlineCompletionClientCapabilities {
10329    #[must_use]
10330    pub const fn new(dynamic_registration: Option<bool>) -> Self {
10331        Self { dynamic_registration }
10332    }
10333}
10334
10335/// Notebook specific client capabilities.
10336///
10337/// @since 3.17.0
10338#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
10339#[serde(rename_all = "camelCase")]
10340pub struct NotebookDocumentSyncClientCapabilities {
10341    /// Whether implementation supports dynamic registration. If this is
10342    /// set to `true` the client supports the new
10343    /// `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
10344    /// return value for the corresponding server capability as well.
10345    #[serde(skip_serializing_if = "Option::is_none")]
10346    pub dynamic_registration: Option<bool>,
10347    /// The client supports sending execution summary data per cell.
10348    #[serde(skip_serializing_if = "Option::is_none")]
10349    pub execution_summary_support: Option<bool>,
10350}
10351impl NotebookDocumentSyncClientCapabilities {
10352    #[must_use]
10353    pub const fn new(
10354        dynamic_registration: Option<bool>,
10355        execution_summary_support: Option<bool>,
10356    ) -> Self {
10357        Self {
10358            dynamic_registration,
10359            execution_summary_support,
10360        }
10361    }
10362}
10363
10364/// Show message request client capabilities
10365#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
10366#[serde(rename_all = "camelCase")]
10367pub struct ShowMessageRequestClientCapabilities {
10368    /// Capabilities specific to the `MessageActionItem` type.
10369    #[serde(skip_serializing_if = "Option::is_none")]
10370    pub message_action_item: Option<ClientShowMessageActionItemOptions>,
10371}
10372impl ShowMessageRequestClientCapabilities {
10373    #[must_use]
10374    pub const fn new(
10375        message_action_item: Option<ClientShowMessageActionItemOptions>,
10376    ) -> Self {
10377        Self { message_action_item }
10378    }
10379}
10380
10381/// Client capabilities for the showDocument request.
10382///
10383/// @since 3.16.0
10384#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
10385#[serde(rename_all = "camelCase")]
10386pub struct ShowDocumentClientCapabilities {
10387    /// The client has support for the showDocument
10388    /// request.
10389    pub support: bool,
10390}
10391impl ShowDocumentClientCapabilities {
10392    #[must_use]
10393    pub const fn new(support: bool) -> Self {
10394        Self { support }
10395    }
10396}
10397
10398/// @since 3.18.0
10399#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10400#[serde(rename_all = "camelCase")]
10401pub struct StaleRequestSupportOptions {
10402    /// The client will actively cancel the request.
10403    pub cancel: bool,
10404    /// The list of requests for which the client
10405    /// will retry the request if it receives a
10406    /// response with error code `ContentModified`
10407    pub retry_on_content_modified: Vec<String>,
10408}
10409impl StaleRequestSupportOptions {
10410    #[must_use]
10411    pub const fn new(cancel: bool, retry_on_content_modified: Vec<String>) -> Self {
10412        Self {
10413            cancel,
10414            retry_on_content_modified,
10415        }
10416    }
10417}
10418
10419/// Client capabilities specific to regular expressions.
10420///
10421/// @since 3.16.0
10422#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10423#[serde(rename_all = "camelCase")]
10424pub struct RegularExpressionsClientCapabilities {
10425    /// The engine's name.
10426    pub engine: RegularExpressionEngineKind,
10427    /// The engine's version.
10428    #[serde(skip_serializing_if = "Option::is_none")]
10429    pub version: Option<String>,
10430}
10431impl RegularExpressionsClientCapabilities {
10432    #[must_use]
10433    pub const fn new(
10434        engine: RegularExpressionEngineKind,
10435        version: Option<String>,
10436    ) -> Self {
10437        Self { engine, version }
10438    }
10439}
10440
10441/// Client capabilities specific to the used markdown parser.
10442///
10443/// @since 3.16.0
10444#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10445#[serde(rename_all = "camelCase")]
10446pub struct MarkdownClientCapabilities {
10447    /// The name of the parser.
10448    pub parser: String,
10449    /// The version of the parser.
10450    #[serde(skip_serializing_if = "Option::is_none")]
10451    pub version: Option<String>,
10452    /// A list of HTML tags that the client allows / supports in
10453    /// Markdown.
10454    ///
10455    /// @since 3.17.0
10456    #[serde(skip_serializing_if = "Option::is_none")]
10457    pub allowed_tags: Option<Vec<String>>,
10458}
10459impl MarkdownClientCapabilities {
10460    #[must_use]
10461    pub const fn new(
10462        parser: String,
10463        version: Option<String>,
10464        allowed_tags: Option<Vec<String>>,
10465    ) -> Self {
10466        Self {
10467            parser,
10468            version,
10469            allowed_tags,
10470        }
10471    }
10472}
10473
10474/// @since 3.18.0
10475#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
10476#[serde(rename_all = "camelCase")]
10477pub struct ChangeAnnotationsSupportOptions {
10478    /// Whether the client groups edits with equal labels into tree nodes,
10479    /// for instance all edits labelled with "Changes in Strings" would
10480    /// be a tree node.
10481    #[serde(skip_serializing_if = "Option::is_none")]
10482    pub groups_on_label: Option<bool>,
10483}
10484impl ChangeAnnotationsSupportOptions {
10485    #[must_use]
10486    pub const fn new(groups_on_label: Option<bool>) -> Self {
10487        Self { groups_on_label }
10488    }
10489}
10490
10491/// @since 3.18.0
10492#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10493#[serde(rename_all = "camelCase")]
10494pub struct ClientSymbolKindOptions {
10495    /// The symbol kind values the client supports. When this
10496    /// property exists the client also guarantees that it will
10497    /// handle values outside its set gracefully and falls back
10498    /// to a default value when unknown.
10499    ///
10500    /// If this property is not present the client only supports
10501    /// the symbol kinds from `File` to `Array` as defined in
10502    /// the initial version of the protocol.
10503    #[serde(skip_serializing_if = "Option::is_none")]
10504    pub value_set: Option<Vec<SymbolKind>>,
10505}
10506impl ClientSymbolKindOptions {
10507    #[must_use]
10508    pub const fn new(value_set: Option<Vec<SymbolKind>>) -> Self {
10509        Self { value_set }
10510    }
10511}
10512
10513/// @since 3.18.0
10514#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10515#[serde(rename_all = "camelCase")]
10516pub struct ClientSymbolTagOptions {
10517    /// The tags supported by the client.
10518    pub value_set: Vec<SymbolTag>,
10519}
10520impl ClientSymbolTagOptions {
10521    #[must_use]
10522    pub const fn new(value_set: Vec<SymbolTag>) -> Self {
10523        Self { value_set }
10524    }
10525}
10526
10527/// @since 3.18.0
10528#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10529#[serde(rename_all = "camelCase")]
10530pub struct ClientSymbolResolveOptions {
10531    /// The properties that a client can resolve lazily. Usually
10532    /// `location.range`
10533    pub properties: Vec<String>,
10534}
10535impl ClientSymbolResolveOptions {
10536    #[must_use]
10537    pub const fn new(properties: Vec<String>) -> Self {
10538        Self { properties }
10539    }
10540}
10541
10542/// @since 3.18.0
10543#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10544#[serde(rename_all = "camelCase")]
10545pub struct ClientCompletionItemOptions {
10546    /// Client supports snippets as insert text.
10547    ///
10548    /// A snippet can define tab stops and placeholders with `$1`, `$2`
10549    /// and `${3:foo}`. `$0` defines the final tab stop, it defaults to
10550    /// the end of the snippet. Placeholders with equal identifiers are linked,
10551    /// that is typing in one will update others too.
10552    #[serde(skip_serializing_if = "Option::is_none")]
10553    pub snippet_support: Option<bool>,
10554    /// Client supports commit characters on a completion item.
10555    #[serde(skip_serializing_if = "Option::is_none")]
10556    pub commit_characters_support: Option<bool>,
10557    /// Client supports the following content formats for the documentation
10558    /// property. The order describes the preferred format of the client.
10559    #[serde(skip_serializing_if = "Option::is_none")]
10560    pub documentation_format: Option<Vec<MarkupKind>>,
10561    /// Client supports the deprecated property on a completion item.
10562    #[serde(skip_serializing_if = "Option::is_none")]
10563    pub deprecated_support: Option<bool>,
10564    /// Client supports the preselect property on a completion item.
10565    #[serde(skip_serializing_if = "Option::is_none")]
10566    pub preselect_support: Option<bool>,
10567    /// Client supports the tag property on a completion item. Clients supporting
10568    /// tags have to handle unknown tags gracefully. Clients especially need to
10569    /// preserve unknown tags when sending a completion item back to the server in
10570    /// a resolve call.
10571    ///
10572    /// @since 3.15.0
10573    #[serde(skip_serializing_if = "Option::is_none")]
10574    pub tag_support: Option<CompletionItemTagOptions>,
10575    /// Client support insert replace edit to control different behavior if a
10576    /// completion item is inserted in the text or should replace text.
10577    ///
10578    /// @since 3.16.0
10579    #[serde(skip_serializing_if = "Option::is_none")]
10580    pub insert_replace_support: Option<bool>,
10581    /// Indicates which properties a client can resolve lazily on a completion
10582    /// item. Before version 3.16.0 only the predefined properties `documentation`
10583    /// and `details` could be resolved lazily.
10584    ///
10585    /// @since 3.16.0
10586    #[serde(skip_serializing_if = "Option::is_none")]
10587    pub resolve_support: Option<ClientCompletionItemResolveOptions>,
10588    /// The client supports the `insertTextMode` property on
10589    /// a completion item to override the whitespace handling mode
10590    /// as defined by the client (see `insertTextMode`).
10591    ///
10592    /// @since 3.16.0
10593    #[serde(skip_serializing_if = "Option::is_none")]
10594    pub insert_text_mode_support: Option<ClientCompletionItemInsertTextModeOptions>,
10595    /// The client has support for completion item label
10596    /// details (see also `CompletionItemLabelDetails`).
10597    ///
10598    /// @since 3.17.0
10599    #[serde(skip_serializing_if = "Option::is_none")]
10600    pub label_details_support: Option<bool>,
10601}
10602impl ClientCompletionItemOptions {
10603    #[must_use]
10604    pub const fn new(
10605        snippet_support: Option<bool>,
10606        commit_characters_support: Option<bool>,
10607        documentation_format: Option<Vec<MarkupKind>>,
10608        deprecated_support: Option<bool>,
10609        preselect_support: Option<bool>,
10610        tag_support: Option<CompletionItemTagOptions>,
10611        insert_replace_support: Option<bool>,
10612        resolve_support: Option<ClientCompletionItemResolveOptions>,
10613        insert_text_mode_support: Option<ClientCompletionItemInsertTextModeOptions>,
10614        label_details_support: Option<bool>,
10615    ) -> Self {
10616        Self {
10617            snippet_support,
10618            commit_characters_support,
10619            documentation_format,
10620            deprecated_support,
10621            preselect_support,
10622            tag_support,
10623            insert_replace_support,
10624            resolve_support,
10625            insert_text_mode_support,
10626            label_details_support,
10627        }
10628    }
10629}
10630
10631/// @since 3.18.0
10632#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10633#[serde(rename_all = "camelCase")]
10634pub struct ClientCompletionItemOptionsKind {
10635    /// The completion item kind values the client supports. When this
10636    /// property exists the client also guarantees that it will
10637    /// handle values outside its set gracefully and falls back
10638    /// to a default value when unknown.
10639    ///
10640    /// If this property is not present the client only supports
10641    /// the completion items kinds from `Text` to `Reference` as defined in
10642    /// the initial version of the protocol.
10643    #[serde(skip_serializing_if = "Option::is_none")]
10644    pub value_set: Option<Vec<CompletionItemKind>>,
10645}
10646impl ClientCompletionItemOptionsKind {
10647    #[must_use]
10648    pub const fn new(value_set: Option<Vec<CompletionItemKind>>) -> Self {
10649        Self { value_set }
10650    }
10651}
10652
10653/// The client supports the following `CompletionList` specific
10654/// capabilities.
10655///
10656/// @since 3.17.0
10657#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10658#[serde(rename_all = "camelCase")]
10659pub struct CompletionListCapabilities {
10660    /// The client supports the following itemDefaults on
10661    /// a completion list.
10662    ///
10663    /// The value lists the supported property names of the
10664    /// `CompletionList.itemDefaults` object. If omitted
10665    /// no properties are supported.
10666    ///
10667    /// @since 3.17.0
10668    #[serde(skip_serializing_if = "Option::is_none")]
10669    pub item_defaults: Option<Vec<String>>,
10670    /// Specifies whether the client supports `CompletionList.applyKind` to
10671    /// indicate how supported values from `completionList.itemDefaults`
10672    /// and `completion` will be combined.
10673    ///
10674    /// If a client supports `applyKind` it must support it for all fields
10675    /// that it supports that are listed in `CompletionList.applyKind`. This
10676    /// means when clients add support for new/future fields in completion
10677    /// items the MUST also support merge for them if those fields are
10678    /// defined in `CompletionList.applyKind`.
10679    ///
10680    /// @since 3.18.0
10681    #[serde(skip_serializing_if = "Option::is_none")]
10682    pub apply_kind_support: Option<bool>,
10683}
10684impl CompletionListCapabilities {
10685    #[must_use]
10686    pub const fn new(
10687        item_defaults: Option<Vec<String>>,
10688        apply_kind_support: Option<bool>,
10689    ) -> Self {
10690        Self {
10691            item_defaults,
10692            apply_kind_support,
10693        }
10694    }
10695}
10696
10697/// @since 3.18.0
10698#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10699#[serde(rename_all = "camelCase")]
10700pub struct ClientSignatureInformationOptions {
10701    /// Client supports the following content formats for the documentation
10702    /// property. The order describes the preferred format of the client.
10703    #[serde(skip_serializing_if = "Option::is_none")]
10704    pub documentation_format: Option<Vec<MarkupKind>>,
10705    /// Client capabilities specific to parameter information.
10706    #[serde(skip_serializing_if = "Option::is_none")]
10707    pub parameter_information: Option<ClientSignatureParameterInformationOptions>,
10708    /// The client supports the `activeParameter` property on `SignatureInformation`
10709    /// literal.
10710    ///
10711    /// @since 3.16.0
10712    #[serde(skip_serializing_if = "Option::is_none")]
10713    pub active_parameter_support: Option<bool>,
10714    /// The client supports the `activeParameter` property on
10715    /// `SignatureHelp`/`SignatureInformation` being set to `null` to
10716    /// indicate that no parameter should be active.
10717    ///
10718    /// @since 3.18.0
10719    /// @proposed
10720    #[serde(skip_serializing_if = "Option::is_none")]
10721    pub no_active_parameter_support: Option<bool>,
10722}
10723impl ClientSignatureInformationOptions {
10724    #[must_use]
10725    pub const fn new(
10726        documentation_format: Option<Vec<MarkupKind>>,
10727        parameter_information: Option<ClientSignatureParameterInformationOptions>,
10728        active_parameter_support: Option<bool>,
10729        no_active_parameter_support: Option<bool>,
10730    ) -> Self {
10731        Self {
10732            documentation_format,
10733            parameter_information,
10734            active_parameter_support,
10735            no_active_parameter_support,
10736        }
10737    }
10738}
10739
10740/// @since 3.18.0
10741#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10742#[serde(rename_all = "camelCase")]
10743pub struct ClientCodeActionLiteralOptions {
10744    /// The code action kind is support with the following value
10745    /// set.
10746    pub code_action_kind: ClientCodeActionKindOptions,
10747}
10748impl ClientCodeActionLiteralOptions {
10749    #[must_use]
10750    pub const fn new(code_action_kind: ClientCodeActionKindOptions) -> Self {
10751        Self { code_action_kind }
10752    }
10753}
10754
10755/// @since 3.18.0
10756#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10757#[serde(rename_all = "camelCase")]
10758pub struct ClientCodeActionResolveOptions {
10759    /// The properties that a client can resolve lazily.
10760    pub properties: Vec<String>,
10761}
10762impl ClientCodeActionResolveOptions {
10763    #[must_use]
10764    pub const fn new(properties: Vec<String>) -> Self {
10765        Self { properties }
10766    }
10767}
10768
10769/// @since 3.18.0 - proposed
10770#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10771#[serde(rename_all = "camelCase")]
10772pub struct CodeActionTagOptions {
10773    /// The tags supported by the client.
10774    pub value_set: Vec<CodeActionTag>,
10775}
10776impl CodeActionTagOptions {
10777    #[must_use]
10778    pub const fn new(value_set: Vec<CodeActionTag>) -> Self {
10779        Self { value_set }
10780    }
10781}
10782
10783/// @since 3.18.0
10784#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10785#[serde(rename_all = "camelCase")]
10786pub struct ClientCodeLensResolveOptions {
10787    /// The properties that a client can resolve lazily.
10788    pub properties: Vec<String>,
10789}
10790impl ClientCodeLensResolveOptions {
10791    #[must_use]
10792    pub const fn new(properties: Vec<String>) -> Self {
10793        Self { properties }
10794    }
10795}
10796
10797/// @since 3.18.0
10798#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10799#[serde(rename_all = "camelCase")]
10800pub struct ClientFoldingRangeKindOptions {
10801    /// The folding range kind values the client supports. When this
10802    /// property exists the client also guarantees that it will
10803    /// handle values outside its set gracefully and falls back
10804    /// to a default value when unknown.
10805    #[serde(skip_serializing_if = "Option::is_none")]
10806    pub value_set: Option<Vec<FoldingRangeKind>>,
10807}
10808impl ClientFoldingRangeKindOptions {
10809    #[must_use]
10810    pub const fn new(value_set: Option<Vec<FoldingRangeKind>>) -> Self {
10811        Self { value_set }
10812    }
10813}
10814
10815/// @since 3.18.0
10816#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
10817#[serde(rename_all = "camelCase")]
10818pub struct ClientFoldingRangeOptions {
10819    /// If set, the client signals that it supports setting collapsedText on
10820    /// folding ranges to display custom labels instead of the default text.
10821    ///
10822    /// @since 3.17.0
10823    #[serde(skip_serializing_if = "Option::is_none")]
10824    pub collapsed_text: Option<bool>,
10825}
10826impl ClientFoldingRangeOptions {
10827    #[must_use]
10828    pub const fn new(collapsed_text: Option<bool>) -> Self {
10829        Self { collapsed_text }
10830    }
10831}
10832
10833/// General diagnostics capabilities for pull and push model.
10834#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10835#[serde(rename_all = "camelCase")]
10836pub struct DiagnosticsCapabilities {
10837    /// Whether the clients accepts diagnostics with related information.
10838    #[serde(skip_serializing_if = "Option::is_none")]
10839    pub related_information: Option<bool>,
10840    /// Client supports the tag property to provide meta data about a diagnostic.
10841    /// Clients supporting tags have to handle unknown tags gracefully.
10842    ///
10843    /// @since 3.15.0
10844    #[serde(skip_serializing_if = "Option::is_none")]
10845    pub tag_support: Option<ClientDiagnosticsTagOptions>,
10846    /// Client supports a codeDescription property
10847    ///
10848    /// @since 3.16.0
10849    #[serde(skip_serializing_if = "Option::is_none")]
10850    pub code_description_support: Option<bool>,
10851    /// Whether code action supports the `data` property which is
10852    /// preserved between a `textDocument/publishDiagnostics` and
10853    /// `textDocument/codeAction` request.
10854    ///
10855    /// @since 3.16.0
10856    #[serde(skip_serializing_if = "Option::is_none")]
10857    pub data_support: Option<bool>,
10858}
10859impl DiagnosticsCapabilities {
10860    #[must_use]
10861    pub const fn new(
10862        related_information: Option<bool>,
10863        tag_support: Option<ClientDiagnosticsTagOptions>,
10864        code_description_support: Option<bool>,
10865        data_support: Option<bool>,
10866    ) -> Self {
10867        Self {
10868            related_information,
10869            tag_support,
10870            code_description_support,
10871            data_support,
10872        }
10873    }
10874}
10875
10876/// @since 3.18.0
10877#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Default)]
10878#[serde(rename_all = "camelCase")]
10879pub struct ClientSemanticTokensRequestOptions {
10880    /// The client will send the `textDocument/semanticTokens/range` request if
10881    /// the server provides a corresponding handler.
10882    #[serde(skip_serializing_if = "Option::is_none")]
10883    pub range: Option<ClientSemanticTokensRequestOptionsRange>,
10884    /// The client will send the `textDocument/semanticTokens/full` request if
10885    /// the server provides a corresponding handler.
10886    #[serde(skip_serializing_if = "Option::is_none")]
10887    pub full: Option<ClientSemanticTokensRequestOptionsFull>,
10888}
10889impl ClientSemanticTokensRequestOptions {
10890    #[must_use]
10891    pub const fn new(
10892        range: Option<ClientSemanticTokensRequestOptionsRange>,
10893        full: Option<ClientSemanticTokensRequestOptionsFull>,
10894    ) -> Self {
10895        Self { range, full }
10896    }
10897}
10898
10899/// @since 3.18.0
10900#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10901#[serde(rename_all = "camelCase")]
10902pub struct ClientInlayHintResolveOptions {
10903    /// The properties that a client can resolve lazily.
10904    pub properties: Vec<String>,
10905}
10906impl ClientInlayHintResolveOptions {
10907    #[must_use]
10908    pub const fn new(properties: Vec<String>) -> Self {
10909        Self { properties }
10910    }
10911}
10912
10913/// @since 3.18.0
10914#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
10915#[serde(rename_all = "camelCase")]
10916pub struct ClientShowMessageActionItemOptions {
10917    /// Whether the client supports additional attributes which
10918    /// are preserved and send back to the server in the
10919    /// request's response.
10920    #[serde(skip_serializing_if = "Option::is_none")]
10921    pub additional_properties_support: Option<bool>,
10922}
10923impl ClientShowMessageActionItemOptions {
10924    #[must_use]
10925    pub const fn new(additional_properties_support: Option<bool>) -> Self {
10926        Self {
10927            additional_properties_support,
10928        }
10929    }
10930}
10931
10932/// @since 3.18.0
10933#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10934#[serde(rename_all = "camelCase")]
10935pub struct CompletionItemTagOptions {
10936    /// The tags supported by the client.
10937    pub value_set: Vec<CompletionItemTag>,
10938}
10939impl CompletionItemTagOptions {
10940    #[must_use]
10941    pub const fn new(value_set: Vec<CompletionItemTag>) -> Self {
10942        Self { value_set }
10943    }
10944}
10945
10946/// @since 3.18.0
10947#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10948#[serde(rename_all = "camelCase")]
10949pub struct ClientCompletionItemResolveOptions {
10950    /// The properties that a client can resolve lazily.
10951    pub properties: Vec<String>,
10952}
10953impl ClientCompletionItemResolveOptions {
10954    #[must_use]
10955    pub const fn new(properties: Vec<String>) -> Self {
10956        Self { properties }
10957    }
10958}
10959
10960/// @since 3.18.0
10961#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10962#[serde(rename_all = "camelCase")]
10963pub struct ClientCompletionItemInsertTextModeOptions {
10964    pub value_set: Vec<InsertTextMode>,
10965}
10966impl ClientCompletionItemInsertTextModeOptions {
10967    #[must_use]
10968    pub const fn new(value_set: Vec<InsertTextMode>) -> Self {
10969        Self { value_set }
10970    }
10971}
10972
10973/// @since 3.18.0
10974#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
10975#[serde(rename_all = "camelCase")]
10976pub struct ClientSignatureParameterInformationOptions {
10977    /// The client supports processing label offsets instead of a
10978    /// simple label string.
10979    ///
10980    /// @since 3.14.0
10981    #[serde(skip_serializing_if = "Option::is_none")]
10982    pub label_offset_support: Option<bool>,
10983}
10984impl ClientSignatureParameterInformationOptions {
10985    #[must_use]
10986    pub const fn new(label_offset_support: Option<bool>) -> Self {
10987        Self { label_offset_support }
10988    }
10989}
10990
10991/// @since 3.18.0
10992#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
10993#[serde(rename_all = "camelCase")]
10994pub struct ClientCodeActionKindOptions {
10995    /// The code action kind values the client supports. When this
10996    /// property exists the client also guarantees that it will
10997    /// handle values outside its set gracefully and falls back
10998    /// to a default value when unknown.
10999    pub value_set: Vec<CodeActionKind>,
11000}
11001impl ClientCodeActionKindOptions {
11002    #[must_use]
11003    pub const fn new(value_set: Vec<CodeActionKind>) -> Self {
11004        Self { value_set }
11005    }
11006}
11007
11008/// @since 3.18.0
11009#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default)]
11010#[serde(rename_all = "camelCase")]
11011pub struct ClientDiagnosticsTagOptions {
11012    /// The tags supported by the client.
11013    pub value_set: Vec<DiagnosticTag>,
11014}
11015impl ClientDiagnosticsTagOptions {
11016    #[must_use]
11017    pub const fn new(value_set: Vec<DiagnosticTag>) -> Self {
11018        Self { value_set }
11019    }
11020}
11021
11022/// @since 3.18.0
11023#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Eq, Hash, Default, Copy)]
11024#[serde(rename_all = "camelCase")]
11025pub struct ClientSemanticTokensRequestFullDelta {
11026    /// The client will send the `textDocument/semanticTokens/full/delta` request if
11027    /// the server provides a corresponding handler.
11028    #[serde(skip_serializing_if = "Option::is_none")]
11029    pub delta: Option<bool>,
11030}
11031impl ClientSemanticTokensRequestFullDelta {
11032    #[must_use]
11033    pub const fn new(delta: Option<bool>) -> Self {
11034        Self { delta }
11035    }
11036}
11037
11038impl Default for Message {
11039    fn default() -> Self {
11040        Message::String(String::default())
11041    }
11042}
11043/// Represents a semantic token (serialized as five uintegers).
11044#[derive(Debug, Eq, PartialEq, Copy, Clone, Default, Hash)]
11045pub struct SemanticToken {
11046    /// Token line number, relative to the start of the previous token.
11047    pub delta_line: u32,
11048    /// Token start character, relative to the start of the previous token (relative to 0 or
11049    /// the previous token’s start if they are on the same line).
11050    pub delta_start: u32,
11051    /// The length of the token.
11052    pub length: u32,
11053    /// Will be looked up in [`SemanticTokensLegend::token_types`]. We currently ask that
11054    /// `tokenType` < 65536.
11055    pub token_type: u32,
11056    /// Each set bit will be looked up in [`SemanticTokensLegend::token_modifiers`].
11057    pub token_modifiers_bitset: u32,
11058}
11059impl SemanticToken {
11060    fn deserialize_tokens<'de, D>(
11061        deserializer: D,
11062    ) -> Result<Vec<SemanticToken>, D::Error>
11063    where
11064        D: serde::Deserializer<'de>,
11065    {
11066        let data = Vec::<u32>::deserialize(deserializer)?;
11067        let chunks = data.chunks_exact(5);
11068        if !chunks.remainder().is_empty() {
11069            return Result::Err(serde::de::Error::custom("Length is not divisible by 5"));
11070        }
11071        Result::Ok(
11072            chunks
11073                .map(|chunk| Self {
11074                    delta_line: chunk[0],
11075                    delta_start: chunk[1],
11076                    length: chunk[2],
11077                    token_type: chunk[3],
11078                    token_modifiers_bitset: chunk[4],
11079                })
11080                .collect(),
11081        )
11082    }
11083    fn serialize_tokens<S>(
11084        tokens: &[SemanticToken],
11085        serializer: S,
11086    ) -> Result<S::Ok, S::Error>
11087    where
11088        S: serde::Serializer,
11089    {
11090        let mut seq = serializer.serialize_seq(Some(tokens.len() * 5))?;
11091        for token in tokens {
11092            seq.serialize_element(&token.delta_line)?;
11093            seq.serialize_element(&token.delta_start)?;
11094            seq.serialize_element(&token.length)?;
11095            seq.serialize_element(&token.token_type)?;
11096            seq.serialize_element(&token.token_modifiers_bitset)?;
11097        }
11098        seq.end()
11099    }
11100    fn deserialize_optional_tokens<'de, D>(
11101        deserializer: D,
11102    ) -> Result<Option<Vec<SemanticToken>>, D::Error>
11103    where
11104        D: serde::Deserializer<'de>,
11105    {
11106        #[derive(Deserialize)]
11107        #[serde(transparent)]
11108        struct Wrapper {
11109            #[serde(deserialize_with = "SemanticToken::deserialize_tokens")]
11110            tokens: Vec<SemanticToken>,
11111        }
11112        Ok(Option::<Wrapper>::deserialize(deserializer)?.map(|wrapper| wrapper.tokens))
11113    }
11114    fn serialize_optional_tokens<S>(
11115        data: &Option<Vec<SemanticToken>>,
11116        serializer: S,
11117    ) -> Result<S::Ok, S::Error>
11118    where
11119        S: serde::Serializer,
11120    {
11121        #[derive(Serialize)]
11122        #[serde(transparent)]
11123        struct Wrapper {
11124            #[serde(serialize_with = "SemanticToken::serialize_tokens")]
11125            tokens: Vec<SemanticToken>,
11126        }
11127        let opt = data.as_ref().map(|t| Wrapper { tokens: t.clone() });
11128        opt.serialize(serializer)
11129    }
11130}