Skip to main content

only_diagnostic/
label.rs

1use text_size::TextRange;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
4pub struct DiagnosticLabel {
5    pub range: TextRange,
6    pub message: String,
7}
8
9impl DiagnosticLabel {
10    /// Creates a diagnostic label for a specific text range.
11    ///
12    /// Args:
13    /// range: Source range highlighted by the host.
14    /// message: Short label rendered beside the range.
15    ///
16    /// Returns:
17    /// New diagnostic label.
18    pub fn new(range: TextRange, message: impl Into<String>) -> Self {
19        Self {
20            range,
21            message: message.into(),
22        }
23    }
24}