Show an error when formatter is not available (#12183)

This commit is contained in:
Tomasz Zurkowski 2024-12-04 15:27:54 +01:00 committed by GitHub
parent 085c4fe4c8
commit 7a2afdc080
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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>],