File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -543,12 +543,19 @@ impl Document {
543
543
}
544
544
545
545
if let Some ( fmt) = formatting {
546
- let transaction = fmt. await ?;
547
- let success = transaction. changes ( ) . apply ( & mut text) ;
548
- if !success {
549
- // This shouldn't happen, because the transaction changes were generated
550
- // from the same text we're saving.
551
- log:: error!( "failed to apply format changes before saving" ) ;
546
+ match fmt. await {
547
+ Ok ( transaction) => {
548
+ let success = transaction. changes ( ) . apply ( & mut text) ;
549
+ if !success {
550
+ // This shouldn't happen, because the transaction changes were generated
551
+ // from the same text we're saving.
552
+ log:: error!( "failed to apply format changes before saving" ) ;
553
+ }
554
+ }
555
+ Err ( err) => {
556
+ // formatting failed: report error, and save file without modifications
557
+ log:: error!( "{}" , err) ;
558
+ }
552
559
}
553
560
}
554
561
You can’t perform that action at this time.
0 commit comments