Skip to content

Commit

Permalink
Smart Apply: Show Reapply for applied code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
umpox committed Jan 31, 2025
1 parent 958ff1a commit 66ed00f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions vscode/webviews/chat/ChatMessageContent/create-buttons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
CopyCodeBlockIcon,
EllipsisIcon,
InsertCodeBlockIcon,
RefreshIcon,
SaveCodeBlockIcon,
SparkleIcon,
SyncSpinIcon,
Expand Down Expand Up @@ -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'

Expand Down
2 changes: 2 additions & 0 deletions vscode/webviews/icons/CodeBlockActionIcons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ export const CloseIcon =
'<svg role="img" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M8 8.707l3.646 3.647.708-.707L8.707 8l3.647-3.646-.707-.708L8 7.293 4.354 3.646l-.707.708L7.293 8l-3.646 3.646.707.708L8 8.707z"/></svg>'

export const TerminalIcon = '<i class="codicon codicon-terminal tw-align-middle"></i>'

export const RefreshIcon = '<i class="codicon codicon-refresh tw-align-middle"></i>'

0 comments on commit 66ed00f

Please sign in to comment.