From 7fd266efa9b90861f585d0cd7366c94bbeeaa81a Mon Sep 17 00:00:00 2001
From: Gabriel Lopes Rodrigues <gabriel3giga@gmail.com>
Date: Tue, 2 Jan 2024 12:29:22 -0300
Subject: [PATCH] Avoid crashing with 2 instances of the same LSP (#9134)

---
 helix-lsp/src/lib.rs | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs
index b6a99065..34278cd5 100644
--- a/helix-lsp/src/lib.rs
+++ b/helix-lsp/src/lib.rs
@@ -915,10 +915,17 @@ fn start_client(
         }
 
         // next up, notify<initialized>
-        _client
+        let notification_result = _client
             .notify::<lsp::notification::Initialized>(lsp::InitializedParams {})
-            .await
-            .unwrap();
+            .await;
+
+        if let Err(e) = notification_result {
+            log::error!(
+                "failed to notify language server of its initialization: {}",
+                e
+            );
+            return;
+        }
 
         initialize_notify.notify_one();
     });