use oxc_span::Span;
use crate::handlers::theme::Style;
#[derive(Copy, Clone, PartialEq, Debug)]
pub(super) enum LabelRenderMode {
SingleLine,
BlockFirst,
BlockRest,
}
#[derive(Debug, Clone)]
pub(super) struct FancySpan<'a> {
label: Option<&'a str>,
span: Span,
pub(super) style: Style,
}
impl PartialEq for FancySpan<'_> {
fn eq(&self, other: &Self) -> bool {
self.label == other.label && self.span == other.span
}
}
impl<'a> FancySpan<'a> {
pub(super) fn new(label: Option<&'a str>, span: Span, style: Style) -> Self {
FancySpan { label, span, style }
}
pub(super) fn has_label(&self) -> bool {
self.label.is_some()
}
pub(super) fn label(&self) -> Option<&str> {
self.label
}
pub(super) fn offset(&self) -> usize {
self.span.start as usize
}
pub(super) fn len(&self) -> usize {
self.span.size() as usize
}
}