Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/span/src/map.rs')
-rw-r--r--crates/span/src/map.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/crates/span/src/map.rs b/crates/span/src/map.rs
index f80de05ec6..66bbce1859 100644
--- a/crates/span/src/map.rs
+++ b/crates/span/src/map.rs
@@ -55,7 +55,10 @@ where
/// Returns all [`TextRange`]s that correspond to the given span.
///
/// Note this does a linear search through the entire backing vector.
- pub fn ranges_with_span_exact(&self, span: SpanData<S>) -> impl Iterator<Item = TextRange> + '_
+ pub fn ranges_with_span_exact(
+ &self,
+ span: SpanData<S>,
+ ) -> impl Iterator<Item = (TextRange, S)> + '_
where
S: Copy,
{
@@ -64,14 +67,14 @@ where
return None;
}
let start = idx.checked_sub(1).map_or(TextSize::new(0), |prev| self.spans[prev].0);
- Some(TextRange::new(start, end))
+ Some((TextRange::new(start, end), s.ctx))
})
}
/// Returns all [`TextRange`]s whose spans contain the given span.
///
/// Note this does a linear search through the entire backing vector.
- pub fn ranges_with_span(&self, span: SpanData<S>) -> impl Iterator<Item = TextRange> + '_
+ pub fn ranges_with_span(&self, span: SpanData<S>) -> impl Iterator<Item = (TextRange, S)> + '_
where
S: Copy,
{
@@ -83,7 +86,7 @@ where
return None;
}
let start = idx.checked_sub(1).map_or(TextSize::new(0), |prev| self.spans[prev].0);
- Some(TextRange::new(start, end))
+ Some((TextRange::new(start, end), s.ctx))
})
}