5
5
6
6
import { status } from 'vs/base/browser/ui/aria/aria' ;
7
7
import { RunOnceScheduler } from 'vs/base/common/async' ;
8
- import { Disposable , IDisposable } from 'vs/base/common/lifecycle' ;
8
+ import { Disposable , DisposableMap , IDisposable } from 'vs/base/common/lifecycle' ;
9
9
import { AudioCue , IAudioCueService } from 'vs/platform/audioCues/browser/audioCueService' ;
10
10
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
11
11
import { IChatAccessibilityService } from 'vs/workbench/contrib/chat/browser/chat' ;
@@ -15,7 +15,7 @@ export class ChatAccessibilityService extends Disposable implements IChatAccessi
15
15
16
16
declare readonly _serviceBrand : undefined ;
17
17
18
- private _pendingCueMap : Map < number , AudioCueScheduler > = new Map ( ) ;
18
+ private _pendingCueMap : DisposableMap < number , AudioCueScheduler > = this . _register ( new DisposableMap ( ) ) ;
19
19
20
20
private _requestId : number = 0 ;
21
21
@@ -25,12 +25,11 @@ export class ChatAccessibilityService extends Disposable implements IChatAccessi
25
25
acceptRequest ( ) : number {
26
26
this . _requestId ++ ;
27
27
this . _audioCueService . playAudioCue ( AudioCue . chatRequestSent , { allowManyInParallel : true } ) ;
28
- this . _pendingCueMap . set ( this . _requestId , this . _register ( this . _instantiationService . createInstance ( AudioCueScheduler ) ) ) ;
28
+ this . _pendingCueMap . set ( this . _requestId , this . _instantiationService . createInstance ( AudioCueScheduler ) ) ;
29
29
return this . _requestId ;
30
30
}
31
31
acceptResponse ( response : IChatResponseViewModel | string | undefined , requestId : number ) : void {
32
- this . _pendingCueMap . get ( requestId ) ?. dispose ( ) ;
33
- this . _pendingCueMap . delete ( requestId ) ;
32
+ this . _pendingCueMap . deleteAndDispose ( requestId ) ;
34
33
const isPanelChat = typeof response !== 'string' ;
35
34
const responseContent = typeof response === 'string' ? response : response ?. response . asString ( ) ;
36
35
this . _audioCueService . playAudioCue ( AudioCue . chatResponseReceived , { allowManyInParallel : true } ) ;
0 commit comments