Skip to content

Commit 1acb978

Browse files
authored
Update some BI checkpoint for project setting page (#1342)
1 parent 88a1845 commit 1acb978

File tree

4 files changed

+27
-21
lines changed

4 files changed

+27
-21
lines changed

src/project-settings/assets/classpath/features/components/Hint.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const Hint = (): JSX.Element | null => {
3030

3131
useEffect(() => {
3232
updateMaxHeight();
33-
}, [projectType, libraries, effectiveLibraries]);
33+
}, [projectType, classpathModified]);
3434

3535
useEffect(() => {
3636
window.addEventListener('resize', updateMaxHeight);

src/project-settings/handlers/ClasspathRequestHandler.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export class ClasspathRequestHandler implements vscode.Disposable {
120120
return true;
121121
};
122122

123-
private listProjects = instrumentOperation("classpath.listProjects", async (operationId: string) => {
123+
private listProjects = instrumentOperation("projectSettings.classpath.listProjects", async (operationId: string) => {
124124
// listProjects() will be called when the component is mounted,
125125
// we first check the requirement here in case user triggers 'reload webview'
126126
if (!(await this.checkRequirement())) {
@@ -149,7 +149,7 @@ export class ClasspathRequestHandler implements vscode.Disposable {
149149
});
150150
});
151151

152-
private listVmInstalls = instrumentOperation("classpath.listVmInstalls", async (operationId: string) => {
152+
private listVmInstalls = instrumentOperation("projectSettings.classpath.listVmInstalls", async (operationId: string) => {
153153
let vmInstalls: VmInstall[] = await this.getVmInstallsFromLS();
154154
vmInstalls = vmInstalls.sort((vmA: VmInstall, vmB: VmInstall) => {
155155
return vmA.name.localeCompare(vmB.name);
@@ -169,7 +169,7 @@ export class ClasspathRequestHandler implements vscode.Disposable {
169169

170170
private debounceListVmInstalls = _.debounce(this.listVmInstalls, 3000 /*ms*/);
171171

172-
private loadProjectClasspath = instrumentOperation("classpath.loadClasspath", async (operationId: string, currentProjectRoot: vscode.Uri) => {
172+
private loadProjectClasspath = instrumentOperation("projectSettings.classpath.loadClasspath", async (operationId: string, currentProjectRoot: vscode.Uri) => {
173173
const classpath = await this.getProjectClasspathFromLS(currentProjectRoot);
174174
if (classpath) {
175175
this.webview.postMessage({
@@ -215,7 +215,7 @@ export class ClasspathRequestHandler implements vscode.Disposable {
215215
return undefined;
216216
}
217217

218-
private addSourcePathForUnmanagedFolder = instrumentOperation("classpath.addSourcePathForUnmanagedFolder", async (_operationId: string, currentProjectRoot: vscode.Uri) => {
218+
private addSourcePathForUnmanagedFolder = instrumentOperation("projectSettings.classpath.addSourcePathForUnmanagedFolder", async (_operationId: string, currentProjectRoot: vscode.Uri) => {
219219
const relativePath: string | undefined = await this.selectSourceFolderPath(currentProjectRoot);
220220
if (!relativePath) {
221221
return;
@@ -232,15 +232,15 @@ export class ClasspathRequestHandler implements vscode.Disposable {
232232
});
233233
});
234234

235-
private updateSourcePathsForUnmanagedFolder = instrumentOperation("classpath.updateSourcePathsForUnmanagedFolder", async (_operationId: string, currentProjectRoot: vscode.Uri, sourcePaths: string[]) => {
235+
private updateSourcePathsForUnmanagedFolder = instrumentOperation("projectSettings.classpath.updateSourcePathsForUnmanagedFolder", async (_operationId: string, currentProjectRoot: vscode.Uri, sourcePaths: string[]) => {
236236
vscode.workspace.getConfiguration("java", currentProjectRoot).update(
237237
"project.sourcePaths",
238238
sourcePaths,
239239
vscode.ConfigurationTarget.Workspace,
240240
);
241241
});
242242

243-
private selectFolder = instrumentOperation("classpath.selectFolder", async (_operationId: string, currentProjectRoot: vscode.Uri, type: string) => {
243+
private selectFolder = instrumentOperation("projectSettings.classpath.selectFolder", async (_operationId: string, currentProjectRoot: vscode.Uri, type: string) => {
244244
const relativePath: string | undefined = await this.selectSourceFolderPath(currentProjectRoot);
245245
if (!relativePath) {
246246
return;
@@ -252,7 +252,7 @@ export class ClasspathRequestHandler implements vscode.Disposable {
252252
});
253253
});
254254

255-
private updateClassPaths = instrumentOperation("classpath.updateClassPaths", async (_operationId: string, rootPath: string, projectType: ProjectType, sourcePaths: ClasspathEntry[], defaultOutputPath: string, vmInstallPath: string, libraries: ClasspathEntry[]) => {
255+
private updateClassPaths = instrumentOperation("projectSettings.classpath.updateClassPaths", async (_operationId: string, rootPath: string, projectType: ProjectType, sourcePaths: ClasspathEntry[], defaultOutputPath: string, vmInstallPath: string, libraries: ClasspathEntry[]) => {
256256
this.webview.postMessage({
257257
command: "classpath.onDidChangeLoadingState",
258258
loading: true,
@@ -301,7 +301,7 @@ export class ClasspathRequestHandler implements vscode.Disposable {
301301
});
302302
});
303303

304-
private selectOutputPath = instrumentOperation("classpath.selectOutputPath", async (_operationId: string, currentProjectRoot: vscode.Uri) => {
304+
private selectOutputPath = instrumentOperation("projectSettings.classpath.selectOutputPath", async (_operationId: string, currentProjectRoot: vscode.Uri) => {
305305
const outputFolder: vscode.Uri[] | undefined = await vscode.window.showOpenDialog({
306306
defaultUri: vscode.workspace.workspaceFolders?.[0].uri,
307307
openLabel: "Select Output Folder",
@@ -332,7 +332,7 @@ export class ClasspathRequestHandler implements vscode.Disposable {
332332
}
333333
});
334334

335-
private setOutputPath = instrumentOperation("classpath.setOutputPath", async (operationId: string, currentProjectRoot: vscode.Uri, outputRelativePath: string) => {
335+
private setOutputPath = instrumentOperation("projectSettings.classpath.setOutputPath", async (operationId: string, currentProjectRoot: vscode.Uri, outputRelativePath: string) => {
336336
if (vscode.workspace.getConfiguration("java", currentProjectRoot).get<string>("project.outputPath") === outputRelativePath) {
337337
return;
338338
}
@@ -357,7 +357,7 @@ export class ClasspathRequestHandler implements vscode.Disposable {
357357
);
358358
});
359359

360-
private addNewJdk = instrumentOperation("classpath.addNewJdk", async (operationId: string, currentProjectRoot: vscode.Uri) => {
360+
private addNewJdk = instrumentOperation("projectSettings.classpath.addNewJdk", async (operationId: string, currentProjectRoot: vscode.Uri) => {
361361
const actionResult: Record<string, string> = {
362362
name: "classpath.configuration",
363363
kind: "add-new-jdk"
@@ -404,7 +404,7 @@ export class ClasspathRequestHandler implements vscode.Disposable {
404404
}
405405
});
406406

407-
private changeJdk = instrumentOperation("classpath.changeJdk", async (operationId: string, currentProjectRoot: vscode.Uri, jdkPath: string) => {
407+
private changeJdk = instrumentOperation("projectSettings.classpath.changeJdk", async (operationId: string, currentProjectRoot: vscode.Uri, jdkPath: string) => {
408408
const actionResult: Record<string, string> = {
409409
name: "classpath.configuration",
410410
kind: "use-existing-jdk"
@@ -439,7 +439,7 @@ export class ClasspathRequestHandler implements vscode.Disposable {
439439
}
440440
});
441441

442-
private selectLibraries = instrumentOperation("classpath.selectLibraries", async (_operationId: string, currentProjectRoot: vscode.Uri) => {
442+
private selectLibraries = instrumentOperation("projectSettings.classpath.selectLibraries", async (_operationId: string, currentProjectRoot: vscode.Uri) => {
443443
const jarFiles: vscode.Uri[] | undefined = await vscode.window.showOpenDialog({
444444
defaultUri: vscode.workspace.workspaceFolders?.[0].uri,
445445
openLabel: "Select Jar File",
@@ -469,13 +469,13 @@ export class ClasspathRequestHandler implements vscode.Disposable {
469469
}
470470
});
471471

472-
private updateUnmanagedFolderLibraries = instrumentOperation("classpath.updateUnmanagedFolderLibraries", async (_operationId: string, jarFilePaths: string[]) => {
472+
private updateUnmanagedFolderLibraries = instrumentOperation("projectSettings.classpath.updateUnmanagedFolderLibraries", async (_operationId: string, jarFilePaths: string[]) => {
473473
const setting = this.getReferencedLibrariesSetting();
474474
setting.include = jarFilePaths;
475475
this.updateReferencedLibraries(setting);
476476
});
477477

478-
private gotoProjectConfigurationFile = instrumentOperation("classpath.gotoProjectConfigurationFile", (operationId: string, rootUri: string, projectType: ProjectType) => {
478+
private gotoProjectConfigurationFile = instrumentOperation("projectSettings.classpath.gotoProjectConfigurationFile", (operationId: string, rootUri: string, projectType: ProjectType) => {
479479
const rootPath: string = vscode.Uri.parse(rootUri).fsPath;
480480
let configurationPath: string = "";
481481
if (projectType === ProjectType.Gradle) {

src/project-settings/handlers/CompilerRequestHandler.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the MIT license.
33

44
import * as vscode from "vscode";
5-
import { instrumentOperation, sendError, setUserError } from "vscode-extension-telemetry-wrapper";
5+
import { instrumentOperation, sendError, sendInfo, setUserError } from "vscode-extension-telemetry-wrapper";
66

77
const ADD_VARIABlLE_ATTRIBUTE = "org.eclipse.jdt.core.compiler.debug.localVariable";
88
const ADD_LINE_NUMBER_ATTRIBUTE = "org.eclipse.jdt.core.compiler.debug.lineNumber";
@@ -75,7 +75,7 @@ export class CompilerRequestHandler implements vscode.Disposable {
7575
});
7676
});
7777

78-
private onWillUpdateCompilerSettings = instrumentOperation("projectSettings.compiler.onWillUpdateCompilerSettings", async (_operationId: string,
78+
private onWillUpdateCompilerSettings = instrumentOperation("projectSettings.compiler.onWillUpdateCompilerSettings", async (operationId: string,
7979
uri: string, useRelease: boolean, enablePreview: boolean, complianceLevel: string, sourceLevel: string, targetLevel: string,
8080
generateDebugInfo: boolean, storeMethodParamNames: boolean): Promise<void> => {
8181
const compilerSettings: Map<string, string> = new Map<string, string>();
@@ -107,6 +107,12 @@ export class CompilerRequestHandler implements vscode.Disposable {
107107
sourceLevel: compilerSettings.get(SOURCE_COMPATIBILITY),
108108
targetLevel: compilerSettings.get(TARGET_COMPATIBILITY),
109109
});
110+
111+
sendInfo(operationId, {
112+
operationName: "projectSettings.updateCompilerSettings",
113+
// remove the common prefix to reduce the payload.
114+
arg: JSON.stringify([...compilerSettings]).replace(/org\.eclipse\.jdt\.core\.compiler\./g, ""),
115+
});
110116
});
111117

112118
public dispose() {
@@ -141,4 +147,4 @@ export class CompilerRequestHandler implements vscode.Disposable {
141147
return categories?.properties?.["java.configuration.runtimes"];
142148
}
143149
}
144-
}
150+
}

src/project-settings/handlers/MavenRequestHandler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class MavenRequestHandler implements vscode.Disposable {
2626
}));
2727
}
2828

29-
private onWillGetSelectedProfiles = instrumentOperation("maven.onWillGetSelectedProfiles", async (_operationId: string, uri: any): Promise<void> => {
29+
private onWillGetSelectedProfiles = instrumentOperation("projectSettings.maven.onWillGetSelectedProfiles", async (_operationId: string, uri: any): Promise<void> => {
3030
const response: any = await vscode.commands.executeCommand<Object>("java.execute.workspaceCommand",
3131
"java.project.getSettings", uri, [M2E_SELECTED_PROFILES]);
3232
const selectedProfiles: string = response?.[M2E_SELECTED_PROFILES];
@@ -39,12 +39,12 @@ export class MavenRequestHandler implements vscode.Disposable {
3939
}
4040
});
4141

42-
private onWillUpdateSelectProfiles = instrumentOperation("maven.onWillUpdateSelectProfiles", async (_operationId: string, uri: any, selectedProfiles: string[]): Promise<void> => {
42+
private onWillUpdateSelectProfiles = instrumentOperation("projectSettings.maven.onWillUpdateSelectProfiles", async (_operationId: string, uri: any, selectedProfiles: string[]): Promise<void> => {
4343
await vscode.commands.executeCommand("java.execute.workspaceCommand",
4444
"java.project.updateSettings", uri, { [M2E_SELECTED_PROFILES]: selectedProfiles });
4545
});
4646

4747
public dispose() {
4848
this.disposables.forEach(d => d.dispose());
4949
}
50-
}
50+
}

0 commit comments

Comments
 (0)