Implement shift-f8 to go to previous diagnostic

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-03-15 15:11:41 +01:00
parent a6d0caf557
commit 021699e51c
8 changed files with 74 additions and 35 deletions

View file

@ -71,6 +71,7 @@ impl DiagnosticSet {
range: Range<T>,
buffer: &'a text::BufferSnapshot,
inclusive: bool,
reversed: bool,
) -> impl 'a + Iterator<Item = DiagnosticEntry<O>>
where
T: 'a + ToOffset,
@ -90,11 +91,19 @@ impl DiagnosticSet {
}
});
cursor.next(buffer);
if reversed {
cursor.prev(buffer);
} else {
cursor.next(buffer);
}
iter::from_fn({
move || {
if let Some(diagnostic) = cursor.item() {
cursor.next(buffer);
if reversed {
cursor.prev(buffer);
} else {
cursor.next(buffer);
}
Some(diagnostic.resolve(buffer))
} else {
None