From 3994917f53769c40b26f4f6e8a0d98e5dd6be28c Mon Sep 17 00:00:00 2001 From: "Brandon Waterloo [MSFT]" <36966225+bwateratmsft@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:37:08 -0500 Subject: [PATCH 1/5] Use built-in issue reporter to hopefully get higher quality issues --- package.json | 5 +++++ src/commands/help.ts | 32 ++++++++++++++++++++++++-------- src/commands/registerCommands.ts | 3 ++- src/extension.ts | 4 +--- 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 6cf0ecf248..d8605be4da 100644 --- a/package.json +++ b/package.json @@ -600,6 +600,11 @@ "when": "view == dockerContainers && viewItem == containerFile", "group": "inline@1" } + ], + "issue/reporter": [ + { + "command": "vscode-docker.help.reportIssue" + } ] }, "debuggers": [ diff --git a/src/commands/help.ts b/src/commands/help.ts index 0ac7fb0c0b..49050c316b 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -4,8 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import { IActionContext, IAzureQuickPickOptions } from '@microsoft/vscode-azext-utils'; +import * as os from 'os'; import * as vscode from 'vscode'; -import { extensionId } from '../constants'; +import { extensionId, extensionVersion } from '../constants'; interface HelpMenuItem extends vscode.QuickPickItem { handler(): Promise, @@ -16,7 +17,7 @@ export async function help(context: IActionContext): Promise { const items: HelpMenuItem[] = [ { label: vscode.l10n.t('Get started with Docker...'), handler: getStarted, telemetryID: 'getStarted' }, { label: vscode.l10n.t('Review Docker extension issues...'), handler: reviewIssues, telemetryID: 'reviewIssues' }, - { label: vscode.l10n.t('Report Docker extension issue...'), handler: reportIssue, telemetryID: 'reportIssue' }, + { label: vscode.l10n.t('Report Docker extension issue...'), handler: reportIssueFromHelpMenu, telemetryID: 'reportIssue' }, { label: vscode.l10n.t('Edit settings...'), handler: editSettings, telemetryID: 'editSettings' } ]; @@ -26,20 +27,35 @@ export async function help(context: IActionContext): Promise { await selectedItem.handler(); } +export async function reportIssue(context: IActionContext): Promise { + await vscode.commands.executeCommand('workbench.action.openIssueReporter', { + extensionId: extensionId, + issueBody: undefined, // Leaving repro steps undefined forces the user to type in *something*, which is hopefully helpful + data: await getIssueData(), + }); +} + async function getStarted(): Promise { - /* eslint-disable-next-line @typescript-eslint/no-floating-promises */ - vscode.env.openExternal(vscode.Uri.parse('https://code.visualstudio.com/docs/containers/overview')); + void vscode.env.openExternal(vscode.Uri.parse('https://code.visualstudio.com/docs/containers/overview')); } async function reviewIssues(): Promise { - /* eslint-disable-next-line @typescript-eslint/no-floating-promises */ - vscode.env.openExternal(vscode.Uri.parse('https://github.com/microsoft/vscode-docker/issues')); + void vscode.env.openExternal(vscode.Uri.parse('https://github.com/microsoft/vscode-docker/issues')); } -async function reportIssue(): Promise { - return vscode.commands.executeCommand('vscode.openIssueReporter', `${extensionId}`); +async function reportIssueFromHelpMenu(): Promise { + return vscode.commands.executeCommand('vscode-docker.help.reportIssue'); } async function editSettings(): Promise { return vscode.commands.executeCommand('workbench.action.openSettings', `@ext:${extensionId}`); } + +async function getIssueData(): Promise { + return `Version: ${extensionVersion.value} +OS: ${process.platform} +OS Release: ${os.release()} +Product: ${vscode.env.appName} +Product Version: ${vscode.version} +Language: ${vscode.env.language}`; +} diff --git a/src/commands/registerCommands.ts b/src/commands/registerCommands.ts index 179878de08..4cda226c99 100644 --- a/src/commands/registerCommands.ts +++ b/src/commands/registerCommands.ts @@ -30,7 +30,7 @@ import { configureDockerContextsExplorer, dockerContextsHelp } from "./context/D import { inspectDockerContext } from "./context/inspectDockerContext"; import { removeDockerContext } from "./context/removeDockerContext"; import { useDockerContext } from "./context/useDockerContext"; -import { help } from "./help"; +import { help, reportIssue } from "./help"; import { buildImage } from "./images/buildImage"; import { configureImagesExplorer } from "./images/configureImagesExplorer"; import { copyFullTag } from "./images/copyFullTag"; @@ -208,6 +208,7 @@ export function registerCommands(): void { registerCommand('vscode-docker.openDockerDownloadPage', openDockerDownloadPage); registerCommand('vscode-docker.help', help); registerCommand('vscode-docker.help.openWalkthrough', () => commands.executeCommand('workbench.action.openWalkthrough', 'ms-azuretools.vscode-docker#dockerStart')); + registerCommand('vscode-docker.help.reportIssue', reportIssue); registerCommand('vscode-docker.activateRegistryProviders', (context: IActionContext) => { // Do nothing, but registry provider extensions can use this command as an activation event diff --git a/src/extension.ts b/src/extension.ts index 3f814e2fdc..de0e461ed9 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { TelemetryEvent } from '@microsoft/compose-language-service/lib/client/TelemetryEvent'; -import { callWithTelemetryAndErrorHandling, createExperimentationService, IActionContext, registerErrorHandler, registerEvent, registerReportIssueCommand, registerUIExtensionVariables, UserCancelledError } from '@microsoft/vscode-azext-utils'; +import { callWithTelemetryAndErrorHandling, createExperimentationService, IActionContext, registerErrorHandler, registerEvent, registerUIExtensionVariables, UserCancelledError } from '@microsoft/vscode-azext-utils'; import * as path from 'path'; import * as vscode from 'vscode'; import { ConfigurationParams, DidChangeConfigurationNotification, DocumentSelector, LanguageClient, LanguageClientOptions, Middleware, ServerOptions, TransportKind } from 'vscode-languageclient/node'; @@ -78,9 +78,7 @@ export async function activateInternal(ctx: vscode.ExtensionContext, perfStats: // (new SurveyManager()).activate(); // Remove the "Report Issue" button from all error messages in favor of the command - // TODO: use built-in issue reporter if/when support is added to include arbitrary info in addition to repro steps (which we would leave blank to force the user to type *something*) registerErrorHandler(ctx => ctx.errorHandling.suppressReportIssue = true); - registerReportIssueCommand('vscode-docker.help.reportIssue'); // Set up Dockerfile completion provider ctx.subscriptions.push( From 09ca2ed17e49a4b7912229e8b05c243fa45899a3 Mon Sep 17 00:00:00 2001 From: "Brandon Waterloo [MSFT]" <36966225+bwateratmsft@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:43:28 -0500 Subject: [PATCH 2/5] Add super-useful app host field --- src/commands/help.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/commands/help.ts b/src/commands/help.ts index 49050c316b..c11f93292b 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -57,5 +57,6 @@ OS: ${process.platform} OS Release: ${os.release()} Product: ${vscode.env.appName} Product Version: ${vscode.version} +App Host: ${vscode.env.appHost} Language: ${vscode.env.language}`; } From 664c4019b42015a4132503f9dbd5d42d85a618f7 Mon Sep 17 00:00:00 2001 From: "Brandon Waterloo [MSFT]" <36966225+bwateratmsft@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:45:47 -0500 Subject: [PATCH 3/5] Another helpful field --- src/commands/help.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/commands/help.ts b/src/commands/help.ts index c11f93292b..903758ddd9 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -58,5 +58,6 @@ OS Release: ${os.release()} Product: ${vscode.env.appName} Product Version: ${vscode.version} App Host: ${vscode.env.appHost} +Remote Name: ${vscode.env.remoteName} Language: ${vscode.env.language}`; } From 17e76099b718fb12d8c21cf5f9f293ca10bb0d4a Mon Sep 17 00:00:00 2001 From: "Brandon Waterloo [MSFT]" <36966225+bwateratmsft@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:10:05 -0500 Subject: [PATCH 4/5] Removing duplicated issue data --- src/commands/help.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/commands/help.ts b/src/commands/help.ts index 903758ddd9..d2763e88c8 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -4,9 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import { IActionContext, IAzureQuickPickOptions } from '@microsoft/vscode-azext-utils'; -import * as os from 'os'; import * as vscode from 'vscode'; -import { extensionId, extensionVersion } from '../constants'; +import { extensionId } from '../constants'; interface HelpMenuItem extends vscode.QuickPickItem { handler(): Promise, @@ -52,12 +51,7 @@ async function editSettings(): Promise { } async function getIssueData(): Promise { - return `Version: ${extensionVersion.value} -OS: ${process.platform} -OS Release: ${os.release()} -Product: ${vscode.env.appName} -Product Version: ${vscode.version} -App Host: ${vscode.env.appHost} + return `App Host: ${vscode.env.appHost} Remote Name: ${vscode.env.remoteName} Language: ${vscode.env.language}`; } From 18cb1f31b8ee0f53e055511200c8e289523ce30f Mon Sep 17 00:00:00 2001 From: "Brandon Waterloo [MSFT]" <36966225+bwateratmsft@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:13:54 -0500 Subject: [PATCH 5/5] Newlines --- src/commands/help.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/commands/help.ts b/src/commands/help.ts index d2763e88c8..f101da5085 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -53,5 +53,7 @@ async function editSettings(): Promise { async function getIssueData(): Promise { return `App Host: ${vscode.env.appHost} Remote Name: ${vscode.env.remoteName} -Language: ${vscode.env.language}`; +Language: ${vscode.env.language} + +`; // Add a couple newlines after the data because VSCode doesn't }