From a278428bd58689f2c007f6349d509bd2bc35bbbd Mon Sep 17 00:00:00 2001 From: Julia Date: Mon, 25 Sep 2023 11:13:50 -0400 Subject: [PATCH] Trigger `scroll_to` on code action list when moving selection --- crates/editor/src/editor.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 0827e13264..0c9d8de969 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -1131,12 +1131,14 @@ struct CodeActionsMenu { impl CodeActionsMenu { fn select_first(&mut self, cx: &mut ViewContext) { self.selected_item = 0; + self.list.scroll_to(ScrollTarget::Show(self.selected_item)); cx.notify() } fn select_prev(&mut self, cx: &mut ViewContext) { if self.selected_item > 0 { self.selected_item -= 1; + self.list.scroll_to(ScrollTarget::Show(self.selected_item)); cx.notify() } } @@ -1144,12 +1146,14 @@ impl CodeActionsMenu { fn select_next(&mut self, cx: &mut ViewContext) { if self.selected_item + 1 < self.actions.len() { self.selected_item += 1; + self.list.scroll_to(ScrollTarget::Show(self.selected_item)); cx.notify() } } fn select_last(&mut self, cx: &mut ViewContext) { self.selected_item = self.actions.len() - 1; + self.list.scroll_to(ScrollTarget::Show(self.selected_item)); cx.notify() }