@@ -407,7 +407,11 @@ impl Document {
407 // We can't use anyhow::Result here since the output of the future has to be
407 // We can't use anyhow::Result here since the output of the future has to be
408 // clonable to be used as shared future. So use a custom error type.
408 // clonable to be used as shared future. So use a custom error type.
409 pub fn format(&self) -> Option<BoxFuture<'static, Result<Transaction, FormatterError>>> {
409 pub fn format(&self) -> Option<BoxFuture<'static, Result<Transaction, FormatterError>>> {
410+ if let Some(formatter) = self
410− if let Some(formatter) = self.language_config().and_then(|c| c.formatter.clone()) {
412+ .and_then(|c| c.formatter.clone())
413+ .filter(|formatter| which::which(&formatter.command).is_ok())
411 use std::process::Stdio;
415 use std::process::Stdio;
412 let text = self.text().clone();
416 let text = self.text().clone();
413 let mut process = tokio::process::Command::new(&formatter.command);
417 let mut process = tokio::process::Command::new(&formatter.command);