use serde::{Deserialize, Serialize};
use url::Url;
use crate::{
FullDocumentDiagnosticReport, PartialResultParams, UnchangedDocumentDiagnosticReport,
WorkDoneProgressParams,
};
#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DiagnosticWorkspaceClientCapabilities {
#[serde(skip_serializing_if = "Option::is_none")]
pub refresh_support: Option<bool>,
}
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
pub struct PreviousResultId {
pub uri: Url,
pub value: String,
}
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct WorkspaceDiagnosticParams {
pub identifier: Option<String>,
pub previous_result_ids: Vec<PreviousResultId>,
#[serde(flatten)]
pub work_done_progress_params: WorkDoneProgressParams,
#[serde(flatten)]
pub partial_result_params: PartialResultParams,
}
#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct WorkspaceFullDocumentDiagnosticReport {
pub uri: Url,
pub version: Option<i64>,
#[serde(flatten)]
pub full_document_diagnostic_report: FullDocumentDiagnosticReport,
}
#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct WorkspaceUnchangedDocumentDiagnosticReport {
pub uri: Url,
pub version: Option<i64>,
#[serde(flatten)]
pub unchanged_document_diagnostic_report: UnchangedDocumentDiagnosticReport,
}
#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
#[serde(tag = "kind", rename_all = "lowercase")]
pub enum WorkspaceDocumentDiagnosticReport {
Full(WorkspaceFullDocumentDiagnosticReport),
Unchanged(WorkspaceUnchangedDocumentDiagnosticReport),
}
impl From<WorkspaceFullDocumentDiagnosticReport> for WorkspaceDocumentDiagnosticReport {
fn from(from: WorkspaceFullDocumentDiagnosticReport) -> Self {
WorkspaceDocumentDiagnosticReport::Full(from)
}
}
impl From<WorkspaceUnchangedDocumentDiagnosticReport> for WorkspaceDocumentDiagnosticReport {
fn from(from: WorkspaceUnchangedDocumentDiagnosticReport) -> Self {
WorkspaceDocumentDiagnosticReport::Unchanged(from)
}
}
#[derive(Debug, PartialEq, Default, Deserialize, Serialize, Clone)]
pub struct WorkspaceDiagnosticReport {
pub items: Vec<WorkspaceDocumentDiagnosticReport>,
}
#[derive(Debug, PartialEq, Default, Deserialize, Serialize, Clone)]
pub struct WorkspaceDiagnosticReportPartialResult {
pub items: Vec<WorkspaceDocumentDiagnosticReport>,
}
#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
#[serde(untagged)]
pub enum WorkspaceDiagnosticReportResult {
Report(WorkspaceDiagnosticReport),
Partial(WorkspaceDiagnosticReportPartialResult),
}
impl From<WorkspaceDiagnosticReport> for WorkspaceDiagnosticReportResult {
fn from(from: WorkspaceDiagnosticReport) -> Self {
WorkspaceDiagnosticReportResult::Report(from)
}
}
impl From<WorkspaceDiagnosticReportPartialResult> for WorkspaceDiagnosticReportResult {
fn from(from: WorkspaceDiagnosticReportPartialResult) -> Self {
WorkspaceDiagnosticReportResult::Partial(from)
}
}