Skip to content

Commit ef926e4

Browse files
authored
fix(amazonq): revert disable event handler #6191
## Problem Applying a fix does not update the position of other issues in the same file. ## Solution Revert disabling event handler on apply fix command
1 parent b60eba7 commit ef926e4

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Code Review: Fixed a bug where applying a fix did not update the positions of other issues in the same file."
4+
}

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

-1
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,6 @@ export const applySecurityFix = Commands.declare(
464464
new vscode.Range(document.lineAt(0).range.start, document.lineAt(document.lineCount - 1).range.end),
465465
updatedContent
466466
)
467-
SecurityIssueProvider.instance.disableEventHandler()
468467
const isApplied = await vscode.workspace.applyEdit(edit)
469468
if (isApplied) {
470469
void document.save().then((didSave) => {

packages/core/src/codewhisperer/service/securityIssueProvider.ts

-9
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export class SecurityIssueProvider {
1212
}
1313

1414
private _issues: AggregatedCodeScanIssue[] = []
15-
private _disableEventHandler: boolean = false
1615
public get issues() {
1716
return this._issues
1817
}
@@ -21,19 +20,11 @@ export class SecurityIssueProvider {
2120
this._issues = issues
2221
}
2322

24-
public disableEventHandler() {
25-
this._disableEventHandler = true
26-
}
27-
2823
public handleDocumentChange(event: vscode.TextDocumentChangeEvent) {
2924
// handleDocumentChange function may be triggered while testing by our own code generation.
3025
if (!event.contentChanges || event.contentChanges.length === 0) {
3126
return
3227
}
33-
if (this._disableEventHandler) {
34-
this._disableEventHandler = false
35-
return
36-
}
3728
const { changedRange, lineOffset } = event.contentChanges.reduce(
3829
(acc, change) => ({
3930
changedRange: acc.changedRange.union(change.range),

0 commit comments

Comments
 (0)