Do not resubscribe for Copilot logs events

Copilot sends multiple events about its LSP server readiness, not necessarily recreating the server from scratch (e.g. due to re-sign in action).
Avoid re-adding same log subscriptions on the same LSP server, which
causes panics.
This commit is contained in:
Kirill Bulatov 2023-09-22 13:40:20 +03:00
parent a5e055f8a5
commit d61565d227
2 changed files with 11 additions and 0 deletions

View file

@ -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) -> Subscription
where