Use consistent ordering for popup menus (#27765)

Before this change, the editor completion menu and gutter menus reversed their order so that the initial selection is near the user's focus.  This change instead displays these menus in a consistent top-to-bottom order because the following benefits outweigh that benefit:

* Matches behavior of some other editors (Neovim and VSCode).
* Looks better for lexicographic lists.
* Keeps the meaning of keyboard interaction consistent, if the user is anticipating the order of the menu's contents.

Could consider making this configurable in the future if desired.

Closes #25066.

Release Notes:

- N/A
This commit is contained in:
Aaron Feickert 2025-04-04 15:57:09 -05:00 committed by GitHub
parent f3adf41c25
commit 7bc62de267
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 14 deletions

View file

@ -7702,7 +7702,6 @@ impl Editor {
&self,
style: &EditorStyle,
max_height_in_lines: u32,
y_flipped: bool,
window: &mut Window,
cx: &mut Context<Editor>,
) -> Option<AnyElement> {
@ -7711,7 +7710,7 @@ impl Editor {
if !menu.visible() {
return None;
};
Some(menu.render(style, max_height_in_lines, y_flipped, window, cx))
Some(menu.render(style, max_height_in_lines, window, cx))
}
fn render_context_menu_aside(