Path: blob/main/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.ts
3296 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*--------------------------------------------------------------------------------------------*/45import { Codicon } from '../../../../../base/common/codicons.js';6import { ServicesAccessor } from '../../../../../editor/browser/editorExtensions.js';7import { localize2 } from '../../../../../nls.js';8import { Categories } from '../../../../../platform/action/common/actionCommonCategories.js';9import { Action2, registerAction2 } from '../../../../../platform/actions/common/actions.js';10import { ChatContextKeys } from '../../common/chatContextKeys.js';11import { IChatService } from '../../common/chatService.js';12import { IChatWidgetService } from '../chat.js';1314export function registerChatDeveloperActions() {15registerAction2(LogChatInputHistoryAction);16registerAction2(LogChatIndexAction);17}1819class LogChatInputHistoryAction extends Action2 {20static readonly ID = 'workbench.action.chat.logInputHistory';2122constructor() {23super({24id: LogChatInputHistoryAction.ID,25title: localize2('workbench.action.chat.logInputHistory.label', "Log Chat Input History"),26icon: Codicon.attach,27category: Categories.Developer,28f1: true,29precondition: ChatContextKeys.enabled30});31}3233override async run(accessor: ServicesAccessor, ...args: any[]): Promise<void> {34const chatWidgetService = accessor.get(IChatWidgetService);35chatWidgetService.lastFocusedWidget?.logInputHistory();36}37}3839class LogChatIndexAction extends Action2 {40static readonly ID = 'workbench.action.chat.logChatIndex';4142constructor() {43super({44id: LogChatIndexAction.ID,45title: localize2('workbench.action.chat.logChatIndex.label', "Log Chat Index"),46icon: Codicon.attach,47category: Categories.Developer,48f1: true,49precondition: ChatContextKeys.enabled50});51}5253override async run(accessor: ServicesAccessor, ...args: any[]): Promise<void> {54const chatService = accessor.get(IChatService);55chatService.logChatIndex();56}57}585960