diff --git a/src/vs/workbench/browser/parts/notifications/notificationsCenter.ts b/src/vs/workbench/browser/parts/notifications/notificationsCenter.ts index e7b9ac440dbc3957e95966fe8a46d05ef360e230..d6baf9a796e583348d3fa022da44f440d2092d4f 100644 --- a/src/vs/workbench/browser/parts/notifications/notificationsCenter.ts +++ b/src/vs/workbench/browser/parts/notifications/notificationsCenter.ts @@ -71,6 +71,10 @@ export class NotificationsCenter extends Themable { } public show(): void { + if (this.model.notifications.length === 0) { + return; // currently not supporting to show empty (https://github.com/Microsoft/vscode/issues/44509) + } + if (this._isVisible) { this.notificationsList.show(true /* focus */); diff --git a/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts b/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts index e5cd87a5e0e20e0c765a84b9e228d936474d6dc1..469360901d6879310d20253c4ee42fe34ac36ad2 100644 --- a/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts +++ b/src/vs/workbench/browser/parts/notifications/notificationsCommands.ts @@ -81,7 +81,9 @@ export function registerNotificationCommands(center: INotificationsCenterControl } // Show Notifications Cneter - CommandsRegistry.registerCommand(SHOW_NOTIFICATIONS_CENTER, () => center.show()); + CommandsRegistry.registerCommand(SHOW_NOTIFICATIONS_CENTER, () => { + center.show(); + }); // Hide Notifications Center KeybindingsRegistry.registerCommandAndKeybindingRule({ @@ -93,7 +95,13 @@ export function registerNotificationCommands(center: INotificationsCenterControl }); // Toggle Notifications Center - CommandsRegistry.registerCommand(TOGGLE_NOTIFICATIONS_CENTER, accessor => center.isVisible ? center.hide() : center.show()); + CommandsRegistry.registerCommand(TOGGLE_NOTIFICATIONS_CENTER, accessor => { + if (center.isVisible) { + center.hide(); + } else { + center.show(); + } + }); // Clear Notification KeybindingsRegistry.registerCommandAndKeybindingRule({