mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-03 15:22:13 +00:00
Allow completion menus to be cycled
This commit is contained in:
parent
cc9e92857b
commit
1c5b321058
1 changed files with 14 additions and 3 deletions
|
@ -966,8 +966,11 @@ impl CompletionsMenu {
|
|||
) {
|
||||
if self.selected_item > 0 {
|
||||
self.selected_item -= 1;
|
||||
} else {
|
||||
self.selected_item = self.matches.len() - 1;
|
||||
self.list.scroll_to(ScrollTarget::Show(self.selected_item));
|
||||
}
|
||||
self.list.scroll_to(ScrollTarget::Show(self.selected_item));
|
||||
self.attempt_resolve_selected_completion_documentation(project, cx);
|
||||
cx.notify();
|
||||
}
|
||||
|
@ -979,8 +982,10 @@ impl CompletionsMenu {
|
|||
) {
|
||||
if self.selected_item + 1 < self.matches.len() {
|
||||
self.selected_item += 1;
|
||||
self.list.scroll_to(ScrollTarget::Show(self.selected_item));
|
||||
} else {
|
||||
self.selected_item = 0;
|
||||
}
|
||||
self.list.scroll_to(ScrollTarget::Show(self.selected_item));
|
||||
self.attempt_resolve_selected_completion_documentation(project, cx);
|
||||
cx.notify();
|
||||
}
|
||||
|
@ -1532,17 +1537,23 @@ impl CodeActionsMenu {
|
|||
fn select_prev(&mut self, cx: &mut ViewContext<Editor>) {
|
||||
if self.selected_item > 0 {
|
||||
self.selected_item -= 1;
|
||||
} else {
|
||||
self.selected_item = self.actions.len() - 1;
|
||||
self.list.scroll_to(ScrollTarget::Show(self.selected_item));
|
||||
cx.notify()
|
||||
}
|
||||
self.list.scroll_to(ScrollTarget::Show(self.selected_item));
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
fn select_next(&mut self, cx: &mut ViewContext<Editor>) {
|
||||
if self.selected_item + 1 < self.actions.len() {
|
||||
self.selected_item += 1;
|
||||
self.list.scroll_to(ScrollTarget::Show(self.selected_item));
|
||||
cx.notify()
|
||||
} else {
|
||||
self.selected_item = 0;
|
||||
self.list.scroll_to(ScrollTarget::Show(self.selected_item));
|
||||
}
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
fn select_last(&mut self, cx: &mut ViewContext<Editor>) {
|
||||
|
|
Loading…
Reference in a new issue