| 1 |
use crate::{ |
| 2 |
Command, LSPAny, Location, MarkupContent, Position, Range, StaticRegistrationOptions, |
| 3 |
TextDocumentIdentifier, TextDocumentRegistrationOptions, TextEdit, WorkDoneProgressOptions, |
| 4 |
WorkDoneProgressParams, |
| 5 |
}; |
| 6 |
use serde::{Deserialize, Serialize}; |
| 7 |
|
| 8 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 9 |
#[serde(rename_all = "camelCase")] |
| 10 |
#[serde(untagged)] |
| 11 |
pub enum InlayHintServerCapabilities { |
| 12 |
Options(InlayHintOptions), |
| 13 |
RegistrationOptions(InlayHintRegistrationOptions), |
| 14 |
} |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 20 |
#[serde(rename_all = "camelCase")] |
| 21 |
pub struct InlayHintClientCapabilities { |
| 22 |
|
| 23 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 24 |
pub dynamic_registration: Option<bool>, |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 29 |
pub resolve_support: Option<InlayHintResolveClientCapabilities>, |
| 30 |
} |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 36 |
#[serde(rename_all = "camelCase")] |
| 37 |
pub struct InlayHintOptions { |
| 38 |
#[serde(flatten)] |
| 39 |
pub work_done_progress_options: WorkDoneProgressOptions, |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 44 |
pub resolve_provider: Option<bool>, |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 51 |
#[serde(rename_all = "camelCase")] |
| 52 |
pub struct InlayHintRegistrationOptions { |
| 53 |
#[serde(flatten)] |
| 54 |
pub inlay_hint_options: InlayHintOptions, |
| 55 |
|
| 56 |
#[serde(flatten)] |
| 57 |
pub text_document_registration_options: TextDocumentRegistrationOptions, |
| 58 |
|
| 59 |
#[serde(flatten)] |
| 60 |
pub static_registration_options: StaticRegistrationOptions, |
| 61 |
} |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 67 |
#[serde(rename_all = "camelCase")] |
| 68 |
pub struct InlayHintParams { |
| 69 |
#[serde(flatten)] |
| 70 |
pub work_done_progress_params: WorkDoneProgressParams, |
| 71 |
|
| 72 |
|
| 73 |
pub text_document: TextDocumentIdentifier, |
| 74 |
|
| 75 |
|
| 76 |
pub range: Range, |
| 77 |
} |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
#[derive(Debug, Clone, Deserialize, Serialize)] |
| 83 |
#[serde(rename_all = "camelCase")] |
| 84 |
pub struct InlayHint { |
| 85 |
|
| 86 |
pub position: Position, |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
pub label: InlayHintLabel, |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 97 |
pub kind: Option<InlayHintKind>, |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 108 |
pub text_edits: Option<Vec<TextEdit>>, |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 115 |
pub tooltip: Option<InlayHintTooltip>, |
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 123 |
pub padding_left: Option<bool>, |
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 131 |
pub padding_right: Option<bool>, |
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 136 |
pub data: Option<LSPAny>, |
| 137 |
} |
| 138 |
|
| 139 |
#[derive(Debug, Clone, Deserialize, Serialize)] |
| 140 |
#[serde(untagged)] |
| 141 |
pub enum InlayHintLabel { |
| 142 |
String(String), |
| 143 |
LabelParts(Vec<InlayHintLabelPart>), |
| 144 |
} |
| 145 |
|
| 146 |
impl From<String> for InlayHintLabel { |
| 147 |
#[inline] |
| 148 |
fn from(from: String) -> Self { |
| 149 |
Self::String(from) |
| 150 |
} |
| 151 |
} |
| 152 |
|
| 153 |
impl From<Vec<InlayHintLabelPart>> for InlayHintLabel { |
| 154 |
#[inline] |
| 155 |
fn from(from: Vec<InlayHintLabelPart>) -> Self { |
| 156 |
Self::LabelParts(from) |
| 157 |
} |
| 158 |
} |
| 159 |
|
| 160 |
#[derive(Debug, Clone, Deserialize, Serialize)] |
| 161 |
#[serde(untagged)] |
| 162 |
pub enum InlayHintTooltip { |
| 163 |
String(String), |
| 164 |
MarkupContent(MarkupContent), |
| 165 |
} |
| 166 |
|
| 167 |
impl From<String> for InlayHintTooltip { |
| 168 |
#[inline] |
| 169 |
fn from(from: String) -> Self { |
| 170 |
Self::String(from) |
| 171 |
} |
| 172 |
} |
| 173 |
|
| 174 |
impl From<MarkupContent> for InlayHintTooltip { |
| 175 |
#[inline] |
| 176 |
fn from(from: MarkupContent) -> Self { |
| 177 |
Self::MarkupContent(from) |
| 178 |
} |
| 179 |
} |
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
#[derive(Debug, Clone, Default, Deserialize, Serialize)] |
| 184 |
#[serde(rename_all = "camelCase")] |
| 185 |
pub struct InlayHintLabelPart { |
| 186 |
|
| 187 |
pub value: String, |
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 193 |
pub tooltip: Option<InlayHintLabelPartTooltip>, |
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 207 |
pub location: Option<Location>, |
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 214 |
pub command: Option<Command>, |
| 215 |
} |
| 216 |
|
| 217 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 218 |
#[serde(untagged)] |
| 219 |
pub enum InlayHintLabelPartTooltip { |
| 220 |
String(String), |
| 221 |
MarkupContent(MarkupContent), |
| 222 |
} |
| 223 |
|
| 224 |
impl From<String> for InlayHintLabelPartTooltip { |
| 225 |
#[inline] |
| 226 |
fn from(from: String) -> Self { |
| 227 |
Self::String(from) |
| 228 |
} |
| 229 |
} |
| 230 |
|
| 231 |
impl From<MarkupContent> for InlayHintLabelPartTooltip { |
| 232 |
#[inline] |
| 233 |
fn from(from: MarkupContent) -> Self { |
| 234 |
Self::MarkupContent(from) |
| 235 |
} |
| 236 |
} |
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
#[derive(Eq, PartialEq, Copy, Clone, Serialize, Deserialize)] |
| 242 |
#[serde(transparent)] |
| 243 |
pub struct InlayHintKind(i32); |
| 244 |
lsp_enum! { |
| 245 |
impl InlayHintKind { |
| 246 |
|
| 247 |
pub const TYPE: InlayHintKind = InlayHintKind(1); |
| 248 |
|
| 249 |
|
| 250 |
pub const PARAMETER: InlayHintKind = InlayHintKind(2); |
| 251 |
} |
| 252 |
} |
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 258 |
#[serde(rename_all = "camelCase")] |
| 259 |
pub struct InlayHintResolveClientCapabilities { |
| 260 |
|
| 261 |
pub properties: Vec<String>, |
| 262 |
} |
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 268 |
#[serde(rename_all = "camelCase")] |
| 269 |
pub struct InlayHintWorkspaceClientCapabilities { |
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 278 |
pub refresh_support: Option<bool>, |
| 279 |
} |
| 280 |
|
| 281 |
|