mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-03 15:14:42 +00:00
add CellOffsets::ranges
helper
This commit is contained in:
parent
5bfe3f2440
commit
76e63b36bd
1 changed files with 7 additions and 0 deletions
|
@ -308,6 +308,13 @@ impl CellOffsets {
|
|||
})
|
||||
.is_ok()
|
||||
}
|
||||
|
||||
/// Returns an iterator over [`TextRange`]s covered by each cell.
|
||||
pub fn ranges(&self) -> impl Iterator<Item = TextRange> {
|
||||
self.iter()
|
||||
.tuple_windows()
|
||||
.map(|(start, end)| TextRange::new(*start, *end))
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for CellOffsets {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue