mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
fix #203211
This commit is contained in:
parent
856d46ed86
commit
77fe3a1122
|
@ -22,6 +22,7 @@ export interface IAudioCueService {
|
|||
isCueEnabled(cue: AudioCue): boolean;
|
||||
isAlertEnabled(cue: AudioCue): boolean;
|
||||
onEnabledChanged(cue: AudioCue): Event<void>;
|
||||
onAlertEnabledChanged(cue: AudioCue): Event<void>;
|
||||
|
||||
playSound(cue: Sound, allowManyInParallel?: boolean): Promise<void>;
|
||||
playAudioCueLoop(cue: AudioCue, milliseconds: number): IDisposable;
|
||||
|
@ -235,6 +236,10 @@ export class AudioCueService extends Disposable implements IAudioCueService {
|
|||
public onEnabledChanged(cue: AudioCue): Event<void> {
|
||||
return Event.fromObservableLight(this.isCueEnabledCache.get({ cue }));
|
||||
}
|
||||
|
||||
public onAlertEnabledChanged(cue: AudioCue): Event<void> {
|
||||
return Event.fromObservableLight(this.isAlertEnabledCache.get({ cue }));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -37,6 +37,11 @@ export class AudioCueLineFeatureContribution
|
|||
() => this.audioCueService.isCueEnabled(cue)
|
||||
));
|
||||
|
||||
private readonly isAlertEnabledCache = new CachedFunction<AudioCue, IObservable<boolean>>((cue) => observableFromEvent(
|
||||
this.audioCueService.onAlertEnabledChanged(cue),
|
||||
() => this.audioCueService.isAlertEnabled(cue)
|
||||
));
|
||||
|
||||
constructor(
|
||||
@IEditorService private readonly editorService: IEditorService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
|
@ -47,7 +52,7 @@ export class AudioCueLineFeatureContribution
|
|||
|
||||
const someAudioCueFeatureIsEnabled = derived(
|
||||
(reader) => /** @description someAudioCueFeatureIsEnabled */ this.features.some((feature) =>
|
||||
this.isEnabledCache.get(feature.audioCue).read(reader)
|
||||
this.isEnabledCache.get(feature.audioCue).read(reader) || this.isAlertEnabledCache.get(feature.audioCue).read(reader)
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -116,7 +121,7 @@ export class AudioCueLineFeatureContribution
|
|||
const isFeaturePresent = derivedOpts(
|
||||
{ debugName: `isPresentInLine:${feature.audioCue.name}` },
|
||||
(reader) => {
|
||||
if (!this.isEnabledCache.get(feature.audioCue).read(reader)) {
|
||||
if (!this.isEnabledCache.get(feature.audioCue).read(reader) && !this.isAlertEnabledCache.get(feature.audioCue).read(reader)) {
|
||||
return false;
|
||||
}
|
||||
const position = debouncedPosition.read(reader);
|
||||
|
|
Loading…
Reference in a new issue