diff options
author | wojciechkepka | 2021-06-19 02:56:50 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-19 04:02:56 +0000 |
commit | c2aad859b12e01c7724f16ddf957e6db2b3c8a60 (patch) | |
tree | 5849e5130cf8249d45ade382128233bb32c07f65 /helix-term | |
parent | 03d1ca7b0a2610b5a5ee2956722c0a1fbdc2180c (diff) |
Handle language server shutdown with timeout
Diffstat (limited to 'helix-term')
-rw-r--r-- | helix-term/src/application.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index aa2ce884..1f02ac4f 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -23,7 +23,7 @@ use crossterm::{ use tui::layout::Rect; -use futures_util::stream::FuturesUnordered; +use futures_util::{future, stream::FuturesUnordered}; type BoxFuture<T> = Pin<Box<dyn Future<Output = T> + Send>>; pub type LspCallback = @@ -406,6 +406,17 @@ impl Application { self.event_loop().await; + tokio::time::timeout( + Duration::from_millis(500), + future::join_all( + self.editor + .language_servers + .iter_clients() + .map(|client| client.force_shutdown()), + ), + ) + .await; + // reset cursor shape write!(stdout, "\x1B[2 q"); |