11// Copyright (c) Microsoft Corporation. All rights reserved.
22// Licensed under the MIT license.
33
4+ import * as fs from "fs" ;
5+ import * as path from "path" ;
46import * as vscode from "vscode" ;
5- import { dispose as disposeTelemetryWrapper , initialize , instrumentOperation } from "vscode-extension-telemetry-wrapper" ;
7+ import { dispose as disposeTelemetryWrapper , initialize , instrumentOperation , sendInfo } from "vscode-extension-telemetry-wrapper" ;
8+ import { BeginnerTipsViewSerializer } from "./beginner-tips" ;
69import { ClassPathConfigurationViewSerializer } from "./classpath/classpathConfigurationView" ;
710import { initialize as initCommands } from "./commands" ;
11+ import { initDaemon } from "./daemon" ;
812import { initialize as initExp } from "./exp" ;
913import { JavaExtGuideViewSerializer } from "./ext-guide" ;
1014import { initFormatterSettingsEditorProvider } from "./formatter-settings" ;
1115import { initRemoteProfileProvider } from "./formatter-settings/RemoteProfileProvider" ;
12- import { BeginnerTipsViewSerializer } from "./beginner-tips" ;
1316import { InstallJdkViewSerializer } from "./install-jdk" ;
1417import { JavaRuntimeViewSerializer , validateJavaRuntime } from "./java-runtime" ;
1518import { HelpViewType , showReleaseNotesOnStart } from "./misc" ;
@@ -20,7 +23,8 @@ import { initialize as initUtils } from "./utils";
2023import { KEY_SHOW_WHEN_USING_JAVA } from "./utils/globalState" ;
2124import { scheduleAction } from "./utils/scheduler" ;
2225import { showWelcomeWebview , WelcomeViewSerializer } from "./welcome" ;
23- import { initDaemon } from "./daemon" ;
26+
27+ let cleanJavaWorkspaceIndicator : string ;
2428
2529export async function activate ( context : vscode . ExtensionContext ) {
2630 syncState ( context ) ;
@@ -38,6 +42,11 @@ async function initializeExtension(_operationId: string, context: vscode.Extensi
3842 initRecommendations ( context ) ;
3943 initDaemon ( context ) ;
4044
45+ if ( context . storageUri ) {
46+ const javaWorkspaceStoragePath = path . join ( context . storageUri . fsPath , ".." , "redhat.java" ) ;
47+ cleanJavaWorkspaceIndicator = path . join ( javaWorkspaceStoragePath , "jdt_ws" , ".cleanWorkspace" ) ;
48+ }
49+
4150 context . subscriptions . push ( vscode . languages . registerCodeActionsProvider ( { scheme : "file" , language : "java" , pattern : "**/*.java" } , new CodeActionProvider ( ) ) ) ;
4251
4352 // webview serializers to restore pages
@@ -89,5 +98,11 @@ function initializeTelemetry(_context: vscode.ExtensionContext) {
8998}
9099
91100export async function deactivate ( ) {
101+ if ( cleanJavaWorkspaceIndicator && fs . existsSync ( cleanJavaWorkspaceIndicator ) ) {
102+ sendInfo ( "" , {
103+ name : "cleanJavaLSWorkspace" ,
104+ timestamp : Date . now ( ) . toString ( )
105+ } ) ;
106+ }
92107 await disposeTelemetryWrapper ( ) ;
93108}
0 commit comments