1
1
// Copyright (c) Microsoft Corporation. All rights reserved.
2
2
// Licensed under the MIT license.
3
3
4
+ import * as fs from "fs" ;
5
+ import * as path from "path" ;
4
6
import * 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" ;
6
9
import { ClassPathConfigurationViewSerializer } from "./classpath/classpathConfigurationView" ;
7
10
import { initialize as initCommands } from "./commands" ;
11
+ import { initDaemon } from "./daemon" ;
8
12
import { initialize as initExp } from "./exp" ;
9
13
import { JavaExtGuideViewSerializer } from "./ext-guide" ;
10
14
import { initFormatterSettingsEditorProvider } from "./formatter-settings" ;
11
15
import { initRemoteProfileProvider } from "./formatter-settings/RemoteProfileProvider" ;
12
- import { BeginnerTipsViewSerializer } from "./beginner-tips" ;
13
16
import { InstallJdkViewSerializer } from "./install-jdk" ;
14
17
import { JavaRuntimeViewSerializer , validateJavaRuntime } from "./java-runtime" ;
15
18
import { HelpViewType , showReleaseNotesOnStart } from "./misc" ;
@@ -20,7 +23,8 @@ import { initialize as initUtils } from "./utils";
20
23
import { KEY_SHOW_WHEN_USING_JAVA } from "./utils/globalState" ;
21
24
import { scheduleAction } from "./utils/scheduler" ;
22
25
import { showWelcomeWebview , WelcomeViewSerializer } from "./welcome" ;
23
- import { initDaemon } from "./daemon" ;
26
+
27
+ let cleanJavaWorkspaceIndicator : string ;
24
28
25
29
export async function activate ( context : vscode . ExtensionContext ) {
26
30
syncState ( context ) ;
@@ -38,6 +42,11 @@ async function initializeExtension(_operationId: string, context: vscode.Extensi
38
42
initRecommendations ( context ) ;
39
43
initDaemon ( context ) ;
40
44
45
+ if ( context . storageUri ) {
46
+ const javaWorkspaceStoragePath = path . join ( context . storageUri . fsPath , ".." , "redhat.java" ) ;
47
+ cleanJavaWorkspaceIndicator = path . join ( javaWorkspaceStoragePath , "jdt_ws" , ".cleanWorkspace" ) ;
48
+ }
49
+
41
50
context . subscriptions . push ( vscode . languages . registerCodeActionsProvider ( { scheme : "file" , language : "java" , pattern : "**/*.java" } , new CodeActionProvider ( ) ) ) ;
42
51
43
52
// webview serializers to restore pages
@@ -89,5 +98,11 @@ function initializeTelemetry(_context: vscode.ExtensionContext) {
89
98
}
90
99
91
100
export async function deactivate ( ) {
101
+ if ( cleanJavaWorkspaceIndicator && fs . existsSync ( cleanJavaWorkspaceIndicator ) ) {
102
+ sendInfo ( "" , {
103
+ name : "cleanJavaLSWorkspace" ,
104
+ timestamp : Date . now ( ) . toString ( )
105
+ } ) ;
106
+ }
92
107
await disposeTelemetryWrapper ( ) ;
93
108
}
0 commit comments