| 1 |
use serde::{Deserialize, Serialize}; |
| 2 |
|
| 3 |
use crate::{ |
| 4 |
Documentation, MarkupKind, TextDocumentPositionParams, TextDocumentRegistrationOptions, |
| 5 |
WorkDoneProgressOptions, WorkDoneProgressParams, |
| 6 |
}; |
| 7 |
|
| 8 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 9 |
#[serde(rename_all = "camelCase")] |
| 10 |
pub struct SignatureInformationSettings { |
| 11 |
|
| 12 |
|
| 13 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 14 |
pub documentation_format: Option<Vec<MarkupKind>>, |
| 15 |
|
| 16 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 17 |
pub parameter_information: Option<ParameterInformationSettings>, |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 24 |
pub active_parameter_support: Option<bool>, |
| 25 |
} |
| 26 |
|
| 27 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 28 |
#[serde(rename_all = "camelCase")] |
| 29 |
pub struct ParameterInformationSettings { |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 35 |
pub label_offset_support: Option<bool>, |
| 36 |
} |
| 37 |
|
| 38 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 39 |
#[serde(rename_all = "camelCase")] |
| 40 |
pub struct SignatureHelpClientCapabilities { |
| 41 |
|
| 42 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 43 |
pub dynamic_registration: Option<bool>, |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 48 |
pub signature_information: Option<SignatureInformationSettings>, |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 57 |
pub context_support: Option<bool>, |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 62 |
#[serde(rename_all = "camelCase")] |
| 63 |
pub struct SignatureHelpOptions { |
| 64 |
|
| 65 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 66 |
pub trigger_characters: Option<Vec<String>>, |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 72 |
pub retrigger_characters: Option<Vec<String>>, |
| 73 |
|
| 74 |
#[serde(flatten)] |
| 75 |
pub work_done_progress_options: WorkDoneProgressOptions, |
| 76 |
} |
| 77 |
|
| 78 |
|
| 79 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 80 |
pub struct SignatureHelpRegistrationOptions { |
| 81 |
#[serde(flatten)] |
| 82 |
pub text_document_registration_options: TextDocumentRegistrationOptions, |
| 83 |
} |
| 84 |
|
| 85 |
|
| 86 |
#[derive(Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 87 |
#[serde(transparent)] |
| 88 |
pub struct SignatureHelpTriggerKind(i32); |
| 89 |
lsp_enum! { |
| 90 |
impl SignatureHelpTriggerKind { |
| 91 |
|
| 92 |
pub const INVOKED: SignatureHelpTriggerKind = SignatureHelpTriggerKind(1); |
| 93 |
|
| 94 |
pub const TRIGGER_CHARACTER: SignatureHelpTriggerKind = SignatureHelpTriggerKind(2); |
| 95 |
|
| 96 |
pub const CONTENT_CHANGE: SignatureHelpTriggerKind = SignatureHelpTriggerKind(3); |
| 97 |
} |
| 98 |
} |
| 99 |
|
| 100 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 101 |
#[serde(rename_all = "camelCase")] |
| 102 |
pub struct SignatureHelpParams { |
| 103 |
|
| 104 |
|
| 105 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 106 |
pub context: Option<SignatureHelpContext>, |
| 107 |
|
| 108 |
#[serde(flatten)] |
| 109 |
pub text_document_position_params: TextDocumentPositionParams, |
| 110 |
|
| 111 |
#[serde(flatten)] |
| 112 |
pub work_done_progress_params: WorkDoneProgressParams, |
| 113 |
} |
| 114 |
|
| 115 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 116 |
#[serde(rename_all = "camelCase")] |
| 117 |
pub struct SignatureHelpContext { |
| 118 |
|
| 119 |
pub trigger_kind: SignatureHelpTriggerKind, |
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 124 |
pub trigger_character: Option<String>, |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
pub is_retrigger: bool, |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 135 |
pub active_signature_help: Option<SignatureHelp>, |
| 136 |
} |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 142 |
#[serde(rename_all = "camelCase")] |
| 143 |
pub struct SignatureHelp { |
| 144 |
|
| 145 |
pub signatures: Vec<SignatureInformation>, |
| 146 |
|
| 147 |
|
| 148 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 149 |
pub active_signature: Option<u32>, |
| 150 |
|
| 151 |
|
| 152 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 153 |
pub active_parameter: Option<u32>, |
| 154 |
} |
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 160 |
#[serde(rename_all = "camelCase")] |
| 161 |
pub struct SignatureInformation { |
| 162 |
|
| 163 |
|
| 164 |
pub label: String, |
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 169 |
pub documentation: Option<Documentation>, |
| 170 |
|
| 171 |
|
| 172 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 173 |
pub parameters: Option<Vec<ParameterInformation>>, |
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 181 |
pub active_parameter: Option<u32>, |
| 182 |
} |
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 187 |
#[serde(rename_all = "camelCase")] |
| 188 |
pub struct ParameterInformation { |
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
pub label: ParameterLabel, |
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 199 |
pub documentation: Option<Documentation>, |
| 200 |
} |
| 201 |
|
| 202 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 203 |
#[serde(untagged)] |
| 204 |
pub enum ParameterLabel { |
| 205 |
Simple(String), |
| 206 |
LabelOffsets([u32; 2]), |
| 207 |
} |