Skip to content

Commit

Permalink
Use built-in issue reporter to hopefully get higher quality issues (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bwateratmsft authored Dec 20, 2024
1 parent 4799004 commit e1706d4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 11 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,11 @@
"when": "view == dockerContainers && viewItem == containerFile",
"group": "inline@1"
}
],
"issue/reporter": [
{
"command": "vscode-docker.help.reportIssue"
}
]
},
"debuggers": [
Expand Down
28 changes: 21 additions & 7 deletions src/commands/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export async function help(context: IActionContext): Promise<void> {
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' }
];

Expand All @@ -26,20 +26,34 @@ export async function help(context: IActionContext): Promise<void> {
await selectedItem.handler();
}

export async function reportIssue(context: IActionContext): Promise<void> {
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<void> {
/* 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<void> {
/* 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<void> {
return vscode.commands.executeCommand('vscode.openIssueReporter', `${extensionId}`);
async function reportIssueFromHelpMenu(): Promise<void> {
return vscode.commands.executeCommand('vscode-docker.help.reportIssue');
}

async function editSettings(): Promise<void> {
return vscode.commands.executeCommand('workbench.action.openSettings', `@ext:${extensionId}`);
}

async function getIssueData(): Promise<string> {
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
}
3 changes: 2 additions & 1 deletion src/commands/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit e1706d4

Please sign in to comment.