Debian Codegraph @

helix-lsp-types/src/call_hierarchy.rs

raw symbols SCIP
1 use serde::{Deserialize, Serialize};
2 use serde_json::Value;
3
4 use crate::{
5 DynamicRegistrationClientCapabilities, PartialResultParams, Range, SymbolKind, SymbolTag,
6 TextDocumentPositionParams, Url, WorkDoneProgressOptions, WorkDoneProgressParams,
7 };
8
9 pub type CallHierarchyClientCapabilities = DynamicRegistrationClientCapabilities;
10
11 #[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize, Copy)]
12 #[serde(rename_all = "camelCase")]
13 pub struct CallHierarchyOptions {
14 #[serde(flatten)]
15 pub work_done_progress_options: WorkDoneProgressOptions,
16 }
17
18 #[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize, Copy)]
19 #[serde(untagged)]
20 pub enum CallHierarchyServerCapability {
21 Simple(bool),
22 Options(CallHierarchyOptions),
23 }
24
25 impl From<CallHierarchyOptions> for CallHierarchyServerCapability {
26 fn from(from: CallHierarchyOptions) -> Self {
27 Self::Options(from)
28 }
29 }
30
31 impl From<bool> for CallHierarchyServerCapability {
32 fn from(from: bool) -> Self {
33 Self::Simple(from)
34 }
35 }
36
37 #[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
38 #[serde(rename_all = "camelCase")]
39 pub struct CallHierarchyPrepareParams {
40 #[serde(flatten)]
41 pub text_document_position_params: TextDocumentPositionParams,
42
43 #[serde(flatten)]
44 pub work_done_progress_params: WorkDoneProgressParams,
45 }
46
47 #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
48 #[serde(rename_all = "camelCase")]
49 pub struct CallHierarchyItem {
50 /// The name of this item.
51 pub name: String,
52
53 /// The kind of this item.
54 pub kind: SymbolKind,
55
56 /// Tags for this item.
57 #[serde(skip_serializing_if = "Option::is_none")]
58 pub tags: Option<Vec<SymbolTag>>,
59
60 /// More detail for this item, e.g. the signature of a function.
61 #[serde(skip_serializing_if = "Option::is_none")]
62 pub detail: Option<String>,
63
64 /// The resource identifier of this item.
65 pub uri: Url,
66
67 /// The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.
68 pub range: Range,
69
70 /// The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function.
71 /// Must be contained by the [`range`](#CallHierarchyItem.range).
72 pub selection_range: Range,
73
74 /// A data entry field that is preserved between a call hierarchy prepare and incoming calls or outgoing calls requests.
75 #[serde(skip_serializing_if = "Option::is_none")]
76 pub data: Option<Value>,
77 }
78
79 #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
80 #[serde(rename_all = "camelCase")]
81 pub struct CallHierarchyIncomingCallsParams {
82 pub item: CallHierarchyItem,
83
84 #[serde(flatten)]
85 pub work_done_progress_params: WorkDoneProgressParams,
86
87 #[serde(flatten)]
88 pub partial_result_params: PartialResultParams,
89 }
90
91 /// Represents an incoming call, e.g. a caller of a method or constructor.
92 #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
93 #[serde(rename_all = "camelCase")]
94 pub struct CallHierarchyIncomingCall {
95 /// The item that makes the call.
96 pub from: CallHierarchyItem,
97
98 /// The range at which at which the calls appears. This is relative to the caller
99 /// denoted by [`this.from`](#CallHierarchyIncomingCall.from).
100 pub from_ranges: Vec<Range>,
101 }
102
103 #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
104 #[serde(rename_all = "camelCase")]
105 pub struct CallHierarchyOutgoingCallsParams {
106 pub item: CallHierarchyItem,
107
108 #[serde(flatten)]
109 pub work_done_progress_params: WorkDoneProgressParams,
110
111 #[serde(flatten)]
112 pub partial_result_params: PartialResultParams,
113 }
114
115 /// Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc.
116 #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
117 #[serde(rename_all = "camelCase")]
118 pub struct CallHierarchyOutgoingCall {
119 /// The item that is called.
120 pub to: CallHierarchyItem,
121
122 /// The range at which this item is called. This is the range relative to the caller, e.g the item
123 /// passed to [`provideCallHierarchyOutgoingCalls`](#CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls)
124 /// and not [`this.to`](#CallHierarchyOutgoingCall.to).
125 pub from_ranges: Vec<Range>,
126 }