From 6e9ea4784980bd9695a5155b347318998ee20a85 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Mon, 27 Jan 2025 00:36:21 -0700 Subject: [PATCH] Fix completions menu scroll when `y_flipped` and edit prediction arrives (#23580) Release Notes: - N/A --- crates/editor/src/code_context_menus.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/editor/src/code_context_menus.rs b/crates/editor/src/code_context_menus.rs index 5dede7220300ce9f53457f6f81644da70e1d2a8b..7238fc65fe78bcb02888a70e7db8c4ff5ff974a0 100644 --- a/crates/editor/src/code_context_menus.rs +++ b/crates/editor/src/code_context_menus.rs @@ -871,8 +871,9 @@ impl CompletionsMenu { }; entries.extend(matches.into_iter().map(CompletionEntry::Match)); self.selected_item = new_selection; - self.scroll_handle - .scroll_to_item(new_selection, ScrollStrategy::Top); + // Scroll to 0 even if the LSP completion is the only one selected. This keeps the display + // consistent when y_flipped. + self.scroll_handle.scroll_to_item(0, ScrollStrategy::Top); } }