use std::path::PathBuf;
use crate::parser::SyntaxError;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Severity {
Error,
Warning,
Info,
Hint,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Diagnostic {
pub rule: &'static str,
pub severity: Severity,
pub path: PathBuf,
pub start: usize,
pub end: usize,
pub message: String,
}
impl Diagnostic {
pub fn from_parse(path: PathBuf, error: &SyntaxError) -> Self {
Self {
rule: "parse",
severity: Severity::Error,
path,
start: error.start,
end: error.end,
message: error.message.clone(),
}
}
}