@@ -549,12 +549,13 @@ impl Step for Vscode {
549
549
if config. dry_run ( ) {
550
550
return ;
551
551
}
552
- t ! ( create_vscode_settings_maybe( & config) ) ;
552
+ while ! t ! ( create_vscode_settings_maybe( & config) ) { }
553
553
}
554
554
}
555
555
556
556
/// Create a `.vscode/settings.json` file for rustc development, or just print it
557
- fn create_vscode_settings_maybe ( config : & Config ) -> io:: Result < ( ) > {
557
+ /// If this method should be re-called, it returns `false`.
558
+ fn create_vscode_settings_maybe ( config : & Config ) -> io:: Result < bool > {
558
559
let ( current_hash, historical_hashes) = SETTINGS_HASHES . split_last ( ) . unwrap ( ) ;
559
560
let vscode_settings = config. src . join ( ".vscode" ) . join ( "settings.json" ) ;
560
561
// If None, no settings.json exists
@@ -567,7 +568,7 @@ fn create_vscode_settings_maybe(config: &Config) -> io::Result<()> {
567
568
hasher. update ( & current) ;
568
569
let hash = hex:: encode ( hasher. finalize ( ) . as_slice ( ) ) ;
569
570
if hash == * current_hash {
570
- return Ok ( ( ) ) ;
571
+ return Ok ( true ) ;
571
572
} else if historical_hashes. contains ( & hash. as_str ( ) ) {
572
573
mismatched_settings = Some ( true ) ;
573
574
} else {
@@ -587,13 +588,13 @@ fn create_vscode_settings_maybe(config: &Config) -> io::Result<()> {
587
588
_ => ( ) ,
588
589
}
589
590
let should_create = match prompt_user (
590
- "Would you like to create/update ` settings.json`, or only print suggested settings? : [y/p /N]" ,
591
+ "Would you like to create/update settings.json? (Press 'p' to preview values) : [y/N]" ,
591
592
) ? {
592
593
Some ( PromptResult :: Yes ) => true ,
593
594
Some ( PromptResult :: Print ) => false ,
594
595
_ => {
595
596
println ! ( "Ok, skipping settings!" ) ;
596
- return Ok ( ( ) ) ;
597
+ return Ok ( true ) ;
597
598
}
598
599
} ;
599
600
if should_create {
@@ -620,5 +621,5 @@ fn create_vscode_settings_maybe(config: &Config) -> io::Result<()> {
620
621
} else {
621
622
println ! ( "\n {RUST_ANALYZER_SETTINGS}" ) ;
622
623
}
623
- Ok ( ( ) )
624
+ Ok ( should_create )
624
625
}
0 commit comments