mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 12:04:04 +01:00
Joh/mysterious-octopus (#202079)
* debt - don't use extra buttons for accept/discard hunk * - inline chat history shouldn't loop - preserve the initial value and restore it fixes https://github.com/microsoft/vscode-copilot-release/issues/671
This commit is contained in:
@@ -303,6 +303,29 @@ export class NextFromHistory extends AbstractInlineChatAction {
|
||||
}
|
||||
}
|
||||
|
||||
export class DiscardHunkAction extends AbstractInlineChatAction {
|
||||
|
||||
constructor() {
|
||||
super({
|
||||
id: 'inlineChat.discardHunkChange',
|
||||
title: localize('discard', 'Discard'),
|
||||
icon: Codicon.clearAll,
|
||||
precondition: CTX_INLINE_CHAT_VISIBLE,
|
||||
menu: {
|
||||
id: MENU_INLINE_CHAT_WIDGET_STATUS,
|
||||
when: ContextKeyExpr.and(CTX_INLINE_CHAT_RESPONSE_TYPES.notEqualsTo(InlineChatResponseTypes.OnlyMessages), CTX_INLINE_CHAT_EDIT_MODE.isEqualTo(EditMode.Live)),
|
||||
group: '0_main',
|
||||
order: 3
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): Promise<void> {
|
||||
return ctrl.discardHunk();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MenuRegistry.appendMenuItem(MENU_INLINE_CHAT_WIDGET_STATUS, {
|
||||
submenu: MENU_INLINE_CHAT_WIDGET_DISCARD,
|
||||
title: localize('discardMenu', "Discard..."),
|
||||
@@ -510,7 +533,7 @@ export class AcceptChanges extends AbstractInlineChatAction {
|
||||
when: CTX_INLINE_CHAT_USER_DID_EDIT
|
||||
}],
|
||||
menu: {
|
||||
when: ContextKeyExpr.and(CTX_INLINE_CHAT_RESPONSE_TYPES.notEqualsTo(InlineChatResponseTypes.OnlyMessages), CTX_INLINE_CHAT_EDIT_MODE.notEqualsTo(EditMode.Live)),
|
||||
when: ContextKeyExpr.and(CTX_INLINE_CHAT_RESPONSE_TYPES.notEqualsTo(InlineChatResponseTypes.OnlyMessages)),
|
||||
id: MENU_INLINE_CHAT_WIDGET_STATUS,
|
||||
group: '0_main',
|
||||
order: 0
|
||||
@@ -519,7 +542,7 @@ export class AcceptChanges extends AbstractInlineChatAction {
|
||||
}
|
||||
|
||||
override async runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController): Promise<void> {
|
||||
ctrl.acceptSession();
|
||||
ctrl.acceptHunk();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,6 +572,7 @@ export class CancelSessionAction extends AbstractInlineChatAction {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class CloseAction extends AbstractInlineChatAction {
|
||||
|
||||
constructor() {
|
||||
|
||||
Reference in New Issue
Block a user