Path: blob/main/extensions/copilot/src/extension/conversation/vscode-node/feedbackContribution.ts
13399 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/4import * as vscode from 'vscode';5import { IAuthenticationService } from '../../../platform/authentication/common/authentication';6import { LogMemory } from '../../../platform/log/common/logService';7import { Disposable } from '../../../util/vs/base/common/lifecycle';8import { EXTENSION_ID } from '../../common/constants';910export class FeedbackCommandContribution extends Disposable {11constructor(12@IAuthenticationService private readonly authenticationService: IAuthenticationService13) {14super();1516this._register(vscode.commands.registerCommand('github.copilot.report', async (title: string = '') => {17const token = this.authenticationService.copilotToken;18const isTeamMember = token?.isVscodeTeamMember;19const output: string[] = isTeamMember ? [`<details><summary>Prompt Details</summary>`] : [`<details><summary>Logs</summary>`];20appendPromptDetailsSection(output, LogMemory.getLogs().join('\n'), LogMemory.getRequestIds().join('\n'));21await vscode.commands.executeCommand('workbench.action.openIssueReporter', {22issueTitle: title,23extensionId: EXTENSION_ID,24uri: vscode.Uri.parse('https://github.com/microsoft/vscode'),25data: output.join('\n'),26privateUri: isTeamMember ? vscode.Uri.parse('https://github.com/microsoft/vscode-internalbacklog') : undefined,27});28}));29}30}3132function appendPromptDetailsSection(output: string[], logs: string, requestIds: string): void {33output.push(34`<pre>`,35logs,36`</pre>`,37`</details>`,38`<details><summary>Request IDs</summary>`,39`<pre>`,40requestIds,41`</pre>`,42`</details>`,43);44}454647