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

@ -1575,7 +1575,7 @@ impl BufferSnapshot {
let mut diagnostic_endpoints = Vec::new();
if language_aware {
tree = self.tree.as_ref();
for entry in self.diagnostics_in_range::<_, usize>(range.clone()) {
for entry in self.diagnostics_in_range::<_, usize>(range.clone(), false) {
diagnostic_endpoints.push(DiagnosticEndpoint {
offset: entry.range.start,
is_start: true,
@ -1838,12 +1838,14 @@ impl BufferSnapshot {
pub fn diagnostics_in_range<'a, T, O>(
&'a self,
search_range: Range<T>,
reversed: bool,
) -> impl 'a + Iterator<Item = DiagnosticEntry<O>>
where
T: 'a + Clone + ToOffset,
O: 'a + FromAnchor,
{
self.diagnostics.range(search_range.clone(), self, true)
self.diagnostics
.range(search_range.clone(), self, true, reversed)
}
pub fn diagnostic_groups(&self) -> Vec<DiagnosticGroup<Anchor>> {