diff --git a/crates/copilot_ui/src/copilot_completion_provider.rs b/crates/copilot_ui/src/copilot_completion_provider.rs index 371496a393..c50f8aa877 100644 --- a/crates/copilot_ui/src/copilot_completion_provider.rs +++ b/crates/copilot_ui/src/copilot_completion_provider.rs @@ -3,7 +3,9 @@ use client::telemetry::Telemetry; use copilot::Copilot; use editor::{Direction, InlineCompletionProvider}; use gpui::{AppContext, EntityId, Model, ModelContext, Task}; +use language::language_settings::AllLanguageSettings; use language::{language_settings::all_language_settings, Buffer, OffsetRangeExt, ToOffset}; +use settings::Settings; use std::{path::Path, sync::Arc, time::Duration}; pub const COPILOT_DEBOUNCE_TIMEOUT: Duration = Duration::from_millis(75); @@ -193,6 +195,11 @@ impl InlineCompletionProvider for CopilotCompletionProvider { } fn discard(&mut self, cx: &mut ModelContext) { + let settings = AllLanguageSettings::get_global(cx); + if !settings.copilot.feature_enabled { + return; + } + self.copilot .update(cx, |copilot, cx| { copilot.discard_completions(&self.completions, cx)