use range_map::RangeSet;
use crate::formatting::{Formatting, Text};
#[derive(Hash, PartialEq, Eq, Debug, Clone, Copy)]
pub(crate) struct AnnotationId(pub usize);
#[derive(Clone)]
pub struct Opts {
pub colored_range_display: bool,
pub fold: bool,
pub tab_width: usize,
pub context_lines: usize,
pub colorblind_output: bool,
}
#[derive(Clone, Debug)]
pub struct Annotation {
pub priority: usize,
pub formatting: Formatting,
pub ranges: RangeSet<usize>,
pub text: Text,
pub location: AnnotationLocation,
}
#[derive(Clone, Copy, Default, Debug)]
pub enum AnnotationLocation {
Any,
#[default]
AnyNotInline,
Above,
Below,
AboveOrInline,
BelowOrInline,
}
impl AnnotationLocation {
#[expect(dead_code)]
pub fn is_any(&self) -> bool {
matches!(self, Self::Any)
}
pub fn is_inline(&self) -> bool {
matches!(self, Self::Any | Self::AboveOrInline | Self::BelowOrInline)
}
pub fn is_above(&self) -> bool {
matches!(self, Self::Any | Self::AnyNotInline | Self::Above | Self::AboveOrInline)
}
pub fn is_below(&self) -> bool {
matches!(self, Self::Any | Self::AnyNotInline | Self::Below | Self::BelowOrInline)
}
}