mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
Fix undo/remove actions in unified view (#244068)
This commit is contained in:
@@ -91,7 +91,10 @@ export function registerNewChatActions() {
|
||||
},
|
||||
menu: [{
|
||||
id: MenuId.ChatContext,
|
||||
group: 'z_clear'
|
||||
group: 'z_clear',
|
||||
when: ContextKeyExpr.and(
|
||||
ChatContextKeys.location.isEqualTo(ChatAgentLocation.Panel),
|
||||
ChatContextKeys.inUnifiedChat.negate()),
|
||||
},
|
||||
{
|
||||
id: MenuId.ViewTitle,
|
||||
@@ -244,14 +247,14 @@ export function registerNewChatActions() {
|
||||
constructor() {
|
||||
super({
|
||||
id: 'workbench.action.chat.undoEdit',
|
||||
title: localize2('chat.undoEdit.label', "Undo Last Edit"),
|
||||
title: localize2('chat.undoEdit.label', "Undo Last Request"),
|
||||
category: CHAT_CATEGORY,
|
||||
icon: Codicon.discard,
|
||||
precondition: ContextKeyExpr.and(ChatContextKeys.chatEditingCanUndo, ChatContextKeys.enabled, ChatContextKeys.editingParticipantRegistered),
|
||||
f1: true,
|
||||
menu: [{
|
||||
id: MenuId.ViewTitle,
|
||||
when: ChatContextKeyExprs.inEditingMode,
|
||||
when: ChatContextKeyExprs.inEditsOrUnified,
|
||||
group: 'navigation',
|
||||
order: -3
|
||||
}]
|
||||
@@ -267,14 +270,14 @@ export function registerNewChatActions() {
|
||||
constructor() {
|
||||
super({
|
||||
id: 'workbench.action.chat.redoEdit',
|
||||
title: localize2('chat.redoEdit.label', "Redo Last Edit"),
|
||||
title: localize2('chat.redoEdit.label', "Redo Last Request"),
|
||||
category: CHAT_CATEGORY,
|
||||
icon: Codicon.redo,
|
||||
precondition: ContextKeyExpr.and(ChatContextKeys.chatEditingCanRedo, ChatContextKeys.enabled, ChatContextKeys.editingParticipantRegistered),
|
||||
f1: true,
|
||||
menu: [{
|
||||
id: MenuId.ViewTitle,
|
||||
when: ChatContextKeyExprs.inEditingMode,
|
||||
when: ChatContextKeyExprs.inEditsOrUnified,
|
||||
group: 'navigation',
|
||||
order: -2
|
||||
}]
|
||||
|
||||
@@ -358,7 +358,7 @@ export function registerChatTitleActions() {
|
||||
f1: false,
|
||||
category: CHAT_CATEGORY,
|
||||
icon: Codicon.x,
|
||||
precondition: ChatContextKeys.chatMode.isEqualTo(ChatMode.Ask),
|
||||
precondition: ContextKeyExpr.and(ChatContextKeys.chatMode.isEqualTo(ChatMode.Ask), ChatContextKeyExprs.unifiedChatEnabled.negate()),
|
||||
keybinding: {
|
||||
primary: KeyCode.Delete,
|
||||
mac: {
|
||||
@@ -371,7 +371,7 @@ export function registerChatTitleActions() {
|
||||
id: MenuId.ChatMessageTitle,
|
||||
group: 'navigation',
|
||||
order: 2,
|
||||
when: ContextKeyExpr.and(ChatContextKeys.chatMode.isEqualTo(ChatMode.Ask), ChatContextKeys.isRequest)
|
||||
when: ContextKeyExpr.and(ChatContextKeys.chatMode.isEqualTo(ChatMode.Ask), ChatContextKeys.isRequest, ChatContextKeyExprs.unifiedChatEnabled.negate())
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -439,7 +439,7 @@ registerAction2(class RemoveAction extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: 'workbench.action.chat.undoEdits',
|
||||
title: localize2('chat.undoEdits.label', "Undo Edits"),
|
||||
title: localize2('chat.undoEdits.label', "Undo Requests"),
|
||||
f1: false,
|
||||
category: CHAT_CATEGORY,
|
||||
icon: Codicon.x,
|
||||
@@ -448,7 +448,7 @@ registerAction2(class RemoveAction extends Action2 {
|
||||
mac: {
|
||||
primary: KeyMod.CtrlCmd | KeyCode.Backspace,
|
||||
},
|
||||
when: ContextKeyExpr.and(ChatContextKeys.chatMode.notEqualsTo(ChatMode.Ask), ChatContextKeys.inChatSession, EditorContextKeys.textInputFocus.negate()),
|
||||
when: ContextKeyExpr.and(ChatContextKeys.inChatSession, EditorContextKeys.textInputFocus.negate()),
|
||||
weight: KeybindingWeight.WorkbenchContrib,
|
||||
},
|
||||
menu: [
|
||||
@@ -456,7 +456,7 @@ registerAction2(class RemoveAction extends Action2 {
|
||||
id: MenuId.ChatMessageTitle,
|
||||
group: 'navigation',
|
||||
order: 2,
|
||||
when: ContextKeyExpr.and(ChatContextKeys.chatMode.notEqualsTo(ChatMode.Ask), ChatContextKeys.isRequest)
|
||||
when: ChatContextKeys.isRequest
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -479,7 +479,7 @@ registerAction2(class RemoveAction extends Action2 {
|
||||
const chatEditingService = accessor.get(IChatEditingService);
|
||||
const chatService = accessor.get(IChatService);
|
||||
const chatModel = chatService.getSession(item.sessionId);
|
||||
if (chatModel?.initialLocation !== ChatAgentLocation.EditingSession) {
|
||||
if (!chatModel) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user