Path: blob/main/extensions/copilot/src/extension/search/vscode-node/commands.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*--------------------------------------------------------------------------------------------*/456import * as vscode from 'vscode';7import { ITelemetryService } from '../../../platform/telemetry/common/telemetry';8import { Disposable } from '../../../util/vs/base/common/lifecycle';9import { IFeedbackReporter } from '../../prompt/node/feedbackReporter';10import { SearchFeedbackKind, SemanticSearchTextSearchProvider } from '../../workspaceSemanticSearch/node/semanticSearchTextSearchProvider';1112export class SearchPanelCommands extends Disposable {13constructor(14@ITelemetryService telemetryService: ITelemetryService,15@IFeedbackReporter private readonly feedbackReporter: IFeedbackReporter,16) {17super();18this._register(vscode.commands.registerCommand('github.copilot.search.markHelpful', () => {19this.sendFeedback(SearchFeedbackKind.Helpful);20}));21this._register(vscode.commands.registerCommand('github.copilot.search.markUnhelpful', () => {22this.sendFeedback(SearchFeedbackKind.Unhelpful);23}));24this._register(vscode.commands.registerCommand('github.copilot.search.feedback', () => {25this.sendFeedback(SearchFeedbackKind.Feedback);26vscode.commands.executeCommand('github.copilot.report', `Copilot search feedback: "${SemanticSearchTextSearchProvider.latestQuery}"`);27}));28}2930private sendFeedback(kind: SearchFeedbackKind) {31this.feedbackReporter.reportSearch(kind);32vscode.commands.executeCommand('setContext', SemanticSearchTextSearchProvider.feedBackSentKey, true);33}34}353637