@@ -20,7 +20,6 @@ export class EditDecorationManager {
20
20
private currentRemovedCodeDecorations : vscode . DecorationOptions [ ] = [ ]
21
21
private acceptHandler : ( ( ) => void ) | undefined
22
22
private rejectHandler : ( ( ) => void ) | undefined
23
- private disposables : vscode . Disposable [ ] = [ ]
24
23
25
24
constructor ( ) {
26
25
this . imageDecorationType = vscode . window . createTextEditorDecorationType ( {
@@ -30,6 +29,8 @@ export class EditDecorationManager {
30
29
this . removedCodeDecorationType = vscode . window . createTextEditorDecorationType ( {
31
30
backgroundColor : 'rgba(255, 0, 0, 0.2)' ,
32
31
} )
32
+
33
+ this . registerCommandHandlers ( )
33
34
}
34
35
35
36
/**
@@ -136,7 +137,6 @@ export class EditDecorationManager {
136
137
originalCodeHighlightRanges : Array < { line : number ; start : number ; end : number } >
137
138
) : void {
138
139
// Clear any existing decorations
139
- this . registerCommandHandlers ( )
140
140
this . clearDecorations ( editor )
141
141
142
142
// Set context to enable the Tab key handler
@@ -180,30 +180,24 @@ export class EditDecorationManager {
180
180
*/
181
181
public registerCommandHandlers ( ) : void {
182
182
// Register Tab key handler for accepting suggestion
183
- const acceptDisposable = vscode . commands . registerCommand ( 'aws.amazonq.inline.acceptEdit' , ( ) => {
183
+ vscode . commands . registerCommand ( 'aws.amazonq.inline.acceptEdit' , ( ) => {
184
184
if ( this . acceptHandler ) {
185
185
this . acceptHandler ( )
186
186
}
187
187
} )
188
- this . disposables . push ( acceptDisposable )
189
188
190
189
// Register Esc key handler for rejecting suggestion
191
- const rejectDisposable = vscode . commands . registerCommand ( 'aws.amazonq.inline.rejectEdit' , ( ) => {
190
+ vscode . commands . registerCommand ( 'aws.amazonq.inline.rejectEdit' , ( ) => {
192
191
if ( this . rejectHandler ) {
193
192
this . rejectHandler ( )
194
193
}
195
194
} )
196
- this . disposables . push ( rejectDisposable )
197
195
}
198
196
199
197
/**
200
198
* Disposes resources
201
199
*/
202
200
public dispose ( ) : void {
203
- for ( const disposable of this . disposables ) {
204
- disposable . dispose ( )
205
- }
206
- this . disposables = [ ]
207
201
this . imageDecorationType . dispose ( )
208
202
this . removedCodeDecorationType . dispose ( )
209
203
}
0 commit comments