From 6981f7c7fbbbcc18b15dab4e004a341101b9fc05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moreno?= Date: Wed, 13 May 2020 15:49:42 +0200 Subject: [PATCH] :lipstick: --- extensions/git/src/statusbar.ts | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/extensions/git/src/statusbar.ts b/extensions/git/src/statusbar.ts index a977815584f..9b7a498aa43 100644 --- a/extensions/git/src/statusbar.ts +++ b/extensions/git/src/statusbar.ts @@ -152,6 +152,8 @@ class SyncStatusBar { export class StatusBarCommands { + readonly onDidChange: Event; + private syncStatusBar: SyncStatusBar; private checkoutStatusBar: CheckoutStatusBar; private disposables: Disposable[] = []; @@ -159,31 +161,12 @@ export class StatusBarCommands { constructor(repository: Repository) { this.syncStatusBar = new SyncStatusBar(repository); this.checkoutStatusBar = new CheckoutStatusBar(repository); - } - - get onDidChange(): Event { - return anyEvent( - this.syncStatusBar.onDidChange, - this.checkoutStatusBar.onDidChange - ); + this.onDidChange = anyEvent(this.syncStatusBar.onDidChange, this.checkoutStatusBar.onDidChange); } get commands(): Command[] { - const result: Command[] = []; - - const checkout = this.checkoutStatusBar.command; - - if (checkout) { - result.push(checkout); - } - - const sync = this.syncStatusBar.command; - - if (sync) { - result.push(sync); - } - - return result; + return [this.checkoutStatusBar.command, this.syncStatusBar.command] + .filter((c): c is Command => !!c); } dispose(): void {