@@ -34,6 +34,7 @@ fn quit(cx: &mut compositor::Context, args: &[Cow<str>], event: PromptEvent) ->
3434 buffers_remaining_impl(cx.editor)?
3535 }
3636
37+ cx.block_try_flush_writes()?;
3738 cx.editor.close(view!(cx.editor).id);
3839
3940 Ok(())
@@ -518,15 +519,7 @@ fn write_quit(
518519 }
519520
520521 write_impl(cx, args.first(), false)?;
521−
522− tokio::task::block_in_place(|| helix_lsp::block_on(cx.jobs.finish(Some(cx.editor), None)))?;
523−
524− let doc = doc_mut!(cx.editor);
525−
526− tokio::task::block_in_place(|| helix_lsp::block_on(doc.try_flush_saves()))
527− .map(|result| result.map(|_| ()))
528− .unwrap_or(Ok(()))?;
529−
522+ cx.block_try_flush_writes()?;
530523 quit(cx, &[], event)
531524}
532525
@@ -540,6 +533,7 @@ fn force_write_quit(
540533 }
541534
542535 write_impl(cx, args.first(), true)?;
536+ cx.block_try_flush_writes()?;
543537 force_quit(cx, &[], event)
544538}
545539
@@ -613,6 +607,8 @@ fn write_all_impl(
613607 buffers_remaining_impl(cx.editor)?;
614608 }
615609
610+ cx.block_try_flush_writes()?;
611+
616612 // close all views
617613 let views: Vec<_> = cx.editor.tree.views().map(|(view, _)| view.id).collect();
618614 for view_id in views {
@@ -682,6 +678,7 @@ fn quit_all(
682678 return Ok(());
683679 }
684680
681+ cx.block_try_flush_writes()?;
685682 quit_all_impl(cx.editor, false)
686683}
687684
@@ -710,8 +707,9 @@ fn cquit(
710707 .first()
711708 .and_then(|code| code.parse::<i32>().ok())
712709 .unwrap_or(1);
713− cx.editor.exit_code = exit_code;
714710
711+ cx.editor.exit_code = exit_code;
712+ cx.block_try_flush_writes()?;
715713 quit_all_impl(cx.editor, false)
716714}
717715