From 66ed00f0647c52aababdebb9c456662ec1c29e84 Mon Sep 17 00:00:00 2001 From: Tom Ross Date: Fri, 31 Jan 2025 14:45:29 +0000 Subject: [PATCH] Smart Apply: Show Reapply for applied code blocks --- .../chat/ChatMessageContent/create-buttons.ts | 17 +++++++++++++++++ vscode/webviews/icons/CodeBlockActionIcons.tsx | 2 ++ 2 files changed, 19 insertions(+) diff --git a/vscode/webviews/chat/ChatMessageContent/create-buttons.ts b/vscode/webviews/chat/ChatMessageContent/create-buttons.ts index c651934becb2..97ea1e66e9ce 100644 --- a/vscode/webviews/chat/ChatMessageContent/create-buttons.ts +++ b/vscode/webviews/chat/ChatMessageContent/create-buttons.ts @@ -6,6 +6,7 @@ import { CopyCodeBlockIcon, EllipsisIcon, InsertCodeBlockIcon, + RefreshIcon, SaveCodeBlockIcon, SparkleIcon, SyncSpinIcon, @@ -286,6 +287,22 @@ function createApplyButton( break } + case 'Applied': + case 'Finished': { + button.innerHTML = 'Reapply' + + // Add Refresh Icon + const iconContainer = document.createElement('div') + iconContainer.className = styles.iconContainer + iconContainer.innerHTML = RefreshIcon + button.prepend(iconContainer) + + button.addEventListener('click', () => + smartApply.onSubmit(smartApplyId, preText, humanMessage?.text, fileName) + ) + + break + } default: { button.innerHTML = 'Apply' diff --git a/vscode/webviews/icons/CodeBlockActionIcons.tsx b/vscode/webviews/icons/CodeBlockActionIcons.tsx index 1a4fa5a04a26..bfe6475b4069 100644 --- a/vscode/webviews/icons/CodeBlockActionIcons.tsx +++ b/vscode/webviews/icons/CodeBlockActionIcons.tsx @@ -30,3 +30,5 @@ export const CloseIcon = '' export const TerminalIcon = '' + +export const RefreshIcon = ''