editor: Context menu aside scrolling (#35985)
Add support for scrolling the contents rendered aside an `editor::code_context_menus::CodeContextMenu` by introducing the `scroll_aside` method. For now this method is only implemented for the `CodeContextMenu::Completions` variant, which will scroll the aside contents for an `editor::code_context_menus::CompletionsMenu` element, as a `ScrollHandle` is added to the aside content that is rendered. In order to be possible to trigger this via keybindings, a new editor action is introduced, `ContextMenuScrollAside`, which accepts a number of lines or pages to scroll the content by. Lastly, the default keymaps for both MacOS and Linux, as well as for Zed's vim mode, are updated to ensure that the following keybindings are supported when a completion menu is open and the completion item's documentation is rendered aside: - `ctrl-e` - `ctrl-y` - `ctrl-d` - `ctrl-u` ### Recording https://github.com/user-attachments/assets/02043763-87ea-46f5-9768-00e907127b69 --- Closes #13194 Release Notes: - Added support for scrolling the documentation panel shown alongside the completion menu in the editor with `cltr-d`, `ctrl-u`, `ctrl-e` and `ctrl-y` --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com> Co-authored-by: MrSubidubi <finn@zed.dev>
This commit is contained in:
co-authored by
Conrad Irwin
MrSubidubi
parent
fcc3d1092f
commit
e9252a7a74
@@ -98,7 +98,7 @@ impl Vim {
|
||||
Vim::take_forced_motion(cx);
|
||||
self.exit_temporary_normal(window, cx);
|
||||
self.update_editor(cx, |_, editor, cx| {
|
||||
scroll_editor(editor, move_cursor, &amount, window, cx)
|
||||
scroll_editor(editor, move_cursor, amount, window, cx)
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -106,7 +106,7 @@ impl Vim {
|
||||
fn scroll_editor(
|
||||
editor: &mut Editor,
|
||||
preserve_cursor_position: bool,
|
||||
amount: &ScrollAmount,
|
||||
amount: ScrollAmount,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Editor>,
|
||||
) {
|
||||
@@ -126,7 +126,7 @@ fn scroll_editor(
|
||||
ScrollAmount::Line(amount.lines(visible_line_count) - 1.0)
|
||||
}
|
||||
}
|
||||
_ => amount.clone(),
|
||||
_ => amount,
|
||||
};
|
||||
|
||||
editor.scroll_screen(&amount, window, cx);
|
||||
|
||||
Reference in New Issue
Block a user