mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-02 18:00:05 -05:00
chat - core provided chat submenus in components (#250851)
This commit is contained in:
@@ -1036,3 +1036,33 @@ export function shouldShowClearEditingSessionConfirmation(editingSession: IChatE
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// --- Chat Submenus in various Components
|
||||
|
||||
const menuContext = ContextKeyExpr.and(
|
||||
ChatContextKeys.Setup.hidden.negate(),
|
||||
ChatContextKeys.Setup.disabled.negate()
|
||||
);
|
||||
|
||||
const title = localize('copilot', "Copilot");
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.EditorContext, {
|
||||
submenu: MenuId.ChatTextEditorMenu,
|
||||
group: '1_copilot',
|
||||
title,
|
||||
when: menuContext
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
|
||||
submenu: MenuId.ChatExplorerMenu,
|
||||
group: '5_copilot',
|
||||
title,
|
||||
when: menuContext
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.TerminalInstanceContext, {
|
||||
submenu: MenuId.ChatTerminalMenu,
|
||||
group: '2_copilot',
|
||||
title,
|
||||
when: menuContext
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@ import { URI } from '../../../../base/common/uri.js';
|
||||
import { ServicesAccessor } from '../../../../editor/browser/editorExtensions.js';
|
||||
import { MarkdownRenderer } from '../../../../editor/browser/widget/markdownRenderer/browser/markdownRenderer.js';
|
||||
import { localize, localize2 } from '../../../../nls.js';
|
||||
import { Action2, MenuId, MenuRegistry, registerAction2 } from '../../../../platform/actions/common/actions.js';
|
||||
import { Action2, MenuId, registerAction2 } from '../../../../platform/actions/common/actions.js';
|
||||
import { ICommandService } from '../../../../platform/commands/common/commands.js';
|
||||
import { ConfigurationTarget, IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
|
||||
import { Extensions as ConfigurationExtensions, IConfigurationRegistry } from '../../../../platform/configuration/common/configurationRegistry.js';
|
||||
@@ -988,7 +988,6 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
|
||||
|
||||
this.registerSetupAgents(context, controller);
|
||||
this.registerActions(context, requests, controller);
|
||||
this.registerMenus();
|
||||
this.registerUrlLinkHandler();
|
||||
}
|
||||
|
||||
@@ -1294,38 +1293,6 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
|
||||
registerAction2(EnableOveragesAction);
|
||||
}
|
||||
|
||||
private registerMenus(): void {
|
||||
const menuContext = ContextKeyExpr.and(
|
||||
// TODO@bpasero this needs to be revisited when the Copilot
|
||||
// extension contributes this OOTB where this menu is also
|
||||
// defined.
|
||||
ChatContextKeys.Setup.installed.negate(),
|
||||
ChatContextKeys.Setup.hidden.negate(),
|
||||
ChatContextKeys.Setup.disabled.negate()
|
||||
);
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
|
||||
submenu: MenuId.ChatExplorerMenu,
|
||||
group: '5_copilot',
|
||||
title: localize('title4', "Copilot"),
|
||||
when: menuContext
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.EditorContext, {
|
||||
submenu: MenuId.ChatTextEditorMenu,
|
||||
group: '1_copilot',
|
||||
title: localize('title4', "Copilot"),
|
||||
when: menuContext
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.TerminalInstanceContext, {
|
||||
submenu: MenuId.ChatTerminalMenu,
|
||||
group: '2_copilot',
|
||||
title: localize('title4', "Copilot"),
|
||||
when: menuContext
|
||||
});
|
||||
}
|
||||
|
||||
private registerUrlLinkHandler(): void {
|
||||
this._register(ExtensionUrlHandlerOverrideRegistry.registerHandler({
|
||||
canHandleURL: url => {
|
||||
|
||||
@@ -450,6 +450,27 @@ const apiMenus: IAPIMenu[] = [
|
||||
description: localize('menus.chatModelPicker', "The chat model picker dropdown menu"),
|
||||
supportsSubmenus: false,
|
||||
proposed: 'chatParticipantPrivate'
|
||||
},
|
||||
{
|
||||
key: 'explorer/context/chat',
|
||||
id: MenuId.ChatExplorerMenu,
|
||||
description: localize('menus.chatExplorer', "The Chat submenu in the explorer context menu."),
|
||||
supportsSubmenus: false,
|
||||
proposed: 'chatParticipantPrivate'
|
||||
},
|
||||
{
|
||||
key: 'editor/context/chat',
|
||||
id: MenuId.ChatTextEditorMenu,
|
||||
description: localize('menus.chatTextEditor', "The Chat submenu in the text editor context menu."),
|
||||
supportsSubmenus: false,
|
||||
proposed: 'chatParticipantPrivate'
|
||||
},
|
||||
{
|
||||
key: 'terminal/context/chat',
|
||||
id: MenuId.ChatTerminalMenu,
|
||||
description: localize('menus.chatTerminal', "The Chat submenu in the terminal context menu."),
|
||||
supportsSubmenus: false,
|
||||
proposed: 'chatParticipantPrivate'
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user