Skip to content

Commit

Permalink
Show an error when formatter is not available (#12183)
Browse files Browse the repository at this point in the history
  • Loading branch information
doriath authored Dec 4, 2024
1 parent 085c4fe commit 7a2afdc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions helix-term/src/commands/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,13 +456,15 @@ fn format(
}

let (view, doc) = current!(cx.editor);
if let Some(format) = doc.format() {
let callback = make_format_callback(doc.id(), doc.version(), view.id, format, None);
cx.jobs.callback(callback);
}
let format = doc.format().context(
"A formatter isn't available, and no language server provides formatting capabilities",
)?;
let callback = make_format_callback(doc.id(), doc.version(), view.id, format, None);
cx.jobs.callback(callback);

Ok(())
}

fn set_indent_style(
cx: &mut compositor::Context,
args: &[Cow<str>],
Expand Down

0 comments on commit 7a2afdc

Please sign in to comment.