@@ -78,7 +78,7 @@ let nbProcess : ChildProcess | null = null;
78
78
let debugPort : number = - 1 ;
79
79
let debugHash : string | undefined ;
80
80
let consoleLog : boolean = ! ! process . env [ 'ENABLE_CONSOLE_LOG' ] ;
81
-
81
+ let deactivated = false ;
82
82
export class NbLanguageClient extends LanguageClient {
83
83
private _treeViewService : TreeViewService ;
84
84
@@ -328,7 +328,7 @@ class InitialPromise extends Promise<NbLanguageClient> {
328
328
329
329
export function activate ( context : ExtensionContext ) : VSNetBeansAPI {
330
330
let log = vscode . window . createOutputChannel ( SERVER_NAME ) ;
331
-
331
+ deactivated = false ;
332
332
var clientResolve : ( x : NbLanguageClient ) => void ;
333
333
var clientReject : ( err : any ) => void ;
334
334
@@ -514,16 +514,16 @@ export function activate(context: ExtensionContext): VSNetBeansAPI {
514
514
vscode . window . showErrorMessage ( 'Cannot find workspace path' ) ;
515
515
return ;
516
516
}
517
+
517
518
const userDir = path . join ( storagePath , "userdir" ) ;
518
519
if ( userDir && fs . existsSync ( userDir ) ) {
519
- const confirmation = await vscode . window . showInformationMessage ( 'Are you sure you want to delete cache for this workspace?' ,
520
+ const confirmation = await vscode . window . showInformationMessage ( 'Are you sure you want to delete cache for this workspace and reload the window ?' ,
520
521
'Yes' , 'Cancel' ) ;
521
522
if ( confirmation === 'Yes' ) {
522
- await fs . promises . rmdir ( userDir , { recursive : true } ) ;
523
- const res = await vscode . window . showInformationMessage ( 'Cache cleared successfully for this workspace' , 'Reload window' ) ;
524
- if ( res === 'Reload window' ) {
525
- await vscode . commands . executeCommand ( 'workbench.action.reloadWindow' ) ;
526
- }
523
+ stopClient ( client ) . then ( ( ) => killNbProcess ( false , log ) ) . then ( ( ) => {
524
+ fs . promises . rmdir ( userDir , { recursive : true } ) ;
525
+ vscode . commands . executeCommand ( 'workbench.action.reloadWindow' )
526
+ } ) ;
527
527
}
528
528
} else {
529
529
vscode . window . showErrorMessage ( 'Cannot find userdir path' ) ;
@@ -953,7 +953,7 @@ function doActivateWithJDK(specifiedJDK: string | null, context: ExtensionContex
953
953
if ( p == nbProcess && code != 0 && code ) {
954
954
vscode . window . showWarningMessage ( `${ SERVER_NAME } exited with ` + code ) ;
955
955
}
956
- if ( stdErr ?. match ( / C a n n o t f i n d j a v a / ) || os . type ( ) === "Windows_NT" ) {
956
+ if ( stdErr ?. match ( / C a n n o t f i n d j a v a / ) || ( os . type ( ) === "Windows_NT" && ! deactivated ) ) {
957
957
vscode . window . showInformationMessage (
958
958
"No JDK found!" ,
959
959
"Download JDK and setup automatically"
@@ -1422,6 +1422,7 @@ function stopClient(clientPromise: Promise<LanguageClient>): Thenable<void> {
1422
1422
}
1423
1423
1424
1424
export function deactivate ( ) : Thenable < void > {
1425
+ deactivated = true ;
1425
1426
if ( nbProcess != null ) {
1426
1427
nbProcess . kill ( ) ;
1427
1428
}
0 commit comments