@@ -111,12 +111,7 @@ impl fmt::Debug for Event {
111111
112112impl GlobalState {
113113 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 ( ) ;
120115
121116 if self . config . did_save_text_document_dynamic_registration ( ) {
122117 let save_registration_options = lsp_types:: TextDocumentSaveRegistrationOptions {
@@ -394,25 +389,28 @@ impl GlobalState {
394389 } ) ;
395390 }
396391
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 ) {
397403 let status = self . current_status ( ) ;
398404 if self . last_reported_status . as_ref ( ) != Some ( & status) {
399405 self . last_reported_status = Some ( status. clone ( ) ) ;
400406
401407 if self . config . server_status_notification ( ) {
402408 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 ) ;
407412 }
408413 }
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 ( ( ) )
416414 }
417415
418416 fn handle_task ( & mut self , prime_caches_progress : & mut Vec < PrimeCachesProgress > , task : Task ) {
@@ -445,6 +443,9 @@ impl GlobalState {
445443 ProjectWorkspaceProgress :: Report ( msg) => ( Progress :: Report , Some ( msg) ) ,
446444 ProjectWorkspaceProgress :: End ( workspaces) => {
447445 self . fetch_workspaces_queue . op_completed ( Some ( workspaces) ) ;
446+ if let Err ( e) = self . fetch_workspace_error ( ) {
447+ tracing:: error!( "FetchWorkspaceError:\n {e}" ) ;
448+ }
448449
449450 let old = Arc :: clone ( & self . workspaces ) ;
450451 self . switch_workspaces ( "fetched workspace" . to_string ( ) ) ;
@@ -466,6 +467,9 @@ impl GlobalState {
466467 BuildDataProgress :: Report ( msg) => ( Some ( Progress :: Report ) , Some ( msg) ) ,
467468 BuildDataProgress :: End ( build_data_result) => {
468469 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+ }
469473
470474 self . switch_workspaces ( "fetched build data" . to_string ( ) ) ;
471475
@@ -498,6 +502,7 @@ impl GlobalState {
498502 self . vfs_progress_n_total = n_total;
499503 self . vfs_progress_n_done = n_done;
500504
505+ // if n_total != 0 {
501506 let state = if n_done == 0 {
502507 Progress :: Begin
503508 } else if n_done < n_total {
@@ -512,7 +517,8 @@ impl GlobalState {
512517 Some ( format ! ( "{n_done}/{n_total}" ) ) ,
513518 Some ( Progress :: fraction ( n_done, n_total) ) ,
514519 None ,
515- )
520+ ) ;
521+ // }
516522 }
517523 }
518524 }
@@ -554,7 +560,10 @@ impl GlobalState {
554560 flycheck:: Progress :: DidCheckCrate ( target) => ( Progress :: Report , Some ( target) ) ,
555561 flycheck:: Progress :: DidCancel => ( Progress :: End , None ) ,
556562 flycheck:: Progress :: DidFailToRestart ( err) => {
557- self . show_and_log_error ( "cargo check failed" . to_string ( ) , Some ( err) ) ;
563+ self . show_and_log_error (
564+ "cargo check failed to start" . to_string ( ) ,
565+ Some ( err) ,
566+ ) ;
558567 return ;
559568 }
560569 flycheck:: Progress :: DidFinish ( result) => {
0 commit comments