use text_size::TextRange;
use crate::{DiagnosticCode, DiagnosticLabel, DiagnosticPhase, DiagnosticSeverity};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Diagnostic {
pub severity: DiagnosticSeverity,
pub message: String,
pub code: DiagnosticCode,
pub primary_range: TextRange,
pub secondary_ranges: Vec<TextRange>,
pub labels: Vec<DiagnosticLabel>,
pub phase: DiagnosticPhase,
}
impl Diagnostic {
pub fn new(
severity: DiagnosticSeverity,
code: DiagnosticCode,
message: impl Into<String>,
phase: DiagnosticPhase,
primary_range: TextRange,
) -> Self {
Self {
severity,
message: message.into(),
code,
primary_range,
secondary_ranges: Vec::new(),
labels: Vec::new(),
phase,
}
}
}