aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--helix-lsp/src/transport.rs29
1 files changed, 15 insertions, 14 deletions
diff --git a/helix-lsp/src/transport.rs b/helix-lsp/src/transport.rs
index 6e28094d..6102c6c8 100644
--- a/helix-lsp/src/transport.rs
+++ b/helix-lsp/src/transport.rs
@@ -215,20 +215,21 @@ impl Transport {
}
};
- let tx = self
- .pending_requests
- .lock()
- .await
- .remove(&id)
- .expect("pending_request with id not found!");
-
- match tx.send(result).await {
- Ok(_) => (),
- Err(_) => error!(
- "Tried sending response into a closed channel (id={:?}), original request likely timed out",
- id
- ),
- };
+ if let Some(tx) = self.pending_requests.lock().await.remove(&id) {
+ match tx.send(result).await {
+ Ok(_) => (),
+ Err(_) => error!(
+ "Tried sending response into a closed channel (id={:?}), original request likely timed out",
+ id
+ ),
+ };
+ } else {
+ log::error!(
+ "Discarding Language Server response without a request (id={:?}) {:?}",
+ id,
+ result
+ );
+ }
Ok(())
}