ls_types/
workspace_diagnostic.rs1use serde::{Deserialize, Serialize};
2
3use crate::{
4 FullDocumentDiagnosticReport, PartialResultParams, UnchangedDocumentDiagnosticReport, Uri,
5 WorkDoneProgressParams,
6};
7
8#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
12#[serde(rename_all = "camelCase")]
13pub struct DiagnosticWorkspaceClientCapabilities {
14 #[serde(skip_serializing_if = "Option::is_none")]
22 pub refresh_support: Option<bool>,
23}
24
25#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
29pub struct PreviousResultId {
30 pub uri: Uri,
32
33 pub value: String,
35}
36
37#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
41#[serde(rename_all = "camelCase")]
42pub struct WorkspaceDiagnosticParams {
43 pub identifier: Option<String>,
45
46 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#[derive(Debug, PartialEq, Eq, Deserialize, Serialize, Clone)]
61#[serde(rename_all = "camelCase")]
62pub struct WorkspaceFullDocumentDiagnosticReport {
63 pub uri: Uri,
65
66 pub version: Option<i64>,
70
71 #[serde(flatten)]
72 pub full_document_diagnostic_report: FullDocumentDiagnosticReport,
73}
74
75#[derive(Debug, PartialEq, Eq, Deserialize, Serialize, Clone)]
79#[serde(rename_all = "camelCase")]
80pub struct WorkspaceUnchangedDocumentDiagnosticReport {
81 pub uri: Uri,
83
84 pub version: Option<i64>,
88
89 #[serde(flatten)]
90 pub unchanged_document_diagnostic_report: UnchangedDocumentDiagnosticReport,
91}
92
93#[derive(Debug, PartialEq, Eq, Deserialize, Serialize, Clone)]
97#[serde(tag = "kind", rename_all = "lowercase")]
98pub enum WorkspaceDocumentDiagnosticReport {
99 Full(WorkspaceFullDocumentDiagnosticReport),
100 Unchanged(WorkspaceUnchangedDocumentDiagnosticReport),
101}
102
103impl From<WorkspaceFullDocumentDiagnosticReport> for WorkspaceDocumentDiagnosticReport {
104 fn from(from: WorkspaceFullDocumentDiagnosticReport) -> Self {
105 Self::Full(from)
106 }
107}
108
109impl From<WorkspaceUnchangedDocumentDiagnosticReport> for WorkspaceDocumentDiagnosticReport {
110 fn from(from: WorkspaceUnchangedDocumentDiagnosticReport) -> Self {
111 Self::Unchanged(from)
112 }
113}
114
115#[derive(Debug, PartialEq, Eq, Default, Deserialize, Serialize, Clone)]
119pub struct WorkspaceDiagnosticReport {
120 pub items: Vec<WorkspaceDocumentDiagnosticReport>,
121}
122
123#[derive(Debug, PartialEq, Eq, Default, Deserialize, Serialize, Clone)]
127pub struct WorkspaceDiagnosticReportPartialResult {
128 pub items: Vec<WorkspaceDocumentDiagnosticReport>,
129}
130
131#[derive(Debug, PartialEq, Eq, Deserialize, Serialize, Clone)]
132#[serde(untagged)]
133pub enum WorkspaceDiagnosticReportResult {
134 Report(WorkspaceDiagnosticReport),
135 Partial(WorkspaceDiagnosticReportPartialResult),
136}
137
138impl From<WorkspaceDiagnosticReport> for WorkspaceDiagnosticReportResult {
139 fn from(from: WorkspaceDiagnosticReport) -> Self {
140 Self::Report(from)
141 }
142}
143
144impl From<WorkspaceDiagnosticReportPartialResult> for WorkspaceDiagnosticReportResult {
145 fn from(from: WorkspaceDiagnosticReportPartialResult) -> Self {
146 Self::Partial(from)
147 }
148}