diff --git a/src/context.rs b/src/context.rs index 98569d48..17c8f5ed 100644 --- a/src/context.rs +++ b/src/context.rs @@ -442,6 +442,8 @@ impl<'a> Context<'a> { hint: maybe_hint, fixes, custom_docs_url: None, + range_description: None, + info: vec![], } } } diff --git a/src/diagnostic.rs b/src/diagnostic.rs index 93173c74..358dd181 100644 --- a/src/diagnostic.rs +++ b/src/diagnostic.rs @@ -44,6 +44,10 @@ pub struct LintDiagnostic { /// URL to the lint rule documentation. By default, the url uses the /// code to link to lint.deno.land pub custom_docs_url: Option, + /// Additional information displayed beside the highlighted range. + pub range_description: Option, + /// Displays additional information at the end of a diagnostic. + pub info: Vec> } impl Diagnostic for LintDiagnostic { @@ -77,7 +81,7 @@ impl Diagnostic for LintDiagnostic { highlights: vec![DiagnosticSnippetHighlight { range, style: DiagnosticSnippetHighlightStyle::Error, - description: None, + description: self.range_description.as_deref().map(Cow::Borrowed), }], }) } @@ -91,7 +95,7 @@ impl Diagnostic for LintDiagnostic { } fn info(&self) -> Cow<'_, [std::borrow::Cow<'_, str>]> { - Cow::Borrowed(&[]) + Cow::Borrowed(&self.info) } fn docs_url(&self) -> Option> {