From e1706d419f7c174b5e1dda42b9637f38bab0b8e3 Mon Sep 17 00:00:00 2001 From: "Brandon Waterloo [MSFT]" <36966225+bwateratmsft@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:57:38 -0500 Subject: [PATCH] Use built-in issue reporter to hopefully get higher quality issues (#4437) --- package.json | 5 +++++ src/commands/help.ts | 28 +++++++++++++++++++++------- src/commands/registerCommands.ts | 3 ++- src/extension.ts | 4 +--- 4 files changed, 29 insertions(+), 11 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..f101da5085 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -16,7 +16,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 +26,34 @@ 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 `App Host: ${vscode.env.appHost} +Remote Name: ${vscode.env.remoteName} +Language: ${vscode.env.language} + +`; // Add a couple newlines after the data because VSCode doesn't +} 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(