aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands/typed.rs
diff options
context:
space:
mode:
authorSkyler Hawthorne2022-07-12 03:38:26 +0000
committerSkyler Hawthorne2022-10-19 02:31:39 +0000
commitaaa145067833c41686b7cdde9fb999018735bc04 (patch)
tree539def84aabcb742b8c7c443fabf55db5d660b7c /helix-term/src/commands/typed.rs
parentc9418582d2a6d8dbb8b5bb1d3432a9087438e61d (diff)
fix write-quit with auto format
write-quit will now save all files successfully even when there is auto formatting
Diffstat (limited to 'helix-term/src/commands/typed.rs')
-rw-r--r--helix-term/src/commands/typed.rs17
1 files changed, 10 insertions, 7 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs
index 955b3b58..a687b854 100644
--- a/helix-term/src/commands/typed.rs
+++ b/helix-term/src/commands/typed.rs
@@ -519,9 +519,10 @@ fn write_quit(
write_impl(cx, args.first(), false)?;
+ tokio::task::block_in_place(|| helix_lsp::block_on(cx.jobs.finish(Some(cx.editor), None)))?;
+
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(()))?;
@@ -1491,12 +1492,13 @@ fn tree_sitter_subtree(
let contents = format!("```tsq\n{}\n```", selected_node.to_sexp());
let callback = async move {
- let call: job::Callback =
- Box::new(move |editor: &mut Editor, compositor: &mut Compositor| {
+ let call: job::Callback = Callback::EditorCompositor(Box::new(
+ move |editor: &mut Editor, compositor: &mut Compositor| {
let contents = ui::Markdown::new(contents, editor.syn_loader.clone());
let popup = Popup::new("hover", contents).auto_close(true);
compositor.replace_or_push("hover", popup);
- });
+ },
+ ));
Ok(call)
};
@@ -1604,8 +1606,8 @@ fn run_shell_command(
if !output.is_empty() {
let callback = async move {
- let call: job::Callback =
- Box::new(move |editor: &mut Editor, compositor: &mut Compositor| {
+ let call: job::Callback = Callback::EditorCompositor(Box::new(
+ move |editor: &mut Editor, compositor: &mut Compositor| {
let contents = ui::Markdown::new(
format!("```sh\n{}\n```", output),
editor.syn_loader.clone(),
@@ -1614,7 +1616,8 @@ fn run_shell_command(
helix_core::Position::new(editor.cursor().0.unwrap_or_default().row, 2),
));
compositor.replace_or_push("shell", popup);
- });
+ },
+ ));
Ok(call)
};