mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 13:29:44 +00:00
add completion/failure task audio cues (#162350)
This commit is contained in:
parent
6d55b5410c
commit
9926342f19
|
@ -152,7 +152,8 @@ export class Sound {
|
|||
public static readonly foldedArea = Sound.register({ fileName: 'foldedAreas.mp3' });
|
||||
public static readonly break = Sound.register({ fileName: 'break.mp3' });
|
||||
public static readonly quickFixes = Sound.register({ fileName: 'quickFixes.mp3' });
|
||||
public static readonly taskEnded = Sound.register({ fileName: 'taskEnded.mp3' });
|
||||
public static readonly taskCompleted = Sound.register({ fileName: 'taskCompleted.mp3' });
|
||||
public static readonly taskFailed = Sound.register({ fileName: 'taskFailed.mp3' });
|
||||
public static readonly terminalBell = Sound.register({ fileName: 'terminalBell.mp3' });
|
||||
|
||||
private constructor(public readonly fileName: string) { }
|
||||
|
@ -219,10 +220,16 @@ export class AudioCue {
|
|||
settingsKey: 'audioCues.noInlayHints'
|
||||
});
|
||||
|
||||
public static readonly taskEnded = AudioCue.register({
|
||||
name: localize('audioCues.taskEnded', 'Task Ended'),
|
||||
sound: Sound.taskEnded,
|
||||
settingsKey: 'audioCues.taskEnded'
|
||||
public static readonly taskCompleted = AudioCue.register({
|
||||
name: localize('audioCues.taskCompleted', 'Task Completed'),
|
||||
sound: Sound.taskCompleted,
|
||||
settingsKey: 'audioCues.taskCompleted'
|
||||
});
|
||||
|
||||
public static readonly taskFailed = AudioCue.register({
|
||||
name: localize('audioCues.taskFailed', 'Task Failed'),
|
||||
sound: Sound.taskFailed,
|
||||
settingsKey: 'audioCues.taskFailed'
|
||||
});
|
||||
|
||||
public static readonly terminalBell = AudioCue.register({
|
||||
|
|
|
@ -72,8 +72,12 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis
|
|||
'description': localize('audioCues.noInlayHints', "Plays a sound when trying to read a line with inlay hints that has no inlay hints."),
|
||||
...audioCueFeatureBase,
|
||||
},
|
||||
'audioCues.taskEnded': {
|
||||
'description': localize('audioCues.taskEnded', "Plays a sound when a task ends."),
|
||||
'audioCues.taskCompleted': {
|
||||
'description': localize('audioCues.taskCompleted', "Plays a sound when a task completed."),
|
||||
...audioCueFeatureBase,
|
||||
},
|
||||
'audioCues.taskFailed': {
|
||||
'description': localize('audioCues.taskFailed', "Plays a sound when a task fails (non-zero exit code)."),
|
||||
...audioCueFeatureBase,
|
||||
},
|
||||
'audioCues.terminalQuickFix': {
|
||||
|
|
Binary file not shown.
Binary file not shown.
BIN
src/vs/workbench/contrib/audioCues/browser/media/taskFailed.mp3
Normal file
BIN
src/vs/workbench/contrib/audioCues/browser/media/taskFailed.mp3
Normal file
Binary file not shown.
|
@ -48,17 +48,10 @@ export class TaskTerminalStatus extends Disposable {
|
|||
case TaskEventKind.Active: this.eventActive(event); break;
|
||||
case TaskEventKind.Inactive: this.eventInactive(event); break;
|
||||
case TaskEventKind.ProcessEnded: this.eventEnd(event); break;
|
||||
case TaskEventKind.End: this._playEndSound(event.exitCode); break;
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private _playEndSound(exitCode?: number): void {
|
||||
//TODO: determine sound based on exit code
|
||||
this._audioCueService.playAudioCue(AudioCue.taskEnded);
|
||||
}
|
||||
|
||||
|
||||
addTerminal(task: Task, terminal: ITerminalInstance, problemMatcher: AbstractProblemCollector) {
|
||||
const status: ITerminalStatus = { id: TASK_TERMINAL_STATUS_ID, severity: Severity.Info };
|
||||
terminal.statusList.add(status);
|
||||
|
@ -93,6 +86,7 @@ export class TaskTerminalStatus extends Disposable {
|
|||
terminalData.taskRunEnded = true;
|
||||
terminalData.terminal.statusList.remove(terminalData.status);
|
||||
if ((event.exitCode === 0) && (terminalData.problemMatcher.numberOfMatches === 0)) {
|
||||
this._audioCueService.playAudioCue(AudioCue.taskCompleted);
|
||||
if (terminalData.task.configurationProperties.isBackground) {
|
||||
for (const status of terminalData.terminal.statusList.statuses) {
|
||||
terminalData.terminal.statusList.remove(status);
|
||||
|
@ -101,6 +95,7 @@ export class TaskTerminalStatus extends Disposable {
|
|||
terminalData.terminal.statusList.add(SUCCEEDED_TASK_STATUS);
|
||||
}
|
||||
} else if (event.exitCode || terminalData.problemMatcher.maxMarkerSeverity === MarkerSeverity.Error) {
|
||||
this._audioCueService.playAudioCue(AudioCue.taskFailed);
|
||||
terminalData.terminal.statusList.add(FAILED_TASK_STATUS);
|
||||
} else if (terminalData.problemMatcher.maxMarkerSeverity === MarkerSeverity.Warning) {
|
||||
terminalData.terminal.statusList.add(WARNING_TASK_STATUS);
|
||||
|
@ -116,8 +111,10 @@ export class TaskTerminalStatus extends Disposable {
|
|||
}
|
||||
terminalData.terminal.statusList.remove(terminalData.status);
|
||||
if (terminalData.problemMatcher.numberOfMatches === 0) {
|
||||
this._audioCueService.playAudioCue(AudioCue.taskCompleted);
|
||||
terminalData.terminal.statusList.add(SUCCEEDED_INACTIVE_TASK_STATUS);
|
||||
} else if (terminalData.problemMatcher.maxMarkerSeverity === MarkerSeverity.Error) {
|
||||
this._audioCueService.playAudioCue(AudioCue.taskFailed);
|
||||
terminalData.terminal.statusList.add(FAILED_INACTIVE_TASK_STATUS);
|
||||
} else if (terminalData.problemMatcher.maxMarkerSeverity === MarkerSeverity.Warning) {
|
||||
terminalData.terminal.statusList.add(WARNING_INACTIVE_TASK_STATUS);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Orientation } from 'vs/base/browser/ui/splitview/splitview';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
|
|
Loading…
Reference in a new issue