diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 0bfd6afa3b265dfb3845e944b6d7a916ca066261..56c5be0fbd69c64824ec9635199732d224a1bd6e 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -604,6 +604,7 @@ pub struct Editor { gutter_width: Pixels, style: Option, editor_actions: Vec)>>, + show_copilot_suggestions: bool, } pub struct EditorSnapshot { @@ -1804,6 +1805,7 @@ impl Editor { gutter_width: Default::default(), style: None, editor_actions: Default::default(), + show_copilot_suggestions: mode == EditorMode::Full, _subscriptions: vec![ cx.observe(&buffer, Self::on_buffer_changed), cx.subscribe(&buffer, Self::on_buffer_event), @@ -2066,6 +2068,10 @@ impl Editor { self.read_only = read_only; } + pub fn set_show_copilot_suggestions(&mut self, show_copilot_suggestions: bool) { + self.show_copilot_suggestions = show_copilot_suggestions; + } + fn selections_did_change( &mut self, local: bool, @@ -3976,7 +3982,7 @@ impl Editor { cx: &mut ViewContext, ) -> Option<()> { let copilot = Copilot::global(cx)?; - if self.mode != EditorMode::Full || !copilot.read(cx).status().is_authorized() { + if !self.show_copilot_suggestions || !copilot.read(cx).status().is_authorized() { self.clear_copilot_suggestions(cx); return None; } @@ -4036,7 +4042,7 @@ impl Editor { cx: &mut ViewContext, ) -> Option<()> { let copilot = Copilot::global(cx)?; - if self.mode != EditorMode::Full || !copilot.read(cx).status().is_authorized() { + if !self.show_copilot_suggestions || !copilot.read(cx).status().is_authorized() { return None; } @@ -4161,7 +4167,8 @@ impl Editor { let file = snapshot.file_at(location); let language = snapshot.language_at(location); let settings = all_language_settings(file, cx); - settings.copilot_enabled(language, file.map(|f| f.path().as_ref())) + self.show_copilot_suggestions + && settings.copilot_enabled(language, file.map(|f| f.path().as_ref())) } fn has_active_copilot_suggestion(&self, cx: &AppContext) -> bool { diff --git a/crates/feedback/src/feedback_modal.rs b/crates/feedback/src/feedback_modal.rs index 2444a8e94850f8128aafb0948cb356eee81f1086..38e06376cb6a46795181a3498a0d048b7a968e39 100644 --- a/crates/feedback/src/feedback_modal.rs +++ b/crates/feedback/src/feedback_modal.rs @@ -186,6 +186,7 @@ impl FeedbackModal { cx, ); editor.set_show_gutter(false, cx); + editor.set_show_copilot_suggestions(false); editor.set_vertical_scroll_margin(5, cx); editor }); diff --git a/crates/language_tools/src/lsp_log.rs b/crates/language_tools/src/lsp_log.rs index e3718267582b5331faa0dc71be3338a93022730f..62aead0857c87e6f88482991b4d7f18dae34ca59 100644 --- a/crates/language_tools/src/lsp_log.rs +++ b/crates/language_tools/src/lsp_log.rs @@ -449,6 +449,7 @@ impl LspLogView { editor.set_text(log_contents, cx); editor.move_to_end(&MoveToEnd, cx); editor.set_read_only(true); + editor.set_show_copilot_suggestions(false); editor }); let editor_subscription = cx.subscribe(