@@ -230,72 +230,8 @@ export class AutoDebugFeature implements vscode.Disposable {
230
230
const message = `Amazon Q detected ${ criticalProblems . length } error${ criticalProblems . length !== 1 ? 's' : '' } in your code`
231
231
this . logger . debug ( 'AutoDebugFeature: About to show notification: %s' , message )
232
232
233
- // **FIX**: Try multiple notification methods with error handling
234
- try {
235
- // Method 1: showWarningMessage with error handling
236
- Promise . resolve ( vscode . window . showWarningMessage ( message , 'Fix with Amazon Q' , 'Dismiss' ) )
237
- . then ( ( selection ) => {
238
- this . logger . debug (
239
- 'AutoDebugFeature: Notification selection: %s' ,
240
- selection || 'dismissed'
241
- )
242
- if ( selection === 'Fix with Amazon Q' ) {
243
- void this . triggerFixWithAmazonQ ( )
244
- }
245
- } )
246
- . catch ( ( error ) => {
247
- this . logger . error ( 'AutoDebugFeature: showWarningMessage failed: %s' , error )
248
- // Fallback: Try showInformationMessage with proper button handling
249
- Promise . resolve (
250
- vscode . window . showInformationMessage ( message , 'Fix with Amazon Q' , 'Dismiss' )
251
- )
252
- . then ( ( selection ) => {
253
- this . logger . debug (
254
- 'AutoDebugFeature: Fallback notification selection: %s' ,
255
- selection || 'dismissed'
256
- )
257
- if ( selection === 'Fix with Amazon Q' ) {
258
- void this . triggerFixWithAmazonQ ( )
259
- }
260
- } )
261
- . catch ( ( fallbackError ) => {
262
- this . logger . error (
263
- 'AutoDebugFeature: Fallback showInformationMessage failed: %s' ,
264
- fallbackError
265
- )
266
- } )
267
- } )
268
-
269
- // Method 2: Alternative - showErrorMessage (should be more visible)
270
- setTimeout ( ( ) => {
271
- this . logger . debug ( 'AutoDebugFeature: Trying showErrorMessage as backup' )
272
- Promise . resolve (
273
- vscode . window . showErrorMessage ( `🔧 ${ message } ` , 'Fix with Amazon Q' , 'Dismiss' )
274
- )
275
- . then ( ( selection ) => {
276
- this . logger . debug (
277
- 'AutoDebugFeature: Backup notification selection: %s' ,
278
- selection || 'dismissed'
279
- )
280
- if ( selection === 'Fix with Amazon Q' ) {
281
- void this . triggerFixWithAmazonQ ( )
282
- }
283
- } )
284
- . catch ( ( backupError ) => {
285
- this . logger . error (
286
- 'AutoDebugFeature: Backup showErrorMessage failed: %s' ,
287
- backupError
288
- )
289
- } )
290
- } , 500 )
291
- } catch ( error ) {
292
- this . logger . error ( 'AutoDebugFeature: All notification methods failed: %s' , error )
293
- // Last resort: Status bar message
294
- void vscode . window . setStatusBarMessage (
295
- `Amazon Q: ${ criticalProblems . length } errors detected` ,
296
- 5000
297
- )
298
- }
233
+ // Show notification with auto-dismiss after 2 seconds
234
+ this . showAutoDisappearingNotification ( message )
299
235
} else {
300
236
this . logger . debug ( 'AutoDebugFeature: No critical problems found - likely severity mismatch!' )
301
237
// **TEMPORARY DEBUG**: Show notification for all problems to test VS Code API
@@ -389,6 +325,36 @@ export class AutoDebugFeature implements vscode.Disposable {
389
325
await vscode . window . showTextDocument ( doc )
390
326
}
391
327
328
+ /**
329
+ * Shows a notification that automatically disappears after 2 seconds
330
+ */
331
+ private showAutoDisappearingNotification ( message : string ) : void {
332
+ this . logger . debug ( 'AutoDebugFeature: Showing auto-disappearing notification: %s' , message )
333
+
334
+ // Create a promise that resolves after 2 seconds to auto-dismiss
335
+ const autoDisappearPromise = new Promise < string | undefined > ( ( resolve ) => {
336
+ setTimeout ( ( ) => {
337
+ this . logger . debug ( 'AutoDebugFeature: Auto-dismissing notification after 2 seconds' )
338
+ resolve ( undefined )
339
+ } , 2000 )
340
+ } )
341
+
342
+ // Show the notification with buttons
343
+ const notificationPromise = vscode . window . showWarningMessage ( message , 'Fix with Amazon Q' , 'Dismiss' )
344
+
345
+ // Race between user interaction and auto-dismiss
346
+ Promise . race ( [ notificationPromise , autoDisappearPromise ] )
347
+ . then ( ( selection ) => {
348
+ this . logger . debug ( 'AutoDebugFeature: Notification result: %s' , selection || 'auto-dismissed' )
349
+ if ( selection === 'Fix with Amazon Q' ) {
350
+ void this . triggerFixWithAmazonQ ( )
351
+ }
352
+ } )
353
+ . catch ( ( error ) => {
354
+ this . logger . error ( 'AutoDebugFeature: Error with auto-disappearing notification: %s' , error )
355
+ } )
356
+ }
357
+
392
358
public dispose ( ) : void {
393
359
this . logger . debug ( 'AutoDebugFeature: Disposing auto debug feature' )
394
360
vscode . Disposable . from ( ...this . disposables ) . dispose ( )
0 commit comments