From e5b47b96e2c2dc1e425e345201a69c8aaadcf47e Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Fri, 4 Oct 2024 10:17:08 -0700 Subject: [PATCH] Fix error with `displayName` is missing in PackageJSON (#24246) Closes https://github.com/microsoft/vscode-python/issues/24244 --- .../common/application/commands/reportIssueCommand.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/client/common/application/commands/reportIssueCommand.ts b/src/client/common/application/commands/reportIssueCommand.ts index 2286bd1e6be2..f2b4f3ffc8c4 100644 --- a/src/client/common/application/commands/reportIssueCommand.ts +++ b/src/client/common/application/commands/reportIssueCommand.ts @@ -104,7 +104,12 @@ export class ReportIssueCommandHandler implements IExtensionSingleActivationServ const installedExtensions = getExtensions() .filter((extension) => !extension.id.startsWith('vscode.')) - .sort((a, b) => a.packageJSON.displayName.localeCompare(b.packageJSON.displayName)) + .sort((a, b) => { + if (a.packageJSON.displayName && b.packageJSON.displayName) { + return a.packageJSON.displayName.localeCompare(b.packageJSON.displayName); + } + return a.id.localeCompare(b.id); + }) .map( (extension) => `|${extension.packageJSON.displayName}|${extension.id}|${extension.packageJSON.version}|`,