@@ -257,7 +257,7 @@ impl GlobalState {
257
257
}
258
258
} ;
259
259
260
- self . report_progress ( "Indexing" , state, message, Some ( fraction) ) ;
260
+ self . report_progress ( "Indexing" , state, message, Some ( fraction) , None ) ;
261
261
}
262
262
}
263
263
Event :: Vfs ( message) => {
@@ -465,7 +465,7 @@ impl GlobalState {
465
465
}
466
466
} ;
467
467
468
- self . report_progress ( "Fetching" , state, msg, None ) ;
468
+ self . report_progress ( "Fetching" , state, msg, None , None ) ;
469
469
}
470
470
Task :: FetchBuildData ( progress) => {
471
471
let ( state, msg) = match progress {
@@ -481,7 +481,7 @@ impl GlobalState {
481
481
} ;
482
482
483
483
if let Some ( state) = state {
484
- self . report_progress ( "Loading" , state, msg, None ) ;
484
+ self . report_progress ( "Loading" , state, msg, None , None ) ;
485
485
}
486
486
}
487
487
}
@@ -518,6 +518,7 @@ impl GlobalState {
518
518
state,
519
519
Some ( format ! ( "{}/{}" , n_done, n_total) ) ,
520
520
Some ( Progress :: fraction ( n_done, n_total) ) ,
521
+ None ,
521
522
)
522
523
}
523
524
}
@@ -584,7 +585,13 @@ impl GlobalState {
584
585
} else {
585
586
format ! ( "cargo check (#{})" , id + 1 )
586
587
} ;
587
- self . report_progress ( & title, state, message, None ) ;
588
+ self . report_progress (
589
+ & title,
590
+ state,
591
+ message,
592
+ None ,
593
+ Some ( format ! ( "rust-analyzer/checkOnSave/{}" , id) ) ,
594
+ ) ;
588
595
}
589
596
}
590
597
}
@@ -698,7 +705,16 @@ impl GlobalState {
698
705
this. cancel ( id) ;
699
706
Ok ( ( ) )
700
707
} ) ?
701
- . on :: < lsp_types:: notification:: WorkDoneProgressCancel > ( |_this, _params| {
708
+ . on :: < lsp_types:: notification:: WorkDoneProgressCancel > ( |this, params| {
709
+ if let lsp_types:: NumberOrString :: String ( s) = & params. token {
710
+ if let Some ( id) = s. strip_prefix ( "rust-analyzer/checkOnSave/" ) {
711
+ if let Ok ( id) = u32:: from_str_radix ( id, 10 ) {
712
+ if let Some ( flycheck) = this. flycheck . get ( id as usize ) {
713
+ flycheck. cancel ( ) ;
714
+ }
715
+ }
716
+ }
717
+ }
702
718
// Just ignore this. It is OK to continue sending progress
703
719
// notifications for this token, as the client can't know when
704
720
// we accepted notification.
0 commit comments