@@ -543,12 +543,19 @@ impl Document {
545 if let Some(fmt) = formatting {
545 if let Some(fmt) = formatting {
546− let transaction = fmt.await?;
546+ match fmt.await {
547+ Ok(transaction) => {
547− let success = transaction.changes().apply(&mut text);
548+ let success = transaction.changes().apply(&mut text);
548− if !success {
549+ if !success {
549− // This shouldn't happen, because the transaction changes were generated
550+ // This shouldn't happen, because the transaction changes were generated
550− // from the same text we're saving.
551+ // from the same text we're saving.
551− log::error!("failed to apply format changes before saving");
552+ log::error!("failed to apply format changes before saving");
556+ // formatting failed: report error, and save file without modifications
557+ log::error!("{}", err);