Skip to content

Commit 7ca850c

Browse files
authored
Use one "New Chat" command for view and editor toolbars (#260686)
Fix #248901
1 parent ccac346 commit 7ca850c

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

src/vs/workbench/contrib/chat/browser/actions/chatClearActions.ts

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export interface INewEditSessionActionContext {
4242
}
4343

4444
export function registerNewChatActions() {
45+
// This action was previously used for the editor gutter toolbar, but now ACTION_ID_NEW_CHAT is also used for that scenario
4546
registerAction2(class NewChatEditorAction extends Action2 {
4647
constructor() {
4748
super({
@@ -50,12 +51,6 @@ export function registerNewChatActions() {
5051
icon: Codicon.plus,
5152
f1: false,
5253
precondition: ChatContextKeys.enabled,
53-
menu: [MenuId.EditorTitle, MenuId.CompactWindowEditorTitle].map(id => ({
54-
id,
55-
group: 'navigation',
56-
when: ActiveEditorContext.isEqualTo(ChatEditorInput.EditorID),
57-
order: 1
58-
}))
5954
});
6055
}
6156
async run(accessor: ServicesAccessor, ...args: any[]) {
@@ -73,16 +68,24 @@ export function registerNewChatActions() {
7368
icon: Codicon.plus,
7469
precondition: ContextKeyExpr.and(ChatContextKeys.enabled),
7570
f1: true,
76-
menu: [{
77-
id: MenuId.ChatContext,
78-
group: 'z_clear'
79-
},
80-
{
81-
id: MenuId.ViewTitle,
82-
when: ContextKeyExpr.equals('view', ChatViewId),
83-
group: 'navigation',
84-
order: -1
85-
}],
71+
menu: [
72+
{
73+
id: MenuId.ChatContext,
74+
group: 'z_clear'
75+
},
76+
{
77+
id: MenuId.ViewTitle,
78+
when: ContextKeyExpr.equals('view', ChatViewId),
79+
group: 'navigation',
80+
order: -1
81+
},
82+
...[MenuId.EditorTitle, MenuId.CompactWindowEditorTitle].map(id => ({
83+
id,
84+
group: 'navigation',
85+
when: ActiveEditorContext.isEqualTo(ChatEditorInput.EditorID),
86+
order: 1
87+
}))
88+
],
8689
keybinding: {
8790
weight: KeybindingWeight.WorkbenchContrib + 1,
8891
primary: KeyMod.CtrlCmd | KeyCode.KeyN,

0 commit comments

Comments
 (0)