fix size constraints

This commit is contained in:
João Moreno 2020-08-11 20:00:16 +02:00
parent c47927627c
commit d4972e22a6
No known key found for this signature in database
GPG key ID: 896B853774D1A575

View file

@ -23,6 +23,7 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { RepositoryRenderer } from 'vs/workbench/contrib/scm/browser/scmRepositoryRenderer';
import { collectContextMenuActions, StatusBarAction, StatusBarActionViewItem } from 'vs/workbench/contrib/scm/browser/util';
import { Orientation } from 'vs/base/browser/ui/sash/sash';
class ListDelegate implements IListVirtualDelegate<ISCMRepository> {
@ -94,11 +95,13 @@ export class SCMRepositoriesViewPane extends ViewPane {
this.onDidAddRepository(repository);
}
this._register(this.configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('scm.repositories.visible')) {
this.updateBodySize();
}
}));
if (this.orientation === Orientation.VERTICAL) {
this._register(this.configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('scm.repositories.visible')) {
this.updateBodySize();
}
}));
}
this.updateListSelection();
}
@ -128,6 +131,10 @@ export class SCMRepositoriesViewPane extends ViewPane {
}
private updateBodySize(): void {
if (this.orientation === Orientation.HORIZONTAL) {
return;
}
const visibleCount = this.configurationService.getValue<number>('scm.repositories.visible');
const empty = this.list.length === 0;
const size = Math.min(this.list.length, visibleCount) * 22;