Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Do not resubscribe for Copilot logs events
Kirill Bulatovd61565d22746
diff --git a/crates/language_tools/src/lsp_log.rs b/crates/language_tools/src/lsp_log.rsindex d0e9e938394..3f29d6f79b8 100644--- a/crates/language_tools/src/lsp_log.rs+++ b/crates/language_tools/src/lsp_log.rs@@ -181,6 +181,13 @@ impl LogStore {});let server = project.read(cx).language_server_for_id(id);+ if let Some(server) = server.as_deref() {+ if server.has_notification_handler::<lsp::notification::LogMessage>() {+ // Another event wants to re-add the server that was already added and subscribed to, avoid doing it again.+ return Some(server_state.log_buffer.clone());+ }+ }+let weak_project = project.downgrade();let io_tx = self.io_tx.clone();server_state._io_logs_subscription = server.as_ref().map(|server| {diff --git a/crates/lsp/src/lsp.rs b/crates/lsp/src/lsp.rsindex dcfce4f1fba..9b0d6c98b0e 100644--- a/crates/lsp/src/lsp.rs+++ b/crates/lsp/src/lsp.rs@@ -605,6 +605,10 @@ impl LanguageServer {self.notification_handlers.lock().remove(T::METHOD);}+ pub fn has_notification_handler<T: notification::Notification>(&self) -> bool {+ self.notification_handlers.lock().contains_key(T::METHOD)+ }+#[must_use]pub fn on_custom_notification<Params, F>(&self, method: &'static str, mut f: F) -> Subscriptionwhere