@@ -208,8 +208,8 @@ pub fn main_loop(
208
208
)
209
209
} ;
210
210
211
- loop_state. roots_to_scan = world_state. vfs . read ( ) . n_roots ( ) ;
212
- loop_state. roots_total = loop_state . roots_to_scan ;
211
+ loop_state. roots_total = world_state. vfs . read ( ) . n_roots ( ) ;
212
+ loop_state. roots_scanned = 0 ;
213
213
214
214
let pool = ThreadPool :: default ( ) ;
215
215
let ( task_sender, task_receiver) = unbounded :: < Task > ( ) ;
@@ -337,8 +337,8 @@ struct LoopState {
337
337
pending_libraries : Vec < ( SourceRootId , Vec < ( FileId , RelativePathBuf , Arc < String > ) > ) > ,
338
338
workspace_loaded : bool ,
339
339
340
- roots_scanned_progress : Option < usize > ,
341
- roots_to_scan : usize ,
340
+ roots_progress_reported : Option < usize > ,
341
+ roots_scanned : usize ,
342
342
roots_total : usize ,
343
343
}
344
344
@@ -383,7 +383,7 @@ fn loop_turn(
383
383
world_state. add_lib ( lib) ;
384
384
world_state. maybe_collect_garbage ( ) ;
385
385
loop_state. in_flight_libraries -= 1 ;
386
- loop_state. roots_to_scan - = 1 ;
386
+ loop_state. roots_scanned + = 1 ;
387
387
}
388
388
Event :: CheckWatcher ( task) => on_check_task ( task, world_state, task_sender) ?,
389
389
Event :: Msg ( msg) => match msg {
@@ -415,7 +415,7 @@ fn loop_turn(
415
415
} ;
416
416
417
417
let mut state_changed = false ;
418
- if let Some ( changes) = world_state. process_changes ( & mut loop_state. roots_to_scan ) {
418
+ if let Some ( changes) = world_state. process_changes ( & mut loop_state. roots_scanned ) {
419
419
state_changed = true ;
420
420
loop_state. pending_libraries . extend ( changes) ;
421
421
}
@@ -438,7 +438,7 @@ fn loop_turn(
438
438
&& world_state. feature_flags . get ( "notifications.workspace-loaded" ) ;
439
439
440
440
if !loop_state. workspace_loaded
441
- && loop_state. roots_to_scan == 0
441
+ && loop_state. roots_scanned == loop_state . roots_total
442
442
&& loop_state. pending_libraries . is_empty ( )
443
443
&& loop_state. in_flight_libraries == 0
444
444
{
@@ -719,11 +719,11 @@ fn on_diagnostic_task(task: DiagnosticTask, msg_sender: &Sender<Message>, state:
719
719
720
720
fn send_startup_progress ( sender : & Sender < Message > , loop_state : & mut LoopState ) {
721
721
let total: usize = loop_state. roots_total ;
722
- let prev_progress = loop_state. roots_scanned_progress ;
723
- let progress = total - loop_state. roots_to_scan ;
724
- loop_state. roots_scanned_progress = Some ( progress) ;
722
+ let prev = loop_state. roots_progress_reported ;
723
+ let progress = loop_state. roots_scanned ;
724
+ loop_state. roots_progress_reported = Some ( progress) ;
725
725
726
- match ( prev_progress , loop_state. workspace_loaded ) {
726
+ match ( prev , loop_state. workspace_loaded ) {
727
727
( None , false ) => {
728
728
let work_done_progress_create = request_new :: < req:: WorkDoneProgressCreate > (
729
729
loop_state. next_request_id ( ) ,
0 commit comments