Skip to content

Commit 4ddd518

Browse files
authored
enable "Send & Dispatch" and "Send" for inline chat (microsoft#232983)
1 parent 4a35ffa commit 4ddd518

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

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

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ class SubmitWithoutDispatchingAction extends Action2 {
8585
precondition: ContextKeyExpr.and(
8686
ChatContextKeys.inputHasText,
8787
ChatContextKeys.requestInProgress.negate(),
88-
ContextKeyExpr.and(ChatContextKeys.___location.isEqualTo(ChatAgentLocation.Panel))),
88+
ContextKeyExpr.and(ContextKeyExpr.or(
89+
ChatContextKeys.___location.isEqualTo(ChatAgentLocation.Panel),
90+
ChatContextKeys.___location.isEqualTo(ChatAgentLocation.Editor),
91+
))),
8992
keybinding: {
9093
when: ChatContextKeys.inChatInput,
9194
primary: KeyMod.Alt | KeyMod.Shift | KeyCode.Enter,
@@ -140,7 +143,8 @@ export class ChatSubmitSecondaryAgentAction extends Action2 {
140143
menu: {
141144
id: MenuId.ChatExecuteSecondary,
142145
group: 'group_1',
143-
order: 3
146+
order: 3,
147+
when: ContextKeyExpr.equals(ChatContextKeys.___location.key, ChatAgentLocation.Panel)
144148
},
145149
keybinding: {
146150
when: ChatContextKeys.inChatInput,
@@ -185,12 +189,22 @@ class SendToChatEditingAction extends Action2 {
185189
id: MenuId.ChatExecuteSecondary,
186190
group: 'group_1',
187191
order: 4,
188-
when: ContextKeyExpr.and(ChatContextKeys.enabled, ChatContextKeys.editingParticipantRegistered, ChatContextKeys.___location.notEqualsTo(ChatAgentLocation.EditingSession))
192+
when: ContextKeyExpr.and(
193+
ChatContextKeys.enabled,
194+
ChatContextKeys.editingParticipantRegistered,
195+
ChatContextKeys.___location.notEqualsTo(ChatAgentLocation.EditingSession),
196+
ChatContextKeys.___location.notEqualsTo(ChatAgentLocation.Editor)
197+
)
189198
},
190199
keybinding: {
191200
weight: KeybindingWeight.WorkbenchContrib,
192201
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Enter,
193-
when: ContextKeyExpr.and(ChatContextKeys.enabled, ChatContextKeys.editingParticipantRegistered, ChatContextKeys.___location.notEqualsTo(ChatAgentLocation.EditingSession))
202+
when: ContextKeyExpr.and(
203+
ChatContextKeys.enabled,
204+
ChatContextKeys.editingParticipantRegistered,
205+
ChatContextKeys.___location.notEqualsTo(ChatAgentLocation.EditingSession),
206+
ChatContextKeys.___location.notEqualsTo(ChatAgentLocation.Editor),
207+
)
194208
}
195209
});
196210
}
@@ -258,7 +272,9 @@ class SendToNewChatAction extends Action2 {
258272
f1: false,
259273
menu: {
260274
id: MenuId.ChatExecuteSecondary,
261-
group: 'group_2'
275+
group: 'group_2',
276+
when: ContextKeyExpr.equals(ChatContextKeys.___location.key, ChatAgentLocation.Panel)
277+
262278
},
263279
keybinding: {
264280
weight: KeybindingWeight.WorkbenchContrib,

src/vs/workbench/contrib/chat/browser/chatInputPart.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
629629
hoverDelegate,
630630
hiddenItemStrategy: HiddenItemStrategy.Ignore, // keep it lean when hiding items and avoid a "..." overflow menu
631631
actionViewItemProvider: (action, options) => {
632-
if (this.___location === ChatAgentLocation.Panel) {
632+
if (this.___location === ChatAgentLocation.Panel || this.___location === ChatAgentLocation.Editor) {
633633
if ((action.id === SubmitAction.ID || action.id === CancelAction.ID) && action instanceof MenuItemAction) {
634634
const dropdownAction = this.instantiationService.createInstance(MenuItemAction, { id: 'chat.moreExecuteActions', title: localize('notebook.moreExecuteActionsLabel', "More..."), icon: Codicon.chevronDown }, undefined, undefined, undefined, undefined);
635635
return this.instantiationService.createInstance(ChatSubmitDropdownActionItem, action, dropdownAction, options);

0 commit comments

Comments
 (0)