Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Suppress error logs from `CopilotCompletionProvider` when Copilot is disabled (#9826)

Marshall Bowers9604b22d980e
diff --git a/crates/copilot_ui/src/copilot_completion_provider.rs b/crates/copilot_ui/src/copilot_completion_provider.rs
index 371496a393d..c50f8aa8774 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<Self>) {
+ let settings = AllLanguageSettings::get_global(cx);
+ if !settings.copilot.feature_enabled {
+ return;
+ }
+
self.copilot
.update(cx, |copilot, cx| {
copilot.discard_completions(&self.completions, cx)