提交 964103c9 编写于 作者: J Joao Moreno

fixes #47743

上级 1e770992
......@@ -139,7 +139,7 @@ export class StatusBarController implements IWorkbenchContribution {
this.disposables = this.disposables.filter(d => d !== removeDisposable);
if (this.scmService.repositories.length === 0) {
this.focusedProviderContextKey.set(undefined);
this.onDidFocusRepository(undefined);
} else if (this.focusedRepository === repository) {
this.scmService.repositories[0].focus();
}
......@@ -153,21 +153,29 @@ export class StatusBarController implements IWorkbenchContribution {
}
}
private onDidFocusRepository(repository: ISCMRepository): void {
private onDidFocusRepository(repository: ISCMRepository | undefined): void {
if (this.focusedRepository === repository) {
return;
}
this.focusedRepository = repository;
this.focusedProviderContextKey.set(repository.provider.id);
this.focusedProviderContextKey.set(repository && repository.provider.id);
this.focusDisposable.dispose();
this.focusDisposable = repository.provider.onDidChange(() => this.render(repository));
if (repository) {
this.focusDisposable = repository.provider.onDidChange(() => this.render(repository));
}
this.render(repository);
}
private render(repository: ISCMRepository): void {
private render(repository: ISCMRepository | undefined): void {
this.statusBarDisposable.dispose();
if (!repository) {
return;
}
const commands = repository.provider.statusBarCommands || [];
const label = repository.provider.rootUri
? `${basename(repository.provider.rootUri.fsPath)} (${repository.provider.label})`
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册