@@ -376,7 +376,7 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
376
376
377
377
context . subscriptions . push ( commands . registerCommand ( Commands . OPEN_FORMATTER , async ( ) => openFormatter ( context . extensionPath ) ) ) ;
378
378
379
- context . subscriptions . push ( commands . registerCommand ( Commands . CLEAN_WORKSPACE , ( ) => cleanWorkspace ( workspacePath ) ) ) ;
379
+ context . subscriptions . push ( commands . registerCommand ( Commands . CLEAN_WORKSPACE , ( force ?: boolean ) => cleanWorkspace ( workspacePath , force ) ) ) ;
380
380
381
381
context . subscriptions . push ( commands . registerCommand ( Commands . GET_WORKSPACE_PATH , ( ) => workspacePath ) ) ;
382
382
@@ -715,16 +715,18 @@ function makeRandomHexString(length) {
715
715
return result ;
716
716
}
717
717
718
- async function cleanWorkspace ( workspacePath ) {
719
- const doIt = 'Restart and delete' ;
720
- window . showWarningMessage ( 'Are you sure you want to clean the Java language server workspace?' , 'Cancel' , doIt ) . then ( selection => {
721
- if ( selection === doIt ) {
722
- ensureExists ( workspacePath ) ;
723
- const file = path . join ( workspacePath , cleanWorkspaceFileName ) ;
724
- fs . closeSync ( fs . openSync ( file , 'w' ) ) ;
725
- commands . executeCommand ( Commands . RELOAD_WINDOW ) ;
718
+ async function cleanWorkspace ( workspacePath , force ?: boolean ) {
719
+ if ( ! force ) {
720
+ const doIt = 'Restart and delete' ;
721
+ const selection = await window . showWarningMessage ( 'Are you sure you want to clean the Java language server workspace?' , 'Cancel' , doIt ) ;
722
+ if ( selection !== doIt ) {
723
+ return ;
726
724
}
727
- } ) ;
725
+ }
726
+ ensureExists ( workspacePath ) ;
727
+ const file = path . join ( workspacePath , cleanWorkspaceFileName ) ;
728
+ fs . closeSync ( fs . openSync ( file , 'w' ) ) ;
729
+ commands . executeCommand ( Commands . RELOAD_WINDOW ) ;
728
730
}
729
731
730
732
function openServerLogFile ( workspacePath , column : ViewColumn = ViewColumn . Active ) : Thenable < boolean > {
0 commit comments