Skip to content

Commit 00de15d

Browse files
committed
notificationFilter.ERROR
1 parent 671fc8f commit 00de15d

5 files changed

Lines changed: 15 additions & 4 deletions

File tree

src/vs/platform/notification/common/notification.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,12 @@ export enum NotificationsFilter {
238238
* All notifications are configured as silent. See
239239
* `INotificationProperties.silent` for more info.
240240
*/
241-
SILENT
241+
SILENT,
242+
243+
/**
244+
* All notifications are silent except error notifications.
245+
*/
246+
ERROR
242247
}
243248

244249
/**

src/vs/workbench/browser/layout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
685685

686686
this.state.zenMode.setNotificationsFilter = config.silentNotifications;
687687
if (config.silentNotifications) {
688-
this.notificationService.setFilter(NotificationsFilter.SILENT);
688+
this.notificationService.setFilter(NotificationsFilter.ERROR);
689689
}
690690

691691
if (config.centerLayout) {

src/vs/workbench/browser/parts/notifications/notificationsToasts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class NotificationsToasts extends Themable {
9595

9696
// Filter
9797
this._register(this.model.onDidFilterChange(filter => {
98-
if (filter === NotificationsFilter.SILENT) {
98+
if (filter === NotificationsFilter.SILENT || filter === NotificationsFilter.ERROR) {
9999
this.hide();
100100
}
101101
}));

src/vs/workbench/common/notifications.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ export class NotificationViewItem extends Disposable implements INotificationVie
438438
actions = { primary: notification.message.actions };
439439
}
440440

441-
return new NotificationViewItem(severity, notification.sticky, notification.silent || filter === NotificationsFilter.SILENT, message, notification.source, actions);
441+
return new NotificationViewItem(severity, notification.sticky, notification.silent || filter === NotificationsFilter.SILENT || (filter === NotificationsFilter.ERROR && notification.severity !== Severity.Error), message, notification.source, actions);
442442
}
443443

444444
private static parseNotificationMessage(input: NotificationMessage): INotificationMessage | undefined {

src/vs/workbench/test/common/notifications.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ suite('Notifications', () => {
134134

135135
let item9 = NotificationViewItem.create({ severity: Severity.Error, message: 'Error Message' }, NotificationsFilter.OFF)!;
136136
assert.equal(item9.silent, false);
137+
138+
let item10 = NotificationViewItem.create({ severity: Severity.Error, message: 'Error Message' }, NotificationsFilter.ERROR)!;
139+
assert.equal(item10.silent, false);
140+
141+
let item11 = NotificationViewItem.create({ severity: Severity.Warning, message: 'Error Message' }, NotificationsFilter.ERROR)!;
142+
assert.equal(item11.silent, true);
137143
});
138144

139145
test('Model', () => {

0 commit comments

Comments
 (0)