git: countBadge config

This commit is contained in:
Joao Moreno
2017-01-31 17:06:21 +01:00
parent adb32aa444
commit da1a21d1de
9 changed files with 47 additions and 10 deletions

View File

@@ -257,7 +257,7 @@ export type SCMRawResourceGroup = [string /*id*/, string /*label*/, SCMRawResour
export abstract class MainThreadSCMShape {
$register(id: string, features: SCMProviderFeatures): void { throw ni(); }
$unregister(id: string): void { throw ni(); }
$onChange(id: string, resources: SCMRawResourceGroup[]): void { throw ni(); }
$onChange(id: string, resources: SCMRawResourceGroup[], count: number | undefined): void { throw ni(); }
}
// -- extension host

View File

@@ -151,7 +151,7 @@ export class ExtHostSCM {
return [g.id, g.label, rawResources] as SCMRawResourceGroup;
});
this._proxy.$onChange(providerId, rawResourceGroups);
this._proxy.$onChange(providerId, rawResourceGroups, provider.count);
});
return new Disposable(() => {

View File

@@ -27,6 +27,9 @@ class MainThreadSCMProvider implements ISCMProvider {
get id(): string { return this._id; }
get label(): string { return this.features.label; }
private _count: number | undefined = undefined;
get count(): number | undefined { return this._count; }
constructor(
private _id: string,
private proxy: ExtHostSCMShape,
@@ -68,7 +71,7 @@ class MainThreadSCMProvider implements ISCMProvider {
// }
}
$onChange(rawResourceGroups: SCMRawResourceGroup[]): void {
$onChange(rawResourceGroups: SCMRawResourceGroup[], count: number | undefined): void {
this._resources = rawResourceGroups.map(rawGroup => {
const [id, label, rawResources] = rawGroup;
@@ -93,6 +96,7 @@ class MainThreadSCMProvider implements ISCMProvider {
return { id, label, resources };
});
this._count = count;
this._onDidChange.fire(this.resources);
}
@@ -130,14 +134,14 @@ export class MainThreadSCM extends MainThreadSCMShape {
delete this.providers[id];
}
$onChange(id: string, rawResourceGroups: SCMRawResourceGroup[]): void {
$onChange(id: string, rawResourceGroups: SCMRawResourceGroup[], count: number | undefined): void {
const provider = this.providers[id];
if (!provider) {
return;
}
provider.$onChange(rawResourceGroups);
provider.$onChange(rawResourceGroups, count);
}
dispose(): void {