Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

editor: Select first match in "Find all references" editor (#13424)

Piotr Osiewicz9298d3b525ab
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 4477fa8bbd9..fc82b3f30e8 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -9181,6 +9181,12 @@ impl Editor {
Editor::for_multibuffer(excerpt_buffer, Some(workspace.project().clone()), true, cx)
});
editor.update(cx, |editor, cx| {
+ if let Some(first_range) = ranges_to_highlight.first() {
+ editor.change_selections(None, cx, |selections| {
+ selections.clear_disjoint();
+ selections.select_anchor_ranges(std::iter::once(first_range.clone()));
+ });
+ }
editor.highlight_background::<Self>(
&ranges_to_highlight,
|theme| theme.editor_highlighted_line_background,