| 1 |
use serde::{Deserialize, Serialize}; |
| 2 |
|
| 3 |
use crate::{ |
| 4 |
PartialResultParams, Position, Range, StaticTextDocumentRegistrationOptions, |
| 5 |
TextDocumentIdentifier, WorkDoneProgressOptions, WorkDoneProgressParams, |
| 6 |
}; |
| 7 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 8 |
#[serde(rename_all = "camelCase")] |
| 9 |
pub struct SelectionRangeClientCapabilities { |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 15 |
pub dynamic_registration: Option<bool>, |
| 16 |
} |
| 17 |
|
| 18 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 19 |
pub struct SelectionRangeOptions { |
| 20 |
#[serde(flatten)] |
| 21 |
pub work_done_progress_options: WorkDoneProgressOptions, |
| 22 |
} |
| 23 |
|
| 24 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 25 |
pub struct SelectionRangeRegistrationOptions { |
| 26 |
#[serde(flatten)] |
| 27 |
pub selection_range_options: SelectionRangeOptions, |
| 28 |
|
| 29 |
#[serde(flatten)] |
| 30 |
pub registration_options: StaticTextDocumentRegistrationOptions, |
| 31 |
} |
| 32 |
|
| 33 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 34 |
#[serde(untagged)] |
| 35 |
pub enum SelectionRangeProviderCapability { |
| 36 |
Simple(bool), |
| 37 |
Options(SelectionRangeOptions), |
| 38 |
RegistrationOptions(SelectionRangeRegistrationOptions), |
| 39 |
} |
| 40 |
|
| 41 |
impl From<SelectionRangeRegistrationOptions> for SelectionRangeProviderCapability { |
| 42 |
fn from(from: SelectionRangeRegistrationOptions) -> Self { |
| 43 |
Self::RegistrationOptions(from) |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
impl From<SelectionRangeOptions> for SelectionRangeProviderCapability { |
| 48 |
fn from(from: SelectionRangeOptions) -> Self { |
| 49 |
Self::Options(from) |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
impl From<bool> for SelectionRangeProviderCapability { |
| 54 |
fn from(from: bool) -> Self { |
| 55 |
Self::Simple(from) |
| 56 |
} |
| 57 |
} |
| 58 |
|
| 59 |
|
| 60 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 61 |
#[serde(rename_all = "camelCase")] |
| 62 |
pub struct SelectionRangeParams { |
| 63 |
|
| 64 |
pub text_document: TextDocumentIdentifier, |
| 65 |
|
| 66 |
|
| 67 |
pub positions: Vec<Position>, |
| 68 |
|
| 69 |
#[serde(flatten)] |
| 70 |
pub work_done_progress_params: WorkDoneProgressParams, |
| 71 |
|
| 72 |
#[serde(flatten)] |
| 73 |
pub partial_result_params: PartialResultParams, |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 78 |
#[serde(rename_all = "camelCase")] |
| 79 |
pub struct SelectionRange { |
| 80 |
|
| 81 |
pub range: Range, |
| 82 |
|
| 83 |
|
| 84 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 85 |
pub parent: Option<Box<SelectionRange>>, |
| 86 |
} |