Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
editor: Jumping to diagnostics unfolds target locations (#41932)
Piotr Osiewicz4fd2b3f374a7
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex 9d2e2fc741c..1fd387133dc 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -16025,7 +16025,6 @@ impl Editor {}fn filtered<'a>(- snapshot: EditorSnapshot,severity: GoToDiagnosticSeverityFilter,diagnostics: impl Iterator<Item = DiagnosticEntryRef<'a, usize>>,) -> impl Iterator<Item = DiagnosticEntryRef<'a, usize>> {@@ -16033,19 +16032,15 @@ impl Editor {.filter(move |entry| severity.matches(entry.diagnostic.severity)).filter(|entry| entry.range.start != entry.range.end).filter(|entry| !entry.diagnostic.is_unnecessary)- .filter(move |entry| !snapshot.intersects_fold(entry.range.start))}- let snapshot = self.snapshot(window, cx);let before = filtered(- snapshot.clone(),severity,buffer.diagnostics_in_range(0..selection.start).filter(|entry| entry.range.start <= selection.start),);let after = filtered(- snapshot,severity,buffer.diagnostics_in_range(selection.start..buffer.len())@@ -16084,6 +16079,15 @@ impl Editor {let Some(buffer_id) = buffer.buffer_id_for_anchor(next_diagnostic_start) else {return;};+ let snapshot = self.snapshot(window, cx);+ if snapshot.intersects_fold(next_diagnostic.range.start) {+ self.unfold_ranges(+ std::slice::from_ref(&next_diagnostic.range),+ true,+ false,+ cx,+ );+ }self.change_selections(Default::default(), window, cx, |s| {s.select_ranges(vec![next_diagnostic.range.start..next_diagnostic.range.start,