diff --git a/src/project-settings/assets/classpath/features/components/Hint.tsx b/src/project-settings/assets/classpath/features/components/Hint.tsx index 877c41d3..ac140ec9 100644 --- a/src/project-settings/assets/classpath/features/components/Hint.tsx +++ b/src/project-settings/assets/classpath/features/components/Hint.tsx @@ -30,7 +30,7 @@ const Hint = (): JSX.Element | null => { useEffect(() => { updateMaxHeight(); - }, [projectType, libraries, effectiveLibraries]); + }, [projectType, classpathModified]); useEffect(() => { window.addEventListener('resize', updateMaxHeight); diff --git a/src/project-settings/handlers/ClasspathRequestHandler.ts b/src/project-settings/handlers/ClasspathRequestHandler.ts index f09b21d6..05601e24 100644 --- a/src/project-settings/handlers/ClasspathRequestHandler.ts +++ b/src/project-settings/handlers/ClasspathRequestHandler.ts @@ -120,7 +120,7 @@ export class ClasspathRequestHandler implements vscode.Disposable { return true; }; - private listProjects = instrumentOperation("classpath.listProjects", async (operationId: string) => { + private listProjects = instrumentOperation("projectSettings.classpath.listProjects", async (operationId: string) => { // listProjects() will be called when the component is mounted, // we first check the requirement here in case user triggers 'reload webview' if (!(await this.checkRequirement())) { @@ -149,7 +149,7 @@ export class ClasspathRequestHandler implements vscode.Disposable { }); }); - private listVmInstalls = instrumentOperation("classpath.listVmInstalls", async (operationId: string) => { + private listVmInstalls = instrumentOperation("projectSettings.classpath.listVmInstalls", async (operationId: string) => { let vmInstalls: VmInstall[] = await this.getVmInstallsFromLS(); vmInstalls = vmInstalls.sort((vmA: VmInstall, vmB: VmInstall) => { return vmA.name.localeCompare(vmB.name); @@ -169,7 +169,7 @@ export class ClasspathRequestHandler implements vscode.Disposable { private debounceListVmInstalls = _.debounce(this.listVmInstalls, 3000 /*ms*/); - private loadProjectClasspath = instrumentOperation("classpath.loadClasspath", async (operationId: string, currentProjectRoot: vscode.Uri) => { + private loadProjectClasspath = instrumentOperation("projectSettings.classpath.loadClasspath", async (operationId: string, currentProjectRoot: vscode.Uri) => { const classpath = await this.getProjectClasspathFromLS(currentProjectRoot); if (classpath) { this.webview.postMessage({ @@ -215,7 +215,7 @@ export class ClasspathRequestHandler implements vscode.Disposable { return undefined; } - private addSourcePathForUnmanagedFolder = instrumentOperation("classpath.addSourcePathForUnmanagedFolder", async (_operationId: string, currentProjectRoot: vscode.Uri) => { + private addSourcePathForUnmanagedFolder = instrumentOperation("projectSettings.classpath.addSourcePathForUnmanagedFolder", async (_operationId: string, currentProjectRoot: vscode.Uri) => { const relativePath: string | undefined = await this.selectSourceFolderPath(currentProjectRoot); if (!relativePath) { return; @@ -232,7 +232,7 @@ export class ClasspathRequestHandler implements vscode.Disposable { }); }); - private updateSourcePathsForUnmanagedFolder = instrumentOperation("classpath.updateSourcePathsForUnmanagedFolder", async (_operationId: string, currentProjectRoot: vscode.Uri, sourcePaths: string[]) => { + private updateSourcePathsForUnmanagedFolder = instrumentOperation("projectSettings.classpath.updateSourcePathsForUnmanagedFolder", async (_operationId: string, currentProjectRoot: vscode.Uri, sourcePaths: string[]) => { vscode.workspace.getConfiguration("java", currentProjectRoot).update( "project.sourcePaths", sourcePaths, @@ -240,7 +240,7 @@ export class ClasspathRequestHandler implements vscode.Disposable { ); }); - private selectFolder = instrumentOperation("classpath.selectFolder", async (_operationId: string, currentProjectRoot: vscode.Uri, type: string) => { + private selectFolder = instrumentOperation("projectSettings.classpath.selectFolder", async (_operationId: string, currentProjectRoot: vscode.Uri, type: string) => { const relativePath: string | undefined = await this.selectSourceFolderPath(currentProjectRoot); if (!relativePath) { return; @@ -252,7 +252,7 @@ export class ClasspathRequestHandler implements vscode.Disposable { }); }); - private updateClassPaths = instrumentOperation("classpath.updateClassPaths", async (_operationId: string, rootPath: string, projectType: ProjectType, sourcePaths: ClasspathEntry[], defaultOutputPath: string, vmInstallPath: string, libraries: ClasspathEntry[]) => { + private updateClassPaths = instrumentOperation("projectSettings.classpath.updateClassPaths", async (_operationId: string, rootPath: string, projectType: ProjectType, sourcePaths: ClasspathEntry[], defaultOutputPath: string, vmInstallPath: string, libraries: ClasspathEntry[]) => { this.webview.postMessage({ command: "classpath.onDidChangeLoadingState", loading: true, @@ -301,7 +301,7 @@ export class ClasspathRequestHandler implements vscode.Disposable { }); }); - private selectOutputPath = instrumentOperation("classpath.selectOutputPath", async (_operationId: string, currentProjectRoot: vscode.Uri) => { + private selectOutputPath = instrumentOperation("projectSettings.classpath.selectOutputPath", async (_operationId: string, currentProjectRoot: vscode.Uri) => { const outputFolder: vscode.Uri[] | undefined = await vscode.window.showOpenDialog({ defaultUri: vscode.workspace.workspaceFolders?.[0].uri, openLabel: "Select Output Folder", @@ -332,7 +332,7 @@ export class ClasspathRequestHandler implements vscode.Disposable { } }); - private setOutputPath = instrumentOperation("classpath.setOutputPath", async (operationId: string, currentProjectRoot: vscode.Uri, outputRelativePath: string) => { + private setOutputPath = instrumentOperation("projectSettings.classpath.setOutputPath", async (operationId: string, currentProjectRoot: vscode.Uri, outputRelativePath: string) => { if (vscode.workspace.getConfiguration("java", currentProjectRoot).get("project.outputPath") === outputRelativePath) { return; } @@ -357,7 +357,7 @@ export class ClasspathRequestHandler implements vscode.Disposable { ); }); - private addNewJdk = instrumentOperation("classpath.addNewJdk", async (operationId: string, currentProjectRoot: vscode.Uri) => { + private addNewJdk = instrumentOperation("projectSettings.classpath.addNewJdk", async (operationId: string, currentProjectRoot: vscode.Uri) => { const actionResult: Record = { name: "classpath.configuration", kind: "add-new-jdk" @@ -404,7 +404,7 @@ export class ClasspathRequestHandler implements vscode.Disposable { } }); - private changeJdk = instrumentOperation("classpath.changeJdk", async (operationId: string, currentProjectRoot: vscode.Uri, jdkPath: string) => { + private changeJdk = instrumentOperation("projectSettings.classpath.changeJdk", async (operationId: string, currentProjectRoot: vscode.Uri, jdkPath: string) => { const actionResult: Record = { name: "classpath.configuration", kind: "use-existing-jdk" @@ -439,7 +439,7 @@ export class ClasspathRequestHandler implements vscode.Disposable { } }); - private selectLibraries = instrumentOperation("classpath.selectLibraries", async (_operationId: string, currentProjectRoot: vscode.Uri) => { + private selectLibraries = instrumentOperation("projectSettings.classpath.selectLibraries", async (_operationId: string, currentProjectRoot: vscode.Uri) => { const jarFiles: vscode.Uri[] | undefined = await vscode.window.showOpenDialog({ defaultUri: vscode.workspace.workspaceFolders?.[0].uri, openLabel: "Select Jar File", @@ -469,13 +469,13 @@ export class ClasspathRequestHandler implements vscode.Disposable { } }); - private updateUnmanagedFolderLibraries = instrumentOperation("classpath.updateUnmanagedFolderLibraries", async (_operationId: string, jarFilePaths: string[]) => { + private updateUnmanagedFolderLibraries = instrumentOperation("projectSettings.classpath.updateUnmanagedFolderLibraries", async (_operationId: string, jarFilePaths: string[]) => { const setting = this.getReferencedLibrariesSetting(); setting.include = jarFilePaths; this.updateReferencedLibraries(setting); }); - private gotoProjectConfigurationFile = instrumentOperation("classpath.gotoProjectConfigurationFile", (operationId: string, rootUri: string, projectType: ProjectType) => { + private gotoProjectConfigurationFile = instrumentOperation("projectSettings.classpath.gotoProjectConfigurationFile", (operationId: string, rootUri: string, projectType: ProjectType) => { const rootPath: string = vscode.Uri.parse(rootUri).fsPath; let configurationPath: string = ""; if (projectType === ProjectType.Gradle) { diff --git a/src/project-settings/handlers/CompilerRequestHandler.ts b/src/project-settings/handlers/CompilerRequestHandler.ts index 09838ab2..af56120b 100644 --- a/src/project-settings/handlers/CompilerRequestHandler.ts +++ b/src/project-settings/handlers/CompilerRequestHandler.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import * as vscode from "vscode"; -import { instrumentOperation, sendError, setUserError } from "vscode-extension-telemetry-wrapper"; +import { instrumentOperation, sendError, sendInfo, setUserError } from "vscode-extension-telemetry-wrapper"; const ADD_VARIABlLE_ATTRIBUTE = "org.eclipse.jdt.core.compiler.debug.localVariable"; const ADD_LINE_NUMBER_ATTRIBUTE = "org.eclipse.jdt.core.compiler.debug.lineNumber"; @@ -75,7 +75,7 @@ export class CompilerRequestHandler implements vscode.Disposable { }); }); - private onWillUpdateCompilerSettings = instrumentOperation("projectSettings.compiler.onWillUpdateCompilerSettings", async (_operationId: string, + private onWillUpdateCompilerSettings = instrumentOperation("projectSettings.compiler.onWillUpdateCompilerSettings", async (operationId: string, uri: string, useRelease: boolean, enablePreview: boolean, complianceLevel: string, sourceLevel: string, targetLevel: string, generateDebugInfo: boolean, storeMethodParamNames: boolean): Promise => { const compilerSettings: Map = new Map(); @@ -107,6 +107,12 @@ export class CompilerRequestHandler implements vscode.Disposable { sourceLevel: compilerSettings.get(SOURCE_COMPATIBILITY), targetLevel: compilerSettings.get(TARGET_COMPATIBILITY), }); + + sendInfo(operationId, { + operationName: "projectSettings.updateCompilerSettings", + // remove the common prefix to reduce the payload. + arg: JSON.stringify([...compilerSettings]).replace(/org\.eclipse\.jdt\.core\.compiler\./g, ""), + }); }); public dispose() { @@ -141,4 +147,4 @@ export class CompilerRequestHandler implements vscode.Disposable { return categories?.properties?.["java.configuration.runtimes"]; } } -} \ No newline at end of file +} diff --git a/src/project-settings/handlers/MavenRequestHandler.ts b/src/project-settings/handlers/MavenRequestHandler.ts index 89d1ed0c..13273b6a 100644 --- a/src/project-settings/handlers/MavenRequestHandler.ts +++ b/src/project-settings/handlers/MavenRequestHandler.ts @@ -26,7 +26,7 @@ export class MavenRequestHandler implements vscode.Disposable { })); } - private onWillGetSelectedProfiles = instrumentOperation("maven.onWillGetSelectedProfiles", async (_operationId: string, uri: any): Promise => { + private onWillGetSelectedProfiles = instrumentOperation("projectSettings.maven.onWillGetSelectedProfiles", async (_operationId: string, uri: any): Promise => { const response: any = await vscode.commands.executeCommand("java.execute.workspaceCommand", "java.project.getSettings", uri, [M2E_SELECTED_PROFILES]); const selectedProfiles: string = response?.[M2E_SELECTED_PROFILES]; @@ -39,7 +39,7 @@ export class MavenRequestHandler implements vscode.Disposable { } }); - private onWillUpdateSelectProfiles = instrumentOperation("maven.onWillUpdateSelectProfiles", async (_operationId: string, uri: any, selectedProfiles: string[]): Promise => { + private onWillUpdateSelectProfiles = instrumentOperation("projectSettings.maven.onWillUpdateSelectProfiles", async (_operationId: string, uri: any, selectedProfiles: string[]): Promise => { await vscode.commands.executeCommand("java.execute.workspaceCommand", "java.project.updateSettings", uri, { [M2E_SELECTED_PROFILES]: selectedProfiles }); }); @@ -47,4 +47,4 @@ export class MavenRequestHandler implements vscode.Disposable { public dispose() { this.disposables.forEach(d => d.dispose()); } -} \ No newline at end of file +}