diff --git a/packages/amazonq/.changes/next-release/Bug Fix-64bec56a-f152-4345-b036-0c5ddb0ce5a2.json b/packages/amazonq/.changes/next-release/Bug Fix-64bec56a-f152-4345-b036-0c5ddb0ce5a2.json new file mode 100644 index 00000000000..b4e3e303a62 --- /dev/null +++ b/packages/amazonq/.changes/next-release/Bug Fix-64bec56a-f152-4345-b036-0c5ddb0ce5a2.json @@ -0,0 +1,4 @@ +{ + "type": "Bug Fix", + "description": "Code Review: Fixed a bug where applying a fix did not update the positions of other issues in the same file." +} diff --git a/packages/core/src/codewhisperer/commands/basicCommands.ts b/packages/core/src/codewhisperer/commands/basicCommands.ts index 8f428419853..4f0731acf9e 100644 --- a/packages/core/src/codewhisperer/commands/basicCommands.ts +++ b/packages/core/src/codewhisperer/commands/basicCommands.ts @@ -464,7 +464,6 @@ export const applySecurityFix = Commands.declare( new vscode.Range(document.lineAt(0).range.start, document.lineAt(document.lineCount - 1).range.end), updatedContent ) - SecurityIssueProvider.instance.disableEventHandler() const isApplied = await vscode.workspace.applyEdit(edit) if (isApplied) { void document.save().then((didSave) => { diff --git a/packages/core/src/codewhisperer/service/securityIssueProvider.ts b/packages/core/src/codewhisperer/service/securityIssueProvider.ts index fa60c7c215a..28b84995aea 100644 --- a/packages/core/src/codewhisperer/service/securityIssueProvider.ts +++ b/packages/core/src/codewhisperer/service/securityIssueProvider.ts @@ -12,7 +12,6 @@ export class SecurityIssueProvider { } private _issues: AggregatedCodeScanIssue[] = [] - private _disableEventHandler: boolean = false public get issues() { return this._issues } @@ -21,19 +20,11 @@ export class SecurityIssueProvider { this._issues = issues } - public disableEventHandler() { - this._disableEventHandler = true - } - public handleDocumentChange(event: vscode.TextDocumentChangeEvent) { // handleDocumentChange function may be triggered while testing by our own code generation. if (!event.contentChanges || event.contentChanges.length === 0) { return } - if (this._disableEventHandler) { - this._disableEventHandler = false - return - } const { changedRange, lineOffset } = event.contentChanges.reduce( (acc, change) => ({ changedRange: acc.changedRange.union(change.range),