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