aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/main_loop.rs28
1 files changed, 15 insertions, 13 deletions
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index c38a25a44..7e00d58ec 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -427,6 +427,12 @@ fn loop_turn(
427 } 427 }
428 428
429 if !loop_state.workspace_loaded 429 if !loop_state.workspace_loaded
430 && world_state.feature_flags.get("notifications.workspace-loaded")
431 {
432 send_startup_progress(&connection.sender, loop_state, world_state);
433 }
434
435 if !loop_state.workspace_loaded
430 && world_state.roots_to_scan == 0 436 && world_state.roots_to_scan == 0
431 && loop_state.pending_libraries.is_empty() 437 && loop_state.pending_libraries.is_empty()
432 && loop_state.in_flight_libraries == 0 438 && loop_state.in_flight_libraries == 0
@@ -439,7 +445,6 @@ fn loop_turn(
439 move || snap.analysis().prime_caches(subs).unwrap_or_else(|_: Canceled| ()) 445 move || snap.analysis().prime_caches(subs).unwrap_or_else(|_: Canceled| ())
440 }); 446 });
441 } 447 }
442 send_startup_progress(&connection.sender, loop_state, world_state);
443 448
444 if state_changed { 449 if state_changed {
445 update_file_notifications_on_threadpool( 450 update_file_notifications_on_threadpool(
@@ -708,9 +713,6 @@ fn send_startup_progress(
708 loop_state: &mut LoopState, 713 loop_state: &mut LoopState,
709 world_state: &WorldState, 714 world_state: &WorldState,
710) { 715) {
711 if !world_state.feature_flags.get("notifications.workspace-loaded") {
712 return;
713 }
714 let total: usize = world_state.workspaces.iter().map(|it| it.n_packages()).sum(); 716 let total: usize = world_state.workspaces.iter().map(|it| it.n_packages()).sum();
715 let progress = total - world_state.roots_to_scan; 717 let progress = total - world_state.roots_to_scan;
716 if loop_state.roots_scanned_progress == Some(progress) { 718 if loop_state.roots_scanned_progress == Some(progress) {
@@ -718,8 +720,8 @@ fn send_startup_progress(
718 } 720 }
719 loop_state.roots_scanned_progress = Some(progress); 721 loop_state.roots_scanned_progress = Some(progress);
720 722
721 match (progress, loop_state.workspace_loaded) { 723 match progress {
722 (0, false) => { 724 0 => {
723 let work_done_progress_create = request_new::<req::WorkDoneProgressCreate>( 725 let work_done_progress_create = request_new::<req::WorkDoneProgressCreate>(
724 loop_state.next_request_id(), 726 loop_state.next_request_id(),
725 WorkDoneProgressCreateParams { 727 WorkDoneProgressCreateParams {
@@ -737,7 +739,13 @@ fn send_startup_progress(
737 }), 739 }),
738 ); 740 );
739 } 741 }
740 (_, false) => send_startup_progress_notif( 742 progress if progress == total => send_startup_progress_notif(
743 sender,
744 WorkDoneProgress::End(WorkDoneProgressEnd {
745 message: Some(format!("rust-analyzer loaded, {} packages", progress)),
746 }),
747 ),
748 progress => send_startup_progress_notif(
741 sender, 749 sender,
742 WorkDoneProgress::Report(WorkDoneProgressReport { 750 WorkDoneProgress::Report(WorkDoneProgressReport {
743 cancellable: None, 751 cancellable: None,
@@ -745,12 +753,6 @@ fn send_startup_progress(
745 percentage: Some(100.0 * progress as f64 / total as f64), 753 percentage: Some(100.0 * progress as f64 / total as f64),
746 }), 754 }),
747 ), 755 ),
748 (_, true) => send_startup_progress_notif(
749 sender,
750 WorkDoneProgress::End(WorkDoneProgressEnd {
751 message: Some(format!("rust-analyzer loaded, {} packages", progress)),
752 }),
753 ),
754 } 756 }
755} 757}
756 758