@@ -913,9 +913,7 @@ class ProjectDataProvider implements vscode.TreeDataProvider<ProjTreeItem>, vsco
913913 this . dataChangedEvent . fire ( ele ) ;
914914
915915 // whole treeview updated
916- if ( ele == undefined ) {
917- setTimeout ( ( ) => this . updateStatusBarForActiveProjects ( ) , 500 ) ;
918- }
916+ this . updateStatusBarForActiveProjects ( ) ;
919917 }
920918
921919 private updateStatusBarForActiveProjects ( ) {
@@ -955,9 +953,7 @@ class ProjectDataProvider implements vscode.TreeDataProvider<ProjTreeItem>, vsco
955953 return this . prjList [ 0 ] ;
956954 }
957955
958- const index = this . prjList . findIndex ( ( prj ) => {
959- return prj . getWsPath ( ) == this . activePrjPath ;
960- } ) ;
956+ const index = this . prjList . findIndex ( ( prj ) => prj . getWsPath ( ) == this . activePrjPath ) ;
961957 if ( index != - 1 ) {
962958 return this . prjList [ index ] ;
963959 }
@@ -3765,7 +3761,7 @@ export class ProjectExplorer implements CustomConfigurationProvider {
37653761 const msg = view_str$prompt$need_reload_project . replace ( '{}' , prj . getProjectName ( ) ) ;
37663762 const ans = await vscode . window . showInformationMessage ( msg , 'Yes' , 'No' ) ;
37673763 if ( ans == 'Yes' ) {
3768- this . reloadProject ( uid , wsf ) ;
3764+ await this . reloadProject ( uid , wsf ) ;
37693765 }
37703766
37713767 if ( this . __autosaveDisableTimeoutTimer ) {
@@ -3779,20 +3775,28 @@ export class ProjectExplorer implements CustomConfigurationProvider {
37793775 this . enableAutoSave ( true ) ;
37803776 }
37813777
3782- private reloadProject ( uid : string , workspaceFile : File ) {
3778+ private async reloadProject ( uid : string , workspaceFile : File ) : Promise < boolean > {
37833779
37843780 const idx = this . dataProvider . getIndexByProjectUid ( uid ) ;
37853781 if ( idx == - 1 ) {
37863782 GlobalEvent . emit ( 'msg' , newMessage ( 'Error' , `Project '${ uid } ' is not actived !` ) ) ;
3787- return ;
3783+ return false ;
37883784 }
37893785
3790- // close and reopen project
37913786 this . dataProvider . Close ( idx ) ;
3792- this . dataProvider . OpenProject ( workspaceFile . path , true ) ;
37933787
3794- // refresh explorer tree view
3795- this . Refresh ( ) ;
3788+ return new Promise ( ( resolve ) => {
3789+ setTimeout ( async ( ) => {
3790+ try {
3791+ await this . dataProvider . OpenProject ( workspaceFile . path , true ) ;
3792+ this . Refresh ( ) ;
3793+ resolve ( true ) ;
3794+ } catch ( error ) {
3795+ GlobalEvent . emit ( 'error' , error ) ;
3796+ resolve ( false ) ;
3797+ }
3798+ } , 500 ) ;
3799+ } ) ;
37963800 }
37973801
37983802 private async onProjectClosed ( uid : string | undefined ) {
0 commit comments