Repository: helix-editor/helix (language: rust)

Issue:
There should be an error when formating fails
### Summary

If I format a document that does not have a LSP installed for its language nothing happens

### Reproduction Steps

**I tried this:**
1. `:format`

**I expected this to happen:**
The editor tells me that their is no language server installed for this language and possibly shows me a guide to install a language server

**Instead, this happened:**
Nothing happend


### Helix log

<details><summary>~/.cache/helix/helix.log</summary>

```
2023-04-13T10:38:25.338 helix_view::editor [ERROR] Failed to initialize the LSP for `source.python` { cannot find binary path }
```

</details>


### Platform

Linux

### Terminal Emulator

alacritty

### Helix Version

helix 23.03


Discussion / hints:

Fix patch:
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs
index 7402a06f3233..6890d60eaeee 100644
--- a/helix-term/src/commands/typed.rs
+++ b/helix-term/src/commands/typed.rs
@@ -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>],


Test patch: