@@ -111,12 +111,7 @@ impl fmt::Debug for Event {
111
111
112
112
impl GlobalState {
113
113
fn run ( mut self , inbox : Receiver < lsp_server:: Message > ) -> Result < ( ) > {
114
- if self . config . linked_projects ( ) . is_empty ( )
115
- && self . config . detached_files ( ) . is_empty ( )
116
- && self . config . notifications ( ) . cargo_toml_not_found
117
- {
118
- self . show_and_log_error ( "rust-analyzer failed to discover workspace" . to_string ( ) , None ) ;
119
- } ;
114
+ self . update_status_or_notify ( ) ;
120
115
121
116
if self . config . did_save_text_document_dynamic_registration ( ) {
122
117
let save_registration_options = lsp_types:: TextDocumentSaveRegistrationOptions {
@@ -394,25 +389,28 @@ impl GlobalState {
394
389
} ) ;
395
390
}
396
391
392
+ self . update_status_or_notify ( ) ;
393
+
394
+ let loop_duration = loop_start. elapsed ( ) ;
395
+ if loop_duration > Duration :: from_millis ( 100 ) && was_quiescent {
396
+ tracing:: warn!( "overly long loop turn: {:?}" , loop_duration) ;
397
+ self . poke_rust_analyzer_developer ( format ! ( "overly long loop turn: {loop_duration:?}" ) ) ;
398
+ }
399
+ Ok ( ( ) )
400
+ }
401
+
402
+ fn update_status_or_notify ( & mut self ) {
397
403
let status = self . current_status ( ) ;
398
404
if self . last_reported_status . as_ref ( ) != Some ( & status) {
399
405
self . last_reported_status = Some ( status. clone ( ) ) ;
400
406
401
407
if self . config . server_status_notification ( ) {
402
408
self . send_notification :: < lsp_ext:: ServerStatusNotification > ( status) ;
403
- } else {
404
- if let ( lsp_ext:: Health :: Error , Some ( message) ) = ( status. health , & status. message ) {
405
- self . show_message ( lsp_types:: MessageType :: ERROR , message. clone ( ) ) ;
406
- }
409
+ } else if let ( lsp_ext:: Health :: Error , Some ( message) ) = ( status. health , & status. message )
410
+ {
411
+ self . show_and_log_error ( message. clone ( ) , None ) ;
407
412
}
408
413
}
409
-
410
- let loop_duration = loop_start. elapsed ( ) ;
411
- if loop_duration > Duration :: from_millis ( 100 ) && was_quiescent {
412
- tracing:: warn!( "overly long loop turn: {:?}" , loop_duration) ;
413
- self . poke_rust_analyzer_developer ( format ! ( "overly long loop turn: {loop_duration:?}" ) ) ;
414
- }
415
- Ok ( ( ) )
416
414
}
417
415
418
416
fn handle_task ( & mut self , prime_caches_progress : & mut Vec < PrimeCachesProgress > , task : Task ) {
@@ -445,6 +443,9 @@ impl GlobalState {
445
443
ProjectWorkspaceProgress :: Report ( msg) => ( Progress :: Report , Some ( msg) ) ,
446
444
ProjectWorkspaceProgress :: End ( workspaces) => {
447
445
self . fetch_workspaces_queue . op_completed ( Some ( workspaces) ) ;
446
+ if let Err ( e) = self . fetch_workspace_error ( ) {
447
+ tracing:: error!( "FetchWorkspaceError:\n {e}" )
448
+ }
448
449
449
450
let old = Arc :: clone ( & self . workspaces ) ;
450
451
self . switch_workspaces ( "fetched workspace" . to_string ( ) ) ;
@@ -466,6 +467,9 @@ impl GlobalState {
466
467
BuildDataProgress :: Report ( msg) => ( Some ( Progress :: Report ) , Some ( msg) ) ,
467
468
BuildDataProgress :: End ( build_data_result) => {
468
469
self . fetch_build_data_queue . op_completed ( build_data_result) ;
470
+ if let Err ( e) = self . fetch_build_data_error ( ) {
471
+ tracing:: error!( "FetchBuildDataError:\n {e}" )
472
+ }
469
473
470
474
self . switch_workspaces ( "fetched build data" . to_string ( ) ) ;
471
475
@@ -491,6 +495,7 @@ impl GlobalState {
491
495
}
492
496
}
493
497
}
498
+ vfs:: loader:: Message :: Progress { n_total : 0 , .. } => { }
494
499
vfs:: loader:: Message :: Progress { n_total, n_done, config_version } => {
495
500
always ! ( config_version <= self . vfs_config_version) ;
496
501
@@ -554,7 +559,10 @@ impl GlobalState {
554
559
flycheck:: Progress :: DidCheckCrate ( target) => ( Progress :: Report , Some ( target) ) ,
555
560
flycheck:: Progress :: DidCancel => ( Progress :: End , None ) ,
556
561
flycheck:: Progress :: DidFailToRestart ( err) => {
557
- self . show_and_log_error ( "cargo check failed" . to_string ( ) , Some ( err) ) ;
562
+ self . show_and_log_error (
563
+ "cargo check failed to start" . to_string ( ) ,
564
+ Some ( err) ,
565
+ ) ;
558
566
return ;
559
567
}
560
568
flycheck:: Progress :: DidFinish ( result) => {
0 commit comments