on master help sign in
Don't use block_on in jobs.finish(), we can .await
6ea477aBlaž Hrastnik
helix-term/src/application.rs+2−1
@@ -222,7 +222,6 @@ impl Application {
222
222
223 loop {
223 loop {
224 if self.editor.should_close() {
224 if self.editor.should_close() {
225− self.jobs.finish();
226 break;
225 break;
227 }
226 }
228
227
@@ -666,6 +665,8 @@ impl Application {
666
665
667 self.event_loop().await;
666 self.event_loop().await;
668
667
668+ self.jobs.finish().await;
669+
669 if self.editor.close_language_servers(None).await.is_err() {
670 if self.editor.close_language_servers(None).await.is_err() {
670 log::error!("Timed out waiting for language servers to shutdown");
671 log::error!("Timed out waiting for language servers to shutdown");
671 };
672 };
helix-term/src/job.rs+2−2
@@ -93,8 +93,8 @@ impl Jobs {
93 }
93 }
94
94
95 /// Blocks until all the jobs that need to be waited on are done.
95 /// Blocks until all the jobs that need to be waited on are done.
96− pub fn finish(&mut self) {
96+ pub async fn finish(&mut self) {
97 let wait_futures = std::mem::take(&mut self.wait_futures);
97 let wait_futures = std::mem::take(&mut self.wait_futures);
98− helix_lsp::block_on(wait_futures.for_each(|_| future::ready(())));
98+ wait_futures.for_each(|_| future::ready(())).await
99 }
99 }
100}
100}