@@ -75,17 +75,16 @@ fn open(cx: &mut compositor::Context, args: &[Cow<str>], event: PromptEvent) ->
7575}
7676
7777fn buffer_close_by_ids_impl(
78− editor: &mut Editor,
78+ cx: &mut compositor::Context,
7979 doc_ids: &[DocumentId],
8080 force: bool,
8181) -> anyhow::Result<()> {
82− // TODO: deduplicate with ctx.block_try_flush_writes
83− tokio::task::block_in_place(|| helix_lsp::block_on(editor.flush_writes()));
82+ cx.block_try_flush_writes()?;
8483
8584 let (modified_ids, modified_names): (Vec<_>, Vec<_>) = doc_ids
8685 .iter()
8786 .filter_map(|&doc_id| {
88− if let Err(CloseError::BufferModified(name)) = editor.close_document(doc_id, force) {
87+ if let Err(CloseError::BufferModified(name)) = cx.editor.close_document(doc_id, force) {
8988 Some((doc_id, name))
9089 } else {
9190 None
@@ -94,11 +93,11 @@ fn buffer_close_by_ids_impl(
9493 .unzip();
9594
9695 if let Some(first) = modified_ids.first() {
97− let current = doc!(editor);
96+ let current = doc!(cx.editor);
9897 // If the current document is unmodified, and there are modified
9998 // documents, switch focus to the first modified doc.
10099 if !modified_ids.contains(¤t.id()) {
101− editor.switch(*first, Action::Replace);
100+ cx.editor.switch(*first, Action::Replace);
102101 }
103102 bail!(
104103 "{} unsaved buffer(s) remaining: {:?}",
@@ -157,7 +156,7 @@ fn buffer_close(
157156 }
158157
159158 let document_ids = buffer_gather_paths_impl(cx.editor, args);
160− buffer_close_by_ids_impl(cx.editor, &document_ids, false)
159+ buffer_close_by_ids_impl(cx, &document_ids, false)
161160}
162161
163162fn force_buffer_close(
@@ -170,7 +169,7 @@ fn force_buffer_close(
170169 }
171170
172171 let document_ids = buffer_gather_paths_impl(cx.editor, args);
173− buffer_close_by_ids_impl(cx.editor, &document_ids, true)
172+ buffer_close_by_ids_impl(cx, &document_ids, true)
174173}
175174
176175fn buffer_gather_others_impl(editor: &mut Editor) -> Vec<DocumentId> {
@@ -192,7 +191,7 @@ fn buffer_close_others(
192191 }
193192
194193 let document_ids = buffer_gather_others_impl(cx.editor);
195− buffer_close_by_ids_impl(cx.editor, &document_ids, false)
194+ buffer_close_by_ids_impl(cx, &document_ids, false)
196195}
197196
198197fn force_buffer_close_others(
@@ -205,7 +204,7 @@ fn force_buffer_close_others(
205204 }
206205
207206 let document_ids = buffer_gather_others_impl(cx.editor);
208− buffer_close_by_ids_impl(cx.editor, &document_ids, true)
207+ buffer_close_by_ids_impl(cx, &document_ids, true)
209208}
210209
211210fn buffer_gather_all_impl(editor: &mut Editor) -> Vec<DocumentId> {
@@ -222,7 +221,7 @@ fn buffer_close_all(
222221 }
223222
224223 let document_ids = buffer_gather_all_impl(cx.editor);
225− buffer_close_by_ids_impl(cx.editor, &document_ids, false)
224+ buffer_close_by_ids_impl(cx, &document_ids, false)
226225}
227226
228227fn force_buffer_close_all(
@@ -235,7 +234,7 @@ fn force_buffer_close_all(
235234 }
236235
237236 let document_ids = buffer_gather_all_impl(cx.editor);
238− buffer_close_by_ids_impl(cx.editor, &document_ids, true)
237+ buffer_close_by_ids_impl(cx, &document_ids, true)
239238}
240239
241240fn buffer_next(