File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -520,12 +520,17 @@ export function activate(context: ExtensionContext): VSNetBeansAPI {
520
520
const confirmation = await vscode . window . showInformationMessage ( 'Are you sure you want to delete cache for this workspace and reload the window ?' ,
521
521
'Yes' , 'Cancel' ) ;
522
522
if ( confirmation === 'Yes' ) {
523
- stopClient ( client ) . then ( ( ) => { deactivated = true ;
524
- return killNbProcess ( false , log ) ; } )
525
- . then ( ( ) => fs . promises . rmdir ( userDir , { recursive : true } ) )
526
- . then ( ( ) => vscode . window . showInformationMessage ( "Cache deleted successfully" , 'Reload window' ) ,
527
- ( err ) => vscode . window . showErrorMessage ( 'Error deleting the cache' , 'Reload window' ) )
528
- . then ( ( ) => { vscode . commands . executeCommand ( "workbench.action.reloadWindow" ) } ) ;
523
+ try {
524
+ await stopClient ( client ) ;
525
+ deactivated = true ;
526
+ await killNbProcess ( false , log ) ;
527
+ await fs . promises . rmdir ( userDir , { recursive : true } ) ;
528
+ await vscode . window . showInformationMessage ( "Cache deleted successfully" , 'Reload window' ) ;
529
+ } catch ( err ) {
530
+ await vscode . window . showErrorMessage ( 'Error deleting the cache' , 'Reload window' ) ;
531
+ } finally {
532
+ vscode . commands . executeCommand ( "workbench.action.reloadWindow" ) ;
533
+ }
529
534
}
530
535
} else {
531
536
vscode . window . showErrorMessage ( 'Cannot find userdir path' ) ;
You can’t perform that action at this time.
0 commit comments