diff --git a/src/vs/platform/notification/common/notification.ts b/src/vs/platform/notification/common/notification.ts index 663ba2070bfe93fd6f8e198c93297e87b49c2c04..6f10b476dc8fc9e7f2f5758d0b569ba128c64932 100644 --- a/src/vs/platform/notification/common/notification.ts +++ b/src/vs/platform/notification/common/notification.ts @@ -238,7 +238,12 @@ export enum NotificationsFilter { * All notifications are configured as silent. See * `INotificationProperties.silent` for more info. */ - SILENT + SILENT, + + /** + * All notifications are silent except error notifications. + */ + ERROR } /** diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts index 187ee4870c860cb61cecbcb842c03b4a0fcf27c8..cd21e91bf8160ca1afc1446fa217164ce83dc17d 100644 --- a/src/vs/workbench/browser/layout.ts +++ b/src/vs/workbench/browser/layout.ts @@ -685,7 +685,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi this.state.zenMode.setNotificationsFilter = config.silentNotifications; if (config.silentNotifications) { - this.notificationService.setFilter(NotificationsFilter.SILENT); + this.notificationService.setFilter(NotificationsFilter.ERROR); } if (config.centerLayout) { diff --git a/src/vs/workbench/browser/parts/notifications/notificationsToasts.ts b/src/vs/workbench/browser/parts/notifications/notificationsToasts.ts index 33f6f863ec277266d11cf1f22b876901824c0fb8..63d8c0847317279579b9a53938fd3d526be16d13 100644 --- a/src/vs/workbench/browser/parts/notifications/notificationsToasts.ts +++ b/src/vs/workbench/browser/parts/notifications/notificationsToasts.ts @@ -95,7 +95,7 @@ export class NotificationsToasts extends Themable { // Filter this._register(this.model.onDidFilterChange(filter => { - if (filter === NotificationsFilter.SILENT) { + if (filter === NotificationsFilter.SILENT || filter === NotificationsFilter.ERROR) { this.hide(); } })); diff --git a/src/vs/workbench/common/notifications.ts b/src/vs/workbench/common/notifications.ts index 614d1e561bdca948c9656bb67f313a7180998349..a6b19e5df2c8481bf6ebcf9889844e40b02eae59 100644 --- a/src/vs/workbench/common/notifications.ts +++ b/src/vs/workbench/common/notifications.ts @@ -438,7 +438,7 @@ export class NotificationViewItem extends Disposable implements INotificationVie actions = { primary: notification.message.actions }; } - return new NotificationViewItem(severity, notification.sticky, notification.silent || filter === NotificationsFilter.SILENT, message, notification.source, actions); + return new NotificationViewItem(severity, notification.sticky, notification.silent || filter === NotificationsFilter.SILENT || (filter === NotificationsFilter.ERROR && notification.severity !== Severity.Error), message, notification.source, actions); } private static parseNotificationMessage(input: NotificationMessage): INotificationMessage | undefined { diff --git a/src/vs/workbench/test/common/notifications.test.ts b/src/vs/workbench/test/common/notifications.test.ts index 5a9dd5781b7a07ce56c9fe1070418a0c5367a552..b8a5e1b1ee1a8b9dfaf9aa349b51f9aaf29c5703 100644 --- a/src/vs/workbench/test/common/notifications.test.ts +++ b/src/vs/workbench/test/common/notifications.test.ts @@ -134,6 +134,12 @@ suite('Notifications', () => { let item9 = NotificationViewItem.create({ severity: Severity.Error, message: 'Error Message' }, NotificationsFilter.OFF)!; assert.equal(item9.silent, false); + + let item10 = NotificationViewItem.create({ severity: Severity.Error, message: 'Error Message' }, NotificationsFilter.ERROR)!; + assert.equal(item10.silent, false); + + let item11 = NotificationViewItem.create({ severity: Severity.Warning, message: 'Error Message' }, NotificationsFilter.ERROR)!; + assert.equal(item11.silent, true); }); test('Model', () => {