| 1 |
use crate::{ |
| 2 |
PartialResultParams, StaticTextDocumentColorProviderOptions, TextDocumentIdentifier, |
| 3 |
WorkDoneProgressParams, |
| 4 |
}; |
| 5 |
use serde::{Deserialize, Serialize}; |
| 6 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 7 |
#[serde(rename_all = "camelCase")] |
| 8 |
pub struct FoldingRangeParams { |
| 9 |
|
| 10 |
pub text_document: TextDocumentIdentifier, |
| 11 |
|
| 12 |
#[serde(flatten)] |
| 13 |
pub work_done_progress_params: WorkDoneProgressParams, |
| 14 |
|
| 15 |
#[serde(flatten)] |
| 16 |
pub partial_result_params: PartialResultParams, |
| 17 |
} |
| 18 |
|
| 19 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 20 |
#[serde(untagged)] |
| 21 |
pub enum FoldingRangeProviderCapability { |
| 22 |
Simple(bool), |
| 23 |
FoldingProvider(FoldingProviderOptions), |
| 24 |
Options(StaticTextDocumentColorProviderOptions), |
| 25 |
} |
| 26 |
|
| 27 |
impl From<StaticTextDocumentColorProviderOptions> for FoldingRangeProviderCapability { |
| 28 |
fn from(from: StaticTextDocumentColorProviderOptions) -> Self { |
| 29 |
Self::Options(from) |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
impl From<FoldingProviderOptions> for FoldingRangeProviderCapability { |
| 34 |
fn from(from: FoldingProviderOptions) -> Self { |
| 35 |
Self::FoldingProvider(from) |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
impl From<bool> for FoldingRangeProviderCapability { |
| 40 |
fn from(from: bool) -> Self { |
| 41 |
Self::Simple(from) |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 46 |
pub struct FoldingProviderOptions {} |
| 47 |
|
| 48 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 49 |
#[serde(rename_all = "camelCase")] |
| 50 |
pub struct FoldingRangeKindCapability { |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 56 |
pub value_set: Option<Vec<FoldingRangeKind>>, |
| 57 |
} |
| 58 |
|
| 59 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 60 |
#[serde(rename_all = "camelCase")] |
| 61 |
pub struct FoldingRangeCapability { |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 67 |
pub collapsed_text: Option<bool>, |
| 68 |
} |
| 69 |
|
| 70 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 71 |
#[serde(rename_all = "camelCase")] |
| 72 |
pub struct FoldingRangeClientCapabilities { |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 77 |
pub dynamic_registration: Option<bool>, |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 82 |
pub range_limit: Option<u32>, |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 87 |
pub line_folding_only: Option<bool>, |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 93 |
pub folding_range_kind: Option<FoldingRangeKindCapability>, |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 99 |
pub folding_range: Option<FoldingRangeCapability>, |
| 100 |
} |
| 101 |
|
| 102 |
|
| 103 |
#[derive(Debug, Eq, PartialEq, Deserialize, Serialize, Clone)] |
| 104 |
#[serde(rename_all = "lowercase")] |
| 105 |
pub enum FoldingRangeKind { |
| 106 |
|
| 107 |
Comment, |
| 108 |
|
| 109 |
Imports, |
| 110 |
|
| 111 |
Region, |
| 112 |
} |
| 113 |
|
| 114 |
|
| 115 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 116 |
#[serde(rename_all = "camelCase")] |
| 117 |
pub struct FoldingRange { |
| 118 |
|
| 119 |
pub start_line: u32, |
| 120 |
|
| 121 |
|
| 122 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 123 |
pub start_character: Option<u32>, |
| 124 |
|
| 125 |
|
| 126 |
pub end_line: u32, |
| 127 |
|
| 128 |
|
| 129 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 130 |
pub end_character: Option<u32>, |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 136 |
pub kind: Option<FoldingRangeKind>, |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 144 |
pub collapsed_text: Option<String>, |
| 145 |
} |