diff --git a/crates/ruff_db/src/diagnostic/mod.rs b/crates/ruff_db/src/diagnostic/mod.rs index 3478d105b5..02b298afbb 100644 --- a/crates/ruff_db/src/diagnostic/mod.rs +++ b/crates/ruff_db/src/diagnostic/mod.rs @@ -3,7 +3,7 @@ use std::{fmt::Formatter, sync::Arc}; use thiserror::Error; use ruff_annotate_snippets::Level as AnnotateLevel; -use ruff_text_size::TextRange; +use ruff_text_size::{Ranged, TextRange}; pub use self::render::DisplayDiagnostic; use crate::files::File; @@ -601,6 +601,12 @@ impl From for Span { } } +impl From for Span { + fn from(file_range: crate::files::FileRange) -> Span { + Span::from(file_range.file()).with_range(file_range.range()) + } +} + #[derive(Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd)] pub enum Severity { Info,