Skip to content

Commit 13b43ab

Browse files
Copilothediet
authored andcommitted
Add "Accept All Edits" command accessible from editor context with Ctrl+Alt+Y (#251443)
1 parent ac9303f commit 13b43ab

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src/vs/editor/common/standaloneStrings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export namespace AccessibilityHelpNLS {
4242
export const debugExecuteSelection = nls.localize('debugConsole.executeSelection', "The Debug: Execute Selection command{0} will execute the selected text in the debug console.", '<keybinding:editor.debug.action.selectionToRepl>');
4343
export const chatEditorModification = nls.localize('chatEditorModification', "The editor contains pending modifications that have been made by chat.");
4444
export const chatEditorRequestInProgress = nls.localize('chatEditorRequestInProgress', "The editor is currently waiting for modifications to be made by chat.");
45-
export const chatEditActions = nls.localize('chatEditing.navigation', 'Navigate between edits in the editor with navigate previous{0} and next{1} and accept{2}, reject{3} or view the diff{4} for the current change.', '<keybinding:chatEditor.action.navigatePrevious>', '<keybinding:chatEditor.action.navigateNext>', '<keybinding:chatEditor.action.acceptHunk>', '<keybinding:chatEditor.action.undoHunk>', '<keybinding:chatEditor.action.toggleDiff>');
45+
export const chatEditActions = nls.localize('chatEditing.navigation', 'Navigate between edits in the editor with navigate previous{0} and next{1} and accept{2}, reject{3} or view the diff{4} for the current change. Accept edits across all files{5}.', '<keybinding:chatEditor.action.navigatePrevious>', '<keybinding:chatEditor.action.navigateNext>', '<keybinding:chatEditor.action.acceptHunk>', '<keybinding:chatEditor.action.undoHunk>', '<keybinding:chatEditor.action.toggleDiff>', '<keybinding:chatEditor.action.acceptAllEdits>');
4646
}
4747

4848
export namespace InspectTokensNLS {

src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,31 @@ export class ReviewChangesAction extends ChatEditingEditorAction {
343343
}
344344
}
345345

346+
export class AcceptAllEditsAction extends ChatEditingEditorAction {
347+
348+
static readonly ID = 'chatEditor.action.acceptAllEdits';
349+
350+
constructor() {
351+
super({
352+
id: AcceptAllEditsAction.ID,
353+
title: localize2('acceptAllEdits', 'Keep All Chat Edits'),
354+
tooltip: localize2('acceptAllEditsTooltip', 'Keep All Chat Edits in this Session'),
355+
precondition: ContextKeyExpr.and(ctxHasEditorModification, ctxHasRequestInProgress.negate()),
356+
icon: Codicon.checkAll,
357+
f1: true,
358+
keybinding: {
359+
when: ContextKeyExpr.or(EditorContextKeys.focus, NOTEBOOK_EDITOR_FOCUSED),
360+
weight: KeybindingWeight.WorkbenchContrib + 10,
361+
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyY,
362+
},
363+
});
364+
}
365+
366+
override async runChatEditingCommand(_accessor: ServicesAccessor, session: IChatEditingSession, _entry: IModifiedFileEntry, _integration: IModifiedFileEntryEditorIntegration, ..._args: any[]): Promise<void> {
367+
await session.accept();
368+
}
369+
}
370+
346371

347372
// --- multi file diff
348373

@@ -396,6 +421,7 @@ export function registerChatEditorActions() {
396421
registerAction2(ReviewChangesAction);
397422
registerAction2(AcceptAction);
398423
registerAction2(RejectAction);
424+
registerAction2(AcceptAllEditsAction);
399425
registerAction2(class AcceptHunkAction extends AcceptRejectHunkAction { constructor() { super(true); } });
400426
registerAction2(class RejectHunkAction extends AcceptRejectHunkAction { constructor() { super(false); } });
401427
registerAction2(ToggleDiffAction);

0 commit comments

Comments
 (0)