Skip to content

Commit

Permalink
fixes #79037
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno committed Aug 29, 2019
1 parent e457596 commit a526909
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/vs/workbench/contrib/scm/browser/scmViewlet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ export class SCMViewlet extends ViewContainerViewlet implements IViewModel {
}

private readonly _onDidChangeRepositories = new Emitter<void>();
private readonly onDidFinishStartup = Event.once(Event.debounce(this._onDidChangeRepositories.event, () => null, 1000));
private readonly _onHaveChangedRepositories = Event.debounce(this._onDidChangeRepositories.event, () => null, 1000);

constructor(
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
Expand Down Expand Up @@ -1135,8 +1135,9 @@ export class SCMViewlet extends ViewContainerViewlet implements IViewModel {
}
}));

this._register(this.onDidFinishStartup(this.onAfterStartup, this));
this._register(Event.once(this._onHaveChangedRepositories)(this.onAfterStartup, this));
this._register(this.viewsModel.onDidRemove(this.onDidHideView, this));
this._register(contextService.onDidChangeWorkspaceFolders(this.onDidChangeWorkspaceFolders, this));
}

create(parent: HTMLElement): void {
Expand Down Expand Up @@ -1221,6 +1222,16 @@ export class SCMViewlet extends ViewContainerViewlet implements IViewModel {
});
}

private onDidChangeWorkspaceFolders(): void {
Event.once(this._onHaveChangedRepositories)(this.onHaveChangedWorkspaceFolders, this);
}

private onHaveChangedWorkspaceFolders(): void {
if (this.repositoryCount > 1) {
this.viewsModel.setVisible(MainPanel.ID, true);
}
}

focus(): void {
if (this.repositoryCount === 0) {
this.message.focus();
Expand Down

0 comments on commit a526909

Please sign in to comment.