Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { IInstantiationService } from '../../../../../platform/instantiation/com
import { ActiveEditorContext } from '../../../../common/contextkeys.js';
import { EditorResourceAccessor, SideBySideEditor, TEXT_DIFF_EDITOR_ID } from '../../../../common/editor.js';
import { ChatContextKeys } from '../../common/chatContextKeys.js';
import { NOTEBOOK_CELL_LIST_FOCUSED } from '../../../notebook/common/notebookContextKeys.js';
import { NOTEBOOK_CELL_LIST_FOCUSED, NOTEBOOK_EDITOR_FOCUSED } from '../../../notebook/common/notebookContextKeys.js';


abstract class ChatEditingEditorAction extends Action2 {
Expand Down Expand Up @@ -176,16 +176,11 @@ abstract class KeepOrUndoAction extends ChatEditingEditorAction {
: Codicon.discard,
f1: true,
keybinding: {
when: EditorContextKeys.focus,
weight: KeybindingWeight.WorkbenchContrib,
when: ContextKeyExpr.or(EditorContextKeys.focus, NOTEBOOK_EDITOR_FOCUSED),
weight: KeybindingWeight.WorkbenchContrib + 10, // win over new-window-action
primary: _keep
? KeyMod.CtrlCmd | KeyCode.Enter
: KeyMod.CtrlCmd | KeyCode.Backspace,
win: {
primary: _keep
? KeyMod.Alt | KeyCode.Enter
: KeyMod.Alt | KeyCode.Backspace
},
? KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyY
: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyN,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hate being that guy - but I accidentally rejected edits today trying to open a new window. 😅

},
menu: {
id: MenuId.ChatEditingEditorContent,
Expand Down Expand Up @@ -245,13 +240,8 @@ abstract class AcceptRejectHunkAction extends ChatEditingEditorAction {
when: ContextKeyExpr.or(EditorContextKeys.focus, NOTEBOOK_CELL_LIST_FOCUSED),
weight: KeybindingWeight.WorkbenchContrib + 1,
primary: _accept
? KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Enter
: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Backspace,
win: {
primary: _accept
? KeyMod.Alt | KeyMod.Shift | KeyCode.Enter
: KeyMod.Alt | KeyMod.Shift | KeyCode.Backspace,
}
? KeyMod.CtrlCmd | KeyCode.KeyY
: KeyMod.CtrlCmd | KeyCode.KeyN
},
menu: {
id: MenuId.ChatEditingEditorHunk,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { renderIcon } from '../../../../../base/browser/ui/iconLabel/iconLabels.
import { ThemeIcon } from '../../../../../base/common/themables.js';
import * as arrays from '../../../../../base/common/arrays.js';
import { renderStringAsPlaintext } from '../../../../../base/browser/markdownRenderer.js';
import { IKeybindingService } from '../../../../../platform/keybinding/common/keybinding.js';

class ChatEditorOverlayWidget extends Disposable {

Expand All @@ -49,6 +50,7 @@ class ChatEditorOverlayWidget extends Disposable {
constructor(
private readonly _editor: { focus(): void },
@IChatService private readonly _chatService: IChatService,
@IKeybindingService private readonly _keybindingService: IKeybindingService,
@IInstantiationService private readonly _instaService: IInstantiationService,
) {
super();
Expand Down Expand Up @@ -272,9 +274,22 @@ class ChatEditorOverlayWidget extends Disposable {
that._editor.focus();
});
}

override get actionRunner(): IActionRunner {
return super.actionRunner;
}

protected override getTooltip(): string | undefined {
const value = super.getTooltip();
if (!value) {
return value;
}
const kb = that._keybindingService.lookupKeybinding(this.action.id);
if (!kb) {
return value;
}
return localize('tooltip', "{0} ({1})", value, kb.getLabel());
}
};
}

Expand Down
Loading