Skip to content

Commit 6aafc4d

Browse files
committed
fix merge issue
1 parent 1bd9157 commit 6aafc4d

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

packages/amazonq/src/app/inline/EditRendering/displayImage.ts

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export class EditDecorationManager {
1919
private currentRemovedCodeDecorations: vscode.DecorationOptions[] = []
2020
private acceptHandler: (() => void) | undefined
2121
private rejectHandler: (() => void) | undefined
22-
private disposables: vscode.Disposable[] = []
2322

2423
constructor() {
2524
this.imageDecorationType = vscode.window.createTextEditorDecorationType({
@@ -29,6 +28,8 @@ export class EditDecorationManager {
2928
this.removedCodeDecorationType = vscode.window.createTextEditorDecorationType({
3029
backgroundColor: 'rgba(255, 0, 0, 0.2)',
3130
})
31+
32+
this.registerCommandHandlers()
3233
}
3334

3435
/**
@@ -100,11 +101,9 @@ export class EditDecorationManager {
100101
onAccept: () => void,
101102
onReject: () => void,
102103
originalCode: string,
103-
newCode: string,
104-
removedHighlights?: vscode.DecorationOptions[]
104+
newCode: string
105105
): void {
106106
// Clear any existing decorations
107-
this.registerCommandHandlers()
108107
this.clearDecorations(editor)
109108

110109
// Set context to enable the Tab key handler
@@ -125,13 +124,8 @@ export class EditDecorationManager {
125124
// Apply image decoration
126125
editor.setDecorations(this.imageDecorationType, [this.currentImageDecoration])
127126

128-
// Highlight removed parts with red background - use provided highlights if available
129-
if (removedHighlights && removedHighlights.length > 0) {
130-
this.currentRemovedCodeDecorations = removedHighlights
131-
} else {
132-
// Fall back to line-level highlights if no char-level highlights provided
133-
this.currentRemovedCodeDecorations = this.highlightRemovedLines(editor, originalCode, newCode)
134-
}
127+
// Highlight removed lines with red background
128+
this.currentRemovedCodeDecorations = this.highlightRemovedLines(editor, originalCode, newCode)
135129
editor.setDecorations(this.removedCodeDecorationType, this.currentRemovedCodeDecorations)
136130
}
137131

@@ -153,30 +147,24 @@ export class EditDecorationManager {
153147
*/
154148
public registerCommandHandlers(): void {
155149
// Register Tab key handler for accepting suggestion
156-
const acceptDisposable = vscode.commands.registerCommand('aws.amazonq.inline.acceptEdit', () => {
150+
vscode.commands.registerCommand('aws.amazonq.inline.acceptEdit', () => {
157151
if (this.acceptHandler) {
158152
this.acceptHandler()
159153
}
160154
})
161-
this.disposables.push(acceptDisposable)
162155

163156
// Register Esc key handler for rejecting suggestion
164-
const rejectDisposable = vscode.commands.registerCommand('aws.amazonq.inline.rejectEdit', () => {
157+
vscode.commands.registerCommand('aws.amazonq.inline.rejectEdit', () => {
165158
if (this.rejectHandler) {
166159
this.rejectHandler()
167160
}
168161
})
169-
this.disposables.push(rejectDisposable)
170162
}
171163

172164
/**
173165
* Disposes resources
174166
*/
175167
public dispose(): void {
176-
for (const disposable of this.disposables) {
177-
disposable.dispose()
178-
}
179-
this.disposables = []
180168
this.imageDecorationType.dispose()
181169
this.removedCodeDecorationType.dispose()
182170
}

0 commit comments

Comments
 (0)