aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/document.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view/src/document.rs')
-rw-r--r--helix-view/src/document.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index 3c406f8b..3f8dc4e6 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -407,7 +407,11 @@ impl Document {
// We can't use anyhow::Result here since the output of the future has to be
// clonable to be used as shared future. So use a custom error type.
pub fn format(&self) -> Option<BoxFuture<'static, Result<Transaction, FormatterError>>> {
- if let Some(formatter) = self.language_config().and_then(|c| c.formatter.clone()) {
+ if let Some(formatter) = self
+ .language_config()
+ .and_then(|c| c.formatter.clone())
+ .filter(|formatter| which::which(&formatter.command).is_ok())
+ {
use std::process::Stdio;
let text = self.text().clone();
let mut process = tokio::process::Command::new(&formatter.command);