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:
parent
f3adf41c25
commit
7bc62de267
3 changed files with 7 additions and 14 deletions
|
@ -126,16 +126,15 @@ impl CodeContextMenu {
|
|||
&self,
|
||||
style: &EditorStyle,
|
||||
max_height_in_lines: u32,
|
||||
y_flipped: bool,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Editor>,
|
||||
) -> AnyElement {
|
||||
match self {
|
||||
CodeContextMenu::Completions(menu) => {
|
||||
menu.render(style, max_height_in_lines, y_flipped, window, cx)
|
||||
menu.render(style, max_height_in_lines, window, cx)
|
||||
}
|
||||
CodeContextMenu::CodeActions(menu) => {
|
||||
menu.render(style, max_height_in_lines, y_flipped, window, cx)
|
||||
menu.render(style, max_height_in_lines, window, cx)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -439,7 +438,6 @@ impl CompletionsMenu {
|
|||
&self,
|
||||
style: &EditorStyle,
|
||||
max_height_in_lines: u32,
|
||||
y_flipped: bool,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Editor>,
|
||||
) -> AnyElement {
|
||||
|
@ -589,7 +587,6 @@ impl CompletionsMenu {
|
|||
.occlude()
|
||||
.max_h(max_height_in_lines as f32 * window.line_height())
|
||||
.track_scroll(self.scroll_handle.clone())
|
||||
.y_flipped(y_flipped)
|
||||
.with_width_from_item(widest_completion_ix)
|
||||
.with_sizing_behavior(ListSizingBehavior::Infer);
|
||||
|
||||
|
@ -978,7 +975,6 @@ impl CodeActionsMenu {
|
|||
&self,
|
||||
_style: &EditorStyle,
|
||||
max_height_in_lines: u32,
|
||||
y_flipped: bool,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Editor>,
|
||||
) -> AnyElement {
|
||||
|
@ -1068,7 +1064,6 @@ impl CodeActionsMenu {
|
|||
.occlude()
|
||||
.max_h(max_height_in_lines as f32 * window.line_height())
|
||||
.track_scroll(self.scroll_handle.clone())
|
||||
.y_flipped(y_flipped)
|
||||
.with_width_from_item(
|
||||
self.actions
|
||||
.iter()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue