|
6 | 6 | import { CancellationToken } from '../../../../../base/common/cancellation.js'; |
7 | 7 | import { Codicon } from '../../../../../base/common/codicons.js'; |
8 | 8 | import { KeyCode, KeyMod } from '../../../../../base/common/keyCodes.js'; |
9 | | -import { alert } from '../../../../../base/browser/ui/aria/aria.js'; |
10 | 9 | import { basename } from '../../../../../base/common/resources.js'; |
11 | 10 | import { URI, UriComponents } from '../../../../../base/common/uri.js'; |
12 | 11 | import { isCodeEditor } from '../../../../../editor/browser/editorBrowser.js'; |
@@ -599,63 +598,6 @@ registerAction2(class RestoreCheckpointAction extends Action2 { |
599 | 598 | } |
600 | 599 | }); |
601 | 600 |
|
602 | | -registerAction2(class RestoreLastCheckpoint extends Action2 { |
603 | | - constructor() { |
604 | | - super({ |
605 | | - id: 'workbench.action.chat.restoreLastCheckpoint', |
606 | | - title: localize2('chat.restoreLastCheckpoint.label', "Restore to Last Checkpoint"), |
607 | | - f1: true, |
608 | | - category: CHAT_CATEGORY, |
609 | | - icon: Codicon.discard, |
610 | | - precondition: ContextKeyExpr.and( |
611 | | - ChatContextKeys.inChatSession, |
612 | | - ContextKeyExpr.equals(`config.${ChatConfiguration.CheckpointsEnabled}`, true), |
613 | | - ChatContextKeys.lockedToCodingAgent.negate() |
614 | | - ), |
615 | | - menu: [ |
616 | | - { |
617 | | - id: MenuId.ChatMessageFooter, |
618 | | - group: 'navigation', |
619 | | - order: 1, |
620 | | - when: ContextKeyExpr.and(ContextKeyExpr.in(ChatContextKeys.itemId.key, ChatContextKeys.lastItemId.key), ContextKeyExpr.equals(`config.${ChatConfiguration.CheckpointsEnabled}`, true), ChatContextKeys.lockedToCodingAgent.negate()), |
621 | | - } |
622 | | - ] |
623 | | - }); |
624 | | - } |
625 | | - |
626 | | - async run(accessor: ServicesAccessor, ...args: unknown[]) { |
627 | | - let item = args[0] as ChatTreeItem | undefined; |
628 | | - const chatWidgetService = accessor.get(IChatWidgetService); |
629 | | - const chatService = accessor.get(IChatService); |
630 | | - const widget = (isChatTreeItem(item) && chatWidgetService.getWidgetBySessionResource(item.sessionResource)) || chatWidgetService.lastFocusedWidget; |
631 | | - if (!isResponseVM(item) && !isRequestVM(item)) { |
632 | | - item = widget?.getFocus(); |
633 | | - } |
634 | | - |
635 | | - const sessionResource = widget?.viewModel?.sessionResource ?? (isChatTreeItem(item) ? item.sessionResource : undefined); |
636 | | - if (!sessionResource) { |
637 | | - return; |
638 | | - } |
639 | | - |
640 | | - const chatModel = chatService.getSession(sessionResource); |
641 | | - if (!chatModel?.editingSession) { |
642 | | - return; |
643 | | - } |
644 | | - |
645 | | - const checkpointRequest = chatModel.checkpoint; |
646 | | - if (!checkpointRequest) { |
647 | | - alert(localize('chat.restoreCheckpoint.none', 'There is no checkpoint to restore.')); |
648 | | - return; |
649 | | - } |
650 | | - |
651 | | - widget?.viewModel?.model.setCheckpoint(checkpointRequest.id); |
652 | | - widget?.focusInput(); |
653 | | - widget?.input.setValue(checkpointRequest.message.text, false); |
654 | | - |
655 | | - await restoreSnapshotWithConfirmationByRequestId(accessor, sessionResource, checkpointRequest.id); |
656 | | - } |
657 | | -}); |
658 | | - |
659 | 601 | registerAction2(class EditAction extends Action2 { |
660 | 602 | constructor() { |
661 | 603 | super({ |
|
0 commit comments