From 093e0a30e9b880ed28d8615d75906a17acead1a0 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 27 Mar 2023 11:00:36 +0200 Subject: [PATCH] Replace `editor::CycleCopilotSuggestions` with `copilot::NextSuggestion` --- assets/keymaps/default.json | 3 ++- crates/copilot/src/copilot.rs | 2 +- crates/editor/src/editor.rs | 9 ++------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/assets/keymaps/default.json b/assets/keymaps/default.json index adda80d9ed..03e24c8bc3 100644 --- a/assets/keymaps/default.json +++ b/assets/keymaps/default.json @@ -176,7 +176,8 @@ { "focus": false } - ] + ], + "alt-]": "copilot::NextSuggestion" } }, { diff --git a/crates/copilot/src/copilot.rs b/crates/copilot/src/copilot.rs index af9b7042c8..f0d3ed7258 100644 --- a/crates/copilot/src/copilot.rs +++ b/crates/copilot/src/copilot.rs @@ -19,7 +19,7 @@ use util::{ fs::remove_matching, github::latest_github_release, http::HttpClient, paths, ResultExt, }; -actions!(copilot, [SignIn, SignOut]); +actions!(copilot, [SignIn, SignOut, NextSuggestion]); pub fn init(client: Arc, cx: &mut MutableAppContext) { let copilot = cx.add_model(|cx| Copilot::start(client.http_client(), cx)); diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 49c45eed1f..edfacae268 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -262,7 +262,6 @@ actions!( ToggleSoftWrap, RevealInFinder, CopyHighlightJson - CycleCopilotSuggestions ] ); @@ -391,7 +390,7 @@ pub fn init(cx: &mut MutableAppContext) { cx.add_async_action(Editor::rename); cx.add_async_action(Editor::confirm_rename); cx.add_async_action(Editor::find_all_references); - cx.add_action(Editor::cycle_copilot_suggestions); + cx.add_action(Editor::next_copilot_suggestion); hover_popover::init(cx); link_go_to_definition::init(cx); @@ -2801,11 +2800,7 @@ impl Editor { Some(()) } - fn cycle_copilot_suggestions( - &mut self, - _: &CycleCopilotSuggestions, - cx: &mut ViewContext, - ) { + fn next_copilot_suggestion(&mut self, _: &copilot::NextSuggestion, cx: &mut ViewContext) { if self.copilot_state.completions.is_empty() { return; }