@@ -1061,7 +1061,7 @@ mod cmd {
1061 view: &View,
1061 view: &View,
1062 doc: &mut Document,
1062 doc: &mut Document,
1063 path: Option<P>,
1063 path: Option<P>,
1064− ) -> Result<(), anyhow::Error> {
1064+ ) -> Result<tokio::task::JoinHandle<Result<(), anyhow::Error>>, anyhow::Error> {
1065 use anyhow::anyhow;
1065 use anyhow::anyhow;
1067 if let Some(path) = path {
1067 if let Some(path) = path {
@@ -1079,8 +1079,7 @@ mod cmd {
1079 if autofmt {
1079 if autofmt {
1080 doc.format(view.id); // TODO: merge into save
1080 doc.format(view.id); // TODO: merge into save
1082− helix_lsp::block_on(tokio::spawn(doc.save()));
1082+ Ok(tokio::spawn(doc.save()))
1086 fn write(cx: &mut compositor::Context, args: &[&str], event: PromptEvent) {
1085 fn write(cx: &mut compositor::Context, args: &[&str], event: PromptEvent) {
@@ -1203,15 +1202,35 @@ mod cmd {
1204 fn write_quit(cx: &mut compositor::Context, args: &[&str], event: PromptEvent) {
1203 fn write_quit(cx: &mut compositor::Context, args: &[&str], event: PromptEvent) {
1205 let (view, doc) = current!(cx.editor);
1204 let (view, doc) = current!(cx.editor);
1206− if let Err(e) = write_impl(view, doc, args.first()) {
1205+ match write_impl(view, doc, args.first()) {
1207+ if let Err(e) = helix_lsp::block_on(handle) {
1207− cx.editor.set_error(e.to_string());
1208+ cx.editor.set_error(e.to_string());
1213+ cx.editor.set_error(e.to_string());
1208− return;
1214+ return;
1210 quit(cx, &[], event)
1217 quit(cx, &[], event)
1213 fn force_write_quit(cx: &mut compositor::Context, args: &[&str], event: PromptEvent) {
1220 fn force_write_quit(cx: &mut compositor::Context, args: &[&str], event: PromptEvent) {
1214− write(cx, args, event);
1221+ let (view, doc) = current!(cx.editor);
1222+ match write_impl(view, doc, args.first()) {
1224+ if let Err(e) = helix_lsp::block_on(handle) {
1225+ cx.editor.set_error(e.to_string());
1230+ cx.editor.set_error(e.to_string());
1215 force_quit(cx, &[], event);
1234 force_quit(cx, &[], event);