use miette::Diagnostic; use thiserror::Error; use crate::{diagnostics::AstDiagnostic, parse::Element, tokenize::Span}; #[derive(Error, Debug, Diagnostic)] #[error("The start tag was not closed")] #[diagnostic(code(UnclosedStartTag), severity(Error))] pub struct UnclosedStartTag { #[label("no matching end tag found")] start_tag: Span, } impl AstDiagnostic for UnclosedStartTag { fn handle_element(element: &Element<'_>) -> Option { if element.is_self_closing() || element.end_tag.is_some() { return None; } Some(Self { start_tag: element.start_tag.span, }) } }