aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands
diff options
context:
space:
mode:
authorSkyler Hawthorne2022-07-10 02:39:40 +0000
committerSkyler Hawthorne2022-10-19 02:31:38 +0000
commitcb23399dee723cec67f1a04dbe6514dfddfd7f5f (patch)
tree46bffb665bf15a71c05632b8c3afba1bcd14103f /helix-term/src/commands
parentb8a07f7d15a10186fa2b481a3423c23f32d7d561 (diff)
improve reliability of shutdown
Diffstat (limited to 'helix-term/src/commands')
-rw-r--r--helix-term/src/commands/typed.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs
index 14b23f2a..650ff75d 100644
--- a/helix-term/src/commands/typed.rs
+++ b/helix-term/src/commands/typed.rs
@@ -1,5 +1,7 @@
use std::ops::Deref;
+use crate::job::Job;
+
use super::*;
use helix_view::{
@@ -19,6 +21,8 @@ pub struct TypableCommand {
}
fn quit(cx: &mut compositor::Context, args: &[Cow<str>], event: PromptEvent) -> anyhow::Result<()> {
+ log::info!("quitting...");
+
if event != PromptEvent::Validate {
return Ok(());
}
@@ -274,7 +278,7 @@ fn write_impl(
doc.auto_format().map(|fmt| {
let shared = fmt.shared();
let callback = make_format_callback(doc.id(), doc.version(), shared.clone());
- jobs.callback(callback);
+ jobs.add(Job::with_callback(callback).wait_before_exiting());
shared
})
} else {
@@ -512,8 +516,10 @@ fn write_quit(
}
write_impl(cx, args.first(), false)?;
+
let doc = doc_mut!(cx.editor);
+ tokio::task::block_in_place(|| helix_lsp::block_on(cx.jobs.finish()))?;
tokio::task::block_in_place(|| helix_lsp::block_on(doc.try_flush_saves()))
.map(|result| result.map(|_| ()))
.unwrap_or(Ok(()))?;