Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Feature",
"description": "/review: automatically generate fix without clicking Generate Fix button"
}
18 changes: 12 additions & 6 deletions packages/core/src/codewhisperer/commands/basicCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@ export const openSecurityIssuePanel = Commands.declare(
undefined,
!!targetIssue.suggestedFixes.length
)
if (targetIssue.suggestedFixes.length === 0) {
await generateFix.execute(targetIssue, targetFilePath, 'webview', true, false)
}
}
)

Expand Down Expand Up @@ -665,7 +668,8 @@ export const generateFix = Commands.declare(
issue: CodeScanIssue | IssueItem | undefined,
filePath: string,
source: Component,
refresh: boolean = false
refresh: boolean = false,
shouldOpenSecurityIssuePanel: boolean = true
) => {
const targetIssue: CodeScanIssue | undefined = issue instanceof IssueItem ? issue.issue : issue
const targetFilePath: string = issue instanceof IssueItem ? issue.filePath : filePath
Expand All @@ -679,11 +683,13 @@ export const generateFix = Commands.declare(
}
await telemetry.codewhisperer_codeScanIssueGenerateFix.run(async () => {
try {
await vscode.commands
.executeCommand('aws.amazonq.openSecurityIssuePanel', targetIssue, targetFilePath)
.then(undefined, (e) => {
getLogger().error('Failed to open security issue panel: %s', e.message)
})
if (shouldOpenSecurityIssuePanel) {
await vscode.commands
.executeCommand('aws.amazonq.openSecurityIssuePanel', targetIssue, targetFilePath)
.then(undefined, (e) => {
getLogger().error('Failed to open security issue panel: %s', e.message)
})
}
await updateSecurityIssueWebview({
isGenerateFixLoading: true,
// eslint-disable-next-line unicorn/no-null
Expand Down
Loading