@@ -257,7 +257,7 @@ impl GlobalState {
257257 }
258258 } ;
259259
260- self . report_progress ( "Indexing" , state, message, Some ( fraction) ) ;
260+ self . report_progress ( "Indexing" , state, message, Some ( fraction) , None ) ;
261261 }
262262 }
263263 Event :: Vfs ( message) => {
@@ -465,7 +465,7 @@ impl GlobalState {
465465 }
466466 } ;
467467
468- self . report_progress ( "Fetching" , state, msg, None ) ;
468+ self . report_progress ( "Fetching" , state, msg, None , None ) ;
469469 }
470470 Task :: FetchBuildData ( progress) => {
471471 let ( state, msg) = match progress {
@@ -481,7 +481,7 @@ impl GlobalState {
481481 } ;
482482
483483 if let Some ( state) = state {
484- self . report_progress ( "Loading" , state, msg, None ) ;
484+ self . report_progress ( "Loading" , state, msg, None , None ) ;
485485 }
486486 }
487487 }
@@ -518,6 +518,7 @@ impl GlobalState {
518518 state,
519519 Some ( format ! ( "{}/{}" , n_done, n_total) ) ,
520520 Some ( Progress :: fraction ( n_done, n_total) ) ,
521+ None ,
521522 )
522523 }
523524 }
@@ -584,7 +585,13 @@ impl GlobalState {
584585 } else {
585586 format ! ( "cargo check (#{})" , id + 1 )
586587 } ;
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+ ) ;
588595 }
589596 }
590597 }
@@ -698,7 +705,16 @@ impl GlobalState {
698705 this. cancel ( id) ;
699706 Ok ( ( ) )
700707 } ) ?
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+ }
702718 // Just ignore this. It is OK to continue sending progress
703719 // notifications for this token, as the client can't know when
704720 // we accepted notification.
0 commit comments