Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.ts
3296 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
import { Codicon } from '../../../../../base/common/codicons.js';
7
import { ServicesAccessor } from '../../../../../editor/browser/editorExtensions.js';
8
import { localize2 } from '../../../../../nls.js';
9
import { Categories } from '../../../../../platform/action/common/actionCommonCategories.js';
10
import { Action2, registerAction2 } from '../../../../../platform/actions/common/actions.js';
11
import { ChatContextKeys } from '../../common/chatContextKeys.js';
12
import { IChatService } from '../../common/chatService.js';
13
import { IChatWidgetService } from '../chat.js';
14
15
export function registerChatDeveloperActions() {
16
registerAction2(LogChatInputHistoryAction);
17
registerAction2(LogChatIndexAction);
18
}
19
20
class LogChatInputHistoryAction extends Action2 {
21
static readonly ID = 'workbench.action.chat.logInputHistory';
22
23
constructor() {
24
super({
25
id: LogChatInputHistoryAction.ID,
26
title: localize2('workbench.action.chat.logInputHistory.label', "Log Chat Input History"),
27
icon: Codicon.attach,
28
category: Categories.Developer,
29
f1: true,
30
precondition: ChatContextKeys.enabled
31
});
32
}
33
34
override async run(accessor: ServicesAccessor, ...args: any[]): Promise<void> {
35
const chatWidgetService = accessor.get(IChatWidgetService);
36
chatWidgetService.lastFocusedWidget?.logInputHistory();
37
}
38
}
39
40
class LogChatIndexAction extends Action2 {
41
static readonly ID = 'workbench.action.chat.logChatIndex';
42
43
constructor() {
44
super({
45
id: LogChatIndexAction.ID,
46
title: localize2('workbench.action.chat.logChatIndex.label', "Log Chat Index"),
47
icon: Codicon.attach,
48
category: Categories.Developer,
49
f1: true,
50
precondition: ChatContextKeys.enabled
51
});
52
}
53
54
override async run(accessor: ServicesAccessor, ...args: any[]): Promise<void> {
55
const chatService = accessor.get(IChatService);
56
chatService.logChatIndex();
57
}
58
}
59
60