Skip to content
This repository was archived by the owner on Aug 1, 2025. It is now read-only.

Commit 646ae0f

Browse files
authored
change(smart-apply): allow apply for shell languages not just execute action (#8168)
Fixes CODY-6175 The `isShellCommand` prop was originally used to prevent smart apply from being applied to shell commands. However, this distinction is no longer necessary. ## Test plan - Ask for a change for a .sh file - See that you can now apply changes instead of getting only the execute button - Check that smart apply works on these .bash or .sh files.
1 parent c1d56cd commit 646ae0f

4 files changed

Lines changed: 3 additions & 10 deletions

File tree

vscode/webviews/chat/ChatMessageContent/EditButtons.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,7 @@ function createEditButtonsSmartApply({
186186
{smartApplyState !== CodyTaskState.Applied && (
187187
<>
188188
{onExecute && isVSCode && createExecuteButton(onExecute)}
189-
{!onExecute &&
190-
smartApply &&
191-
onSmartApply &&
192-
createApplyButton(onSmartApply, smartApplyState)}
189+
{smartApply && onSmartApply && createApplyButton(onSmartApply, smartApplyState)}
193190
</>
194191
)}
195192
{isVSCode && createActionsDropdown(preText)}

vscode/webviews/components/RichCodeBlock.story.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ export const ShellCommand: StoryObj<typeof meta> = {
149149
plainCode: 'echo "Hello, World!"',
150150
markdownCode: '```bash\necho "Hello, World!"\n```',
151151
language: 'bash',
152-
isShellCommand: true,
153152
onExecute: cmd => console.log('Execute command:', cmd),
154153
},
155154
}

vscode/webviews/components/RichCodeBlock.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ interface RichCodeBlockProps {
2121
fileName?: string
2222
isMessageLoading: boolean // Whether the whole message is done loading
2323
isCodeComplete: boolean // Whether this code block has been completed
24-
isShellCommand: boolean
2524
guardrails: Guardrails
2625
onCopy?: (code: string) => void
2726
onInsert?: (code: string, newFile?: boolean) => void
@@ -51,7 +50,6 @@ export const RichCodeBlock: React.FC<RichCodeBlockProps> = ({
5150
fileName,
5251
isMessageLoading,
5352
isCodeComplete,
54-
isShellCommand,
5553
guardrails,
5654
onCopy,
5755
onInsert,
@@ -68,8 +66,8 @@ export const RichCodeBlock: React.FC<RichCodeBlockProps> = ({
6866
// Smart apply is only applicable if the code is complete. These properties
6967
// will be stable (undefined) until the code is complete, skipping any
7068
// updates caused by incomplete code as it is streamed.
71-
const smartApplyCode = smartApply && isCodeComplete && !isShellCommand ? plainCode : undefined
72-
const smartApplyFilename = smartApply && isCodeComplete && !isShellCommand ? fileName : undefined
69+
const smartApplyCode = smartApply && isCodeComplete ? plainCode : undefined
70+
const smartApplyFilename = smartApply && isCodeComplete ? fileName : undefined
7371
const thisTaskId = useMemo(() => {
7472
if (!smartApplyCode) {
7573
return undefined

vscode/webviews/components/RichMarkdown.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ export const RichMarkdown: React.FC<RichMarkdownProps> = ({
139139
fileName={filePath}
140140
isMessageLoading={isMessageLoading}
141141
isCodeComplete={!regenerating && (isThisBlockComplete || !isMessageLoading)}
142-
isShellCommand={isShellCommand}
143142
guardrails={guardrails}
144143
onCopy={onCopy}
145144
onInsert={onInsert}

0 commit comments

Comments
 (0)