Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/extension/search/vscode-node/commands.ts
13399 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
7
import * as vscode from 'vscode';
8
import { ITelemetryService } from '../../../platform/telemetry/common/telemetry';
9
import { Disposable } from '../../../util/vs/base/common/lifecycle';
10
import { IFeedbackReporter } from '../../prompt/node/feedbackReporter';
11
import { SearchFeedbackKind, SemanticSearchTextSearchProvider } from '../../workspaceSemanticSearch/node/semanticSearchTextSearchProvider';
12
13
export class SearchPanelCommands extends Disposable {
14
constructor(
15
@ITelemetryService telemetryService: ITelemetryService,
16
@IFeedbackReporter private readonly feedbackReporter: IFeedbackReporter,
17
) {
18
super();
19
this._register(vscode.commands.registerCommand('github.copilot.search.markHelpful', () => {
20
this.sendFeedback(SearchFeedbackKind.Helpful);
21
}));
22
this._register(vscode.commands.registerCommand('github.copilot.search.markUnhelpful', () => {
23
this.sendFeedback(SearchFeedbackKind.Unhelpful);
24
}));
25
this._register(vscode.commands.registerCommand('github.copilot.search.feedback', () => {
26
this.sendFeedback(SearchFeedbackKind.Feedback);
27
vscode.commands.executeCommand('github.copilot.report', `Copilot search feedback: "${SemanticSearchTextSearchProvider.latestQuery}"`);
28
}));
29
}
30
31
private sendFeedback(kind: SearchFeedbackKind) {
32
this.feedbackReporter.reportSearch(kind);
33
vscode.commands.executeCommand('setContext', SemanticSearchTextSearchProvider.feedBackSentKey, true);
34
}
35
}
36
37