summaryrefslogtreecommitdiff
path: root/src/diagnostics/unclosed_start_tag.rs
diff options
context:
space:
mode:
authorMica White <botahamec@outlook.com>2026-07-12 19:49:14 -0400
committerMica White <botahamec@outlook.com>2026-07-12 19:49:14 -0400
commit8399983fd45bc0f11eac9def280c0833ffb93c04 (patch)
treef84173ca30a3c62db7abb92a0d869ff5d5199c51 /src/diagnostics/unclosed_start_tag.rs
initial commitHEADmain
Diffstat (limited to 'src/diagnostics/unclosed_start_tag.rs')
-rw-r--r--src/diagnostics/unclosed_start_tag.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/diagnostics/unclosed_start_tag.rs b/src/diagnostics/unclosed_start_tag.rs
new file mode 100644
index 0000000..db7e3fb
--- /dev/null
+++ b/src/diagnostics/unclosed_start_tag.rs
@@ -0,0 +1,24 @@
+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<Self> {
+ if element.is_self_closing() || element.end_tag.is_some() {
+ return None;
+ }
+
+ Some(Self {
+ start_tag: element.start_tag.span,
+ })
+ }
+}