Debian Codegraph @

helix-lsp-types/src/workspace_diagnostic.rs

raw symbols SCIP
1 use serde::{Deserialize, Serialize};
2
3 use crate::{
4 FullDocumentDiagnosticReport, PartialResultParams, UnchangedDocumentDiagnosticReport, Url,
5 WorkDoneProgressParams,
6 };
7
8 /// Workspace client capabilities specific to diagnostic pull requests.
9 ///
10 /// @since 3.17.0
11 #[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
12 #[serde(rename_all = "camelCase")]
13 pub struct DiagnosticWorkspaceClientCapabilities {
14 /// Whether the client implementation supports a refresh request sent from
15 /// the server to the client.
16 ///
17 /// Note that this event is global and will force the client to refresh all
18 /// pulled diagnostics currently shown. It should be used with absolute care
19 /// and is useful for situation where a server for example detects a project
20 /// wide change that requires such a calculation.
21 #[serde(skip_serializing_if = "Option::is_none")]
22 pub refresh_support: Option<bool>,
23 }
24
25 /// A previous result ID in a workspace pull request.
26 ///
27 /// @since 3.17.0
28 #[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
29 pub struct PreviousResultId {
30 /// The URI for which the client knows a result ID.
31 pub uri: Url,
32
33 /// The value of the previous result ID.
34 pub value: String,
35 }
36
37 /// Parameters of the workspace diagnostic request.
38 ///
39 /// @since 3.17.0
40 #[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
41 #[serde(rename_all = "camelCase")]
42 pub struct WorkspaceDiagnosticParams {
43 /// The additional identifier provided during registration.
44 pub identifier: Option<String>,
45
46 /// The currently known diagnostic reports with their
47 /// previous result ids.
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 /// A full document diagnostic report for a workspace diagnostic result.
58 ///
59 /// @since 3.17.0
60 #[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
61 #[serde(rename_all = "camelCase")]
62 pub struct WorkspaceFullDocumentDiagnosticReport {
63 /// The URI for which diagnostic information is reported.
64 pub uri: Url,
65
66 /// The version number for which the diagnostics are reported.
67 ///
68 /// If the document is not marked as open, `None` can be provided.
69 pub version: Option<i64>,
70
71 #[serde(flatten)]
72 pub full_document_diagnostic_report: FullDocumentDiagnosticReport,
73 }
74
75 /// An unchanged document diagnostic report for a workspace diagnostic result.
76 ///
77 /// @since 3.17.0
78 #[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
79 #[serde(rename_all = "camelCase")]
80 pub struct WorkspaceUnchangedDocumentDiagnosticReport {
81 /// The URI for which diagnostic information is reported.
82 pub uri: Url,
83
84 /// The version number for which the diagnostics are reported.
85 ///
86 /// If the document is not marked as open, `None` can be provided.
87 pub version: Option<i64>,
88
89 #[serde(flatten)]
90 pub unchanged_document_diagnostic_report: UnchangedDocumentDiagnosticReport,
91 }
92
93 /// A workspace diagnostic document report.
94 ///
95 /// @since 3.17.0
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 /// A workspace diagnostic report.
116 ///
117 /// @since 3.17.0
118 #[derive(Debug, PartialEq, Default, Deserialize, Serialize, Clone)]
119 pub struct WorkspaceDiagnosticReport {
120 pub items: Vec<WorkspaceDocumentDiagnosticReport>,
121 }
122
123 /// A partial result for a workspace diagnostic report.
124 ///
125 /// @since 3.17.0
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 }