@@ -549,12 +549,13 @@ impl Step for Vscode {
549549 if config. dry_run ( ) {
550550 return ;
551551 }
552- t ! ( create_vscode_settings_maybe( & config) ) ;
552+ while ! t ! ( create_vscode_settings_maybe( & config) ) { }
553553 }
554554}
555555
556556/// 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 > {
558559 let ( current_hash, historical_hashes) = SETTINGS_HASHES . split_last ( ) . unwrap ( ) ;
559560 let vscode_settings = config. src . join ( ".vscode" ) . join ( "settings.json" ) ;
560561 // If None, no settings.json exists
@@ -567,7 +568,7 @@ fn create_vscode_settings_maybe(config: &Config) -> io::Result<()> {
567568 hasher. update ( & current) ;
568569 let hash = hex:: encode ( hasher. finalize ( ) . as_slice ( ) ) ;
569570 if hash == * current_hash {
570- return Ok ( ( ) ) ;
571+ return Ok ( true ) ;
571572 } else if historical_hashes. contains ( & hash. as_str ( ) ) {
572573 mismatched_settings = Some ( true ) ;
573574 } else {
@@ -587,13 +588,13 @@ fn create_vscode_settings_maybe(config: &Config) -> io::Result<()> {
587588 _ => ( ) ,
588589 }
589590 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]" ,
591592 ) ? {
592593 Some ( PromptResult :: Yes ) => true ,
593594 Some ( PromptResult :: Print ) => false ,
594595 _ => {
595596 println ! ( "Ok, skipping settings!" ) ;
596- return Ok ( ( ) ) ;
597+ return Ok ( true ) ;
597598 }
598599 } ;
599600 if should_create {
@@ -620,5 +621,5 @@ fn create_vscode_settings_maybe(config: &Config) -> io::Result<()> {
620621 } else {
621622 println ! ( "\n {RUST_ANALYZER_SETTINGS}" ) ;
622623 }
623- Ok ( ( ) )
624+ Ok ( should_create )
624625}
0 commit comments