| 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 |
|
| 51 |
pub name: String, |
| 52 |
|
| 53 |
|
| 54 |
pub kind: SymbolKind, |
| 55 |
|
| 56 |
|
| 57 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 58 |
pub tags: Option<Vec<SymbolTag>>, |
| 59 |
|
| 60 |
|
| 61 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 62 |
pub detail: Option<String>, |
| 63 |
|
| 64 |
|
| 65 |
pub uri: Url, |
| 66 |
|
| 67 |
|
| 68 |
pub range: Range, |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
pub selection_range: Range, |
| 73 |
|
| 74 |
|
| 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 |
|
| 92 |
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] |
| 93 |
#[serde(rename_all = "camelCase")] |
| 94 |
pub struct CallHierarchyIncomingCall { |
| 95 |
|
| 96 |
pub from: CallHierarchyItem, |
| 97 |
|
| 98 |
|
| 99 |
|
| 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 |
|
| 116 |
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] |
| 117 |
#[serde(rename_all = "camelCase")] |
| 118 |
pub struct CallHierarchyOutgoingCall { |
| 119 |
|
| 120 |
pub to: CallHierarchyItem, |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
pub from_ranges: Vec<Range>, |
| 126 |
} |