Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use built-in issue reporter to hopefully get higher quality issues #4437

Merged
merged 5 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
26 changes: 19 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,32 @@ 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> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VSCode automatically includes extension version, OS and version, and product name and version, so we don't need to

return `App Host: ${vscode.env.appHost}
Remote Name: ${vscode.env.remoteName}
Language: ${vscode.env.language}`;
}
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
Loading