diff options
Diffstat (limited to 'helix-lsp')
-rw-r--r-- | helix-lsp/Cargo.toml | 1 | ||||
-rw-r--r-- | helix-lsp/src/client.rs | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/helix-lsp/Cargo.toml b/helix-lsp/Cargo.toml index 18aa90d0..caf9287a 100644 --- a/helix-lsp/Cargo.toml +++ b/helix-lsp/Cargo.toml @@ -13,6 +13,7 @@ once_cell = "1.4" lsp-types = { version = "0.86", features = ["proposed"] } smol = "1.2" +smol-timeout = "0.6" url = "2" pathdiff = "0.2" shellexpand = "2.0" diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 207e2970..e3f72a56 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -114,7 +114,14 @@ impl Client { .await .map_err(|e| Error::Other(e.into()))?; - let response = rx.recv().await.map_err(|e| Error::Other(e.into()))??; + use smol_timeout::TimeoutExt; + use std::time::Duration; + + let response = match rx.recv().timeout(Duration::from_secs(2)).await { + Some(response) => response, + None => return Err(Error::Timeout), + } + .map_err(|e| Error::Other(e.into()))??; let response = serde_json::from_value(response)?; |