From c2aad859b12e01c7724f16ddf957e6db2b3c8a60 Mon Sep 17 00:00:00 2001 From: wojciechkepka Date: Sat, 19 Jun 2021 04:56:50 +0200 Subject: Handle language server shutdown with timeout --- helix-term/src/application.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'helix-term') 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 = Pin + 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"); -- cgit v1.2.3-70-g09d2