1use crate::{
2 DynamicRegistrationClientCapabilities, LSPAny, PartialResultParams, Range,
3 StaticRegistrationOptions, SymbolKind, SymbolTag, TextDocumentPositionParams,
4 TextDocumentRegistrationOptions, Url, WorkDoneProgressOptions, WorkDoneProgressParams,
5};
6
7use serde::{Deserialize, Serialize};
8
9pub type TypeHierarchyClientCapabilities = DynamicRegistrationClientCapabilities;
10
11#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
12pub struct TypeHierarchyOptions {
13 #[serde(flatten)]
14 pub work_done_progress_options: WorkDoneProgressOptions,
15}
16
17#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
18pub struct TypeHierarchyRegistrationOptions {
19 #[serde(flatten)]
20 pub text_document_registration_options: TextDocumentRegistrationOptions,
21 #[serde(flatten)]
22 pub type_hierarchy_options: TypeHierarchyOptions,
23 #[serde(flatten)]
24 pub static_registration_options: StaticRegistrationOptions,
25}
26
27#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
28pub struct TypeHierarchyPrepareParams {
29 #[serde(flatten)]
30 pub text_document_position_params: TextDocumentPositionParams,
31 #[serde(flatten)]
32 pub work_done_progress_params: WorkDoneProgressParams,
33}
34
35#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
36pub struct TypeHierarchySupertypesParams {
37 pub item: TypeHierarchyItem,
38
39 #[serde(flatten)]
40 pub work_done_progress_params: WorkDoneProgressParams,
41 #[serde(flatten)]
42 pub partial_result_params: PartialResultParams,
43}
44
45#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
46pub struct TypeHierarchySubtypesParams {
47 pub item: TypeHierarchyItem,
48
49 #[serde(flatten)]
50 pub work_done_progress_params: WorkDoneProgressParams,
51 #[serde(flatten)]
52 pub partial_result_params: PartialResultParams,
53}
54
55#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
56#[serde(rename_all = "camelCase")]
57pub struct TypeHierarchyItem {
58 /// The name of this item.
59 pub name: String,
60
61 /// The kind of this item.
62 pub kind: SymbolKind,
63
64 /// Tags for this item.
65 #[serde(skip_serializing_if = "Option::is_none")]
66 pub tags: Option<SymbolTag>,
67
68 /// More detail for this item, e.g. the signature of a function.
69 #[serde(skip_serializing_if = "Option::is_none")]
70 pub detail: Option<String>,
71
72 /// The resource identifier of this item.
73 pub uri: Url,
74
75 /// The range enclosing this symbol not including leading/trailing whitespace
76 /// but everything else, e.g. comments and code.
77 pub range: Range,
78
79 /// The range that should be selected and revealed when this symbol is being
80 /// picked, e.g. the name of a function. Must be contained by the
81 /// [`range`](#TypeHierarchyItem.range).
82 pub selection_range: Range,
83
84 /// A data entry field that is preserved between a type hierarchy prepare and
85 /// supertypes or subtypes requests. It could also be used to identify the
86 /// type hierarchy in the server, helping improve the performance on
87 /// resolving supertypes and subtypes.
88 #[serde(skip_serializing_if = "Option::is_none")]
89 pub data: Option<LSPAny>,
90}
91