| 1 |
use serde::{Deserialize, Serialize}; |
| 2 |
|
| 3 |
use crate::{ |
| 4 |
MarkedString, MarkupContent, MarkupKind, Range, TextDocumentPositionParams, |
| 5 |
TextDocumentRegistrationOptions, WorkDoneProgressOptions, WorkDoneProgressParams, |
| 6 |
}; |
| 7 |
|
| 8 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 9 |
#[serde(rename_all = "camelCase")] |
| 10 |
pub struct HoverClientCapabilities { |
| 11 |
|
| 12 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 13 |
pub dynamic_registration: Option<bool>, |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 18 |
pub content_format: Option<Vec<MarkupKind>>, |
| 19 |
} |
| 20 |
|
| 21 |
|
| 22 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 23 |
#[serde(rename_all = "camelCase")] |
| 24 |
pub struct HoverOptions { |
| 25 |
#[serde(flatten)] |
| 26 |
pub work_done_progress_options: WorkDoneProgressOptions, |
| 27 |
} |
| 28 |
|
| 29 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 30 |
#[serde(rename_all = "camelCase")] |
| 31 |
pub struct HoverRegistrationOptions { |
| 32 |
#[serde(flatten)] |
| 33 |
pub text_document_registration_options: TextDocumentRegistrationOptions, |
| 34 |
|
| 35 |
#[serde(flatten)] |
| 36 |
pub hover_options: HoverOptions, |
| 37 |
} |
| 38 |
|
| 39 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 40 |
#[serde(untagged)] |
| 41 |
pub enum HoverProviderCapability { |
| 42 |
Simple(bool), |
| 43 |
Options(HoverOptions), |
| 44 |
} |
| 45 |
|
| 46 |
impl From<HoverOptions> for HoverProviderCapability { |
| 47 |
fn from(from: HoverOptions) -> Self { |
| 48 |
Self::Options(from) |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
impl From<bool> for HoverProviderCapability { |
| 53 |
fn from(from: bool) -> Self { |
| 54 |
Self::Simple(from) |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 59 |
#[serde(rename_all = "camelCase")] |
| 60 |
pub struct HoverParams { |
| 61 |
#[serde(flatten)] |
| 62 |
pub text_document_position_params: TextDocumentPositionParams, |
| 63 |
|
| 64 |
#[serde(flatten)] |
| 65 |
pub work_done_progress_params: WorkDoneProgressParams, |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 70 |
pub struct Hover { |
| 71 |
|
| 72 |
pub contents: HoverContents, |
| 73 |
|
| 74 |
|
| 75 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 76 |
pub range: Option<Range>, |
| 77 |
} |
| 78 |
|
| 79 |
|
| 80 |
#[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize)] |
| 81 |
#[serde(untagged)] |
| 82 |
pub enum HoverContents { |
| 83 |
Scalar(MarkedString), |
| 84 |
Array(Vec<MarkedString>), |
| 85 |
Markup(MarkupContent), |
| 86 |
} |