Enhance keyboard navigation when showing next diagnostic

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2021-11-18 16:55:18 +01:00
parent 643545e91e
commit 5094380c83
4 changed files with 99 additions and 28 deletions

View file

@ -527,6 +527,7 @@ impl<'a> sum_tree::SeekTarget<'a, AnchorRangeMultimapSummary, FullOffsetRange> f
pub trait AnchorRangeExt {
fn cmp<'a>(&self, b: &Range<Anchor>, buffer: impl Into<Content<'a>>) -> Result<Ordering>;
fn to_offset<'a>(&self, content: impl Into<Content<'a>>) -> Range<usize>;
}
impl AnchorRangeExt for Range<Anchor> {
@ -537,4 +538,9 @@ impl AnchorRangeExt for Range<Anchor> {
ord @ _ => ord,
})
}
fn to_offset<'a>(&self, content: impl Into<Content<'a>>) -> Range<usize> {
let content = content.into();
self.start.to_offset(&content)..self.end.to_offset(&content)
}
}