Skip to content

Commit 7eb2a6c

Browse files
committed
/review: automatically generate fix without clicking Generate Fix button
1 parent 1647786 commit 7eb2a6c

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "/review: automatically generate fix without clicking Generate Fix button"
4+
}

packages/core/src/codewhisperer/commands/basicCommands.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ export const openSecurityIssuePanel = Commands.declare(
372372
undefined,
373373
!!targetIssue.suggestedFixes.length
374374
)
375+
await generateFix.execute(targetIssue, targetFilePath, 'webview', true, false)
375376
}
376377
)
377378

@@ -665,7 +666,8 @@ export const generateFix = Commands.declare(
665666
issue: CodeScanIssue | IssueItem | undefined,
666667
filePath: string,
667668
source: Component,
668-
refresh: boolean = false
669+
refresh: boolean = false,
670+
shouldOpenSecurityIssuePanel: boolean = true
669671
) => {
670672
const targetIssue: CodeScanIssue | undefined = issue instanceof IssueItem ? issue.issue : issue
671673
const targetFilePath: string = issue instanceof IssueItem ? issue.filePath : filePath
@@ -679,11 +681,13 @@ export const generateFix = Commands.declare(
679681
}
680682
await telemetry.codewhisperer_codeScanIssueGenerateFix.run(async () => {
681683
try {
682-
await vscode.commands
683-
.executeCommand('aws.amazonq.openSecurityIssuePanel', targetIssue, targetFilePath)
684-
.then(undefined, (e) => {
685-
getLogger().error('Failed to open security issue panel: %s', e.message)
686-
})
684+
if (shouldOpenSecurityIssuePanel) {
685+
await vscode.commands
686+
.executeCommand('aws.amazonq.openSecurityIssuePanel', targetIssue, targetFilePath)
687+
.then(undefined, (e) => {
688+
getLogger().error('Failed to open security issue panel: %s', e.message)
689+
})
690+
}
687691
await updateSecurityIssueWebview({
688692
isGenerateFixLoading: true,
689693
// eslint-disable-next-line unicorn/no-null
@@ -739,7 +743,7 @@ export const generateFix = Commands.declare(
739743
isGenerateFixLoading: false,
740744
filePath: targetFilePath,
741745
context: context.extensionContext,
742-
shouldRefreshView: true,
746+
shouldRefreshView: false,
743747
})
744748

745749
SecurityIssueProvider.instance.updateIssue(updatedIssue, targetFilePath)

packages/core/src/shared/settings-amazonq.gen.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ export const amazonqSettings = {
1818
"amazonQWelcomePage": {},
1919
"amazonQSessionConfigurationMessage": {},
2020
"minIdeVersion": {},
21-
"ssoCacheError": {},
22-
"AmazonQLspManifestMessage": {},
23-
"AmazonQ-WorkspaceLspManifestMessage":{}
21+
"ssoCacheError": {}
2422
},
2523
"amazonQ.showCodeWithReferences": {},
2624
"amazonQ.allowFeatureDevelopmentToRunCodeAndTests": {},

0 commit comments

Comments
 (0)