Skip to content

Commit 6ee1845

Browse files
committed
fix merge issue
1 parent e7208cb commit 6ee1845

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
@@ -18,7 +18,6 @@ export class EditDecorationManager {
1818
private currentRemovedCodeDecorations: vscode.DecorationOptions[] = []
1919
private acceptHandler: (() => void) | undefined
2020
private rejectHandler: (() => void) | undefined
21-
private disposables: vscode.Disposable[] = []
2221

2322
constructor() {
2423
this.imageDecorationType = vscode.window.createTextEditorDecorationType({
@@ -28,6 +27,8 @@ export class EditDecorationManager {
2827
this.removedCodeDecorationType = vscode.window.createTextEditorDecorationType({
2928
backgroundColor: 'rgba(255, 0, 0, 0.2)',
3029
})
30+
31+
this.registerCommandHandlers()
3132
}
3233

3334
/**
@@ -99,11 +100,9 @@ export class EditDecorationManager {
99100
onAccept: () => void,
100101
onReject: () => void,
101102
originalCode: string,
102-
newCode: string,
103-
removedHighlights?: vscode.DecorationOptions[]
103+
newCode: string
104104
): void {
105105
// Clear any existing decorations
106-
this.registerCommandHandlers()
107106
this.clearDecorations(editor)
108107

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

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

@@ -152,30 +146,24 @@ export class EditDecorationManager {
152146
*/
153147
public registerCommandHandlers(): void {
154148
// Register Tab key handler for accepting suggestion
155-
const acceptDisposable = vscode.commands.registerCommand('aws.amazonq.inline.acceptEdit', () => {
149+
vscode.commands.registerCommand('aws.amazonq.inline.acceptEdit', () => {
156150
if (this.acceptHandler) {
157151
this.acceptHandler()
158152
}
159153
})
160-
this.disposables.push(acceptDisposable)
161154

162155
// Register Esc key handler for rejecting suggestion
163-
const rejectDisposable = vscode.commands.registerCommand('aws.amazonq.inline.rejectEdit', () => {
156+
vscode.commands.registerCommand('aws.amazonq.inline.rejectEdit', () => {
164157
if (this.rejectHandler) {
165158
this.rejectHandler()
166159
}
167160
})
168-
this.disposables.push(rejectDisposable)
169161
}
170162

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

0 commit comments

Comments
 (0)