| 1 |
use serde::{Deserialize, Serialize}; |
| 2 |
|
| 3 |
use crate::{ |
| 4 |
FullDocumentDiagnosticReport, PartialResultParams, UnchangedDocumentDiagnosticReport, Url, |
| 5 |
WorkDoneProgressParams, |
| 6 |
}; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 12 |
#[serde(rename_all = "camelCase")] |
| 13 |
pub struct DiagnosticWorkspaceClientCapabilities { |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 22 |
pub refresh_support: Option<bool>, |
| 23 |
} |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 29 |
pub struct PreviousResultId { |
| 30 |
|
| 31 |
pub uri: Url, |
| 32 |
|
| 33 |
|
| 34 |
pub value: String, |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] |
| 41 |
#[serde(rename_all = "camelCase")] |
| 42 |
pub struct WorkspaceDiagnosticParams { |
| 43 |
|
| 44 |
pub identifier: Option<String>, |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
pub previous_result_ids: Vec<PreviousResultId>, |
| 49 |
|
| 50 |
#[serde(flatten)] |
| 51 |
pub work_done_progress_params: WorkDoneProgressParams, |
| 52 |
|
| 53 |
#[serde(flatten)] |
| 54 |
pub partial_result_params: PartialResultParams, |
| 55 |
} |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)] |
| 61 |
#[serde(rename_all = "camelCase")] |
| 62 |
pub struct WorkspaceFullDocumentDiagnosticReport { |
| 63 |
|
| 64 |
pub uri: Url, |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
pub version: Option<i64>, |
| 70 |
|
| 71 |
#[serde(flatten)] |
| 72 |
pub full_document_diagnostic_report: FullDocumentDiagnosticReport, |
| 73 |
} |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)] |
| 79 |
#[serde(rename_all = "camelCase")] |
| 80 |
pub struct WorkspaceUnchangedDocumentDiagnosticReport { |
| 81 |
|
| 82 |
pub uri: Url, |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
pub version: Option<i64>, |
| 88 |
|
| 89 |
#[serde(flatten)] |
| 90 |
pub unchanged_document_diagnostic_report: UnchangedDocumentDiagnosticReport, |
| 91 |
} |
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)] |
| 97 |
#[serde(tag = "kind", rename_all = "lowercase")] |
| 98 |
pub enum WorkspaceDocumentDiagnosticReport { |
| 99 |
Full(WorkspaceFullDocumentDiagnosticReport), |
| 100 |
Unchanged(WorkspaceUnchangedDocumentDiagnosticReport), |
| 101 |
} |
| 102 |
|
| 103 |
impl From<WorkspaceFullDocumentDiagnosticReport> for WorkspaceDocumentDiagnosticReport { |
| 104 |
fn from(from: WorkspaceFullDocumentDiagnosticReport) -> Self { |
| 105 |
WorkspaceDocumentDiagnosticReport::Full(from) |
| 106 |
} |
| 107 |
} |
| 108 |
|
| 109 |
impl From<WorkspaceUnchangedDocumentDiagnosticReport> for WorkspaceDocumentDiagnosticReport { |
| 110 |
fn from(from: WorkspaceUnchangedDocumentDiagnosticReport) -> Self { |
| 111 |
WorkspaceDocumentDiagnosticReport::Unchanged(from) |
| 112 |
} |
| 113 |
} |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
#[derive(Debug, PartialEq, Default, Deserialize, Serialize, Clone)] |
| 119 |
pub struct WorkspaceDiagnosticReport { |
| 120 |
pub items: Vec<WorkspaceDocumentDiagnosticReport>, |
| 121 |
} |
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
#[derive(Debug, PartialEq, Default, Deserialize, Serialize, Clone)] |
| 127 |
pub struct WorkspaceDiagnosticReportPartialResult { |
| 128 |
pub items: Vec<WorkspaceDocumentDiagnosticReport>, |
| 129 |
} |
| 130 |
|
| 131 |
#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)] |
| 132 |
#[serde(untagged)] |
| 133 |
pub enum WorkspaceDiagnosticReportResult { |
| 134 |
Report(WorkspaceDiagnosticReport), |
| 135 |
Partial(WorkspaceDiagnosticReportPartialResult), |
| 136 |
} |
| 137 |
|
| 138 |
impl From<WorkspaceDiagnosticReport> for WorkspaceDiagnosticReportResult { |
| 139 |
fn from(from: WorkspaceDiagnosticReport) -> Self { |
| 140 |
WorkspaceDiagnosticReportResult::Report(from) |
| 141 |
} |
| 142 |
} |
| 143 |
|
| 144 |
impl From<WorkspaceDiagnosticReportPartialResult> for WorkspaceDiagnosticReportResult { |
| 145 |
fn from(from: WorkspaceDiagnosticReportPartialResult) -> Self { |
| 146 |
WorkspaceDiagnosticReportResult::Partial(from) |
| 147 |
} |
| 148 |
} |