mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
parent
c006f41e4b
commit
8bf858fa7b
|
@ -396,7 +396,8 @@ export class GitService extends ee.EventEmitter
|
|||
private inputCache: EditorInputCache;
|
||||
private toDispose: lifecycle.IDisposable[];
|
||||
private needsRefresh: boolean;
|
||||
private refreshDelayer: async.ThrottledDelayer<void>;
|
||||
private statusDelayer: async.ThrottledDelayer<void>;
|
||||
private reactiveStatusDelayer: async.PeriodThrottledDelayer<void>;
|
||||
private autoFetcher: AutoFetcher;
|
||||
allowHugeRepositories: boolean;
|
||||
|
||||
|
@ -431,7 +432,8 @@ export class GitService extends ee.EventEmitter
|
|||
this.toDispose = [];
|
||||
|
||||
this.needsRefresh = false;
|
||||
this.refreshDelayer = new async.PeriodThrottledDelayer<void>(500, 10000);
|
||||
this.statusDelayer = new async.ThrottledDelayer<void>(500);
|
||||
this.reactiveStatusDelayer = new async.PeriodThrottledDelayer<void>(500, 10000);
|
||||
this.autoFetcher = this.instantiationService.createInstance(AutoFetcher, this);
|
||||
this.allowHugeRepositories = false;
|
||||
|
||||
|
@ -439,7 +441,7 @@ export class GitService extends ee.EventEmitter
|
|||
|
||||
this.inputCache = this.instantiationService.createInstance(EditorInputCache, this);
|
||||
|
||||
this.triggerStatus(true); // trigger initial status
|
||||
this.triggerStatus(); // trigger initial status
|
||||
|
||||
if (!storageService.getBoolean(IgnoreOldGitStorageKey, StorageScope.GLOBAL, false)) {
|
||||
this.raw.serviceState().done(state => {
|
||||
|
@ -486,27 +488,12 @@ export class GitService extends ee.EventEmitter
|
|||
this.allowHugeRepositories = config.allowLargeRepositories;
|
||||
|
||||
if (this.allowHugeRepositories) {
|
||||
this.triggerStatus(true);
|
||||
this.triggerStatus();
|
||||
}
|
||||
}));
|
||||
this.lifecycleService.onShutdown(this.dispose, this);
|
||||
}
|
||||
|
||||
private triggerStatus(force: boolean = false): void {
|
||||
if (this.isInitialized() && !this.isIdle() && !force) {
|
||||
this.refreshDelayer.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
var onError = async.once(e => {
|
||||
if (!errors.isPromiseCanceledError(e)) {
|
||||
this.messageService.show(severity.Error, e);
|
||||
}
|
||||
});
|
||||
|
||||
this.refreshDelayer.trigger(() => this.status()).done(null, onError);
|
||||
}
|
||||
|
||||
private onTextFileChange(e:filesCommon.TextFileChangeEvent): void {
|
||||
var shouldTriggerStatus = paths.basename(e.resource.fsPath) === '.gitignore';
|
||||
|
||||
|
@ -566,6 +553,10 @@ export class GitService extends ee.EventEmitter
|
|||
}
|
||||
|
||||
public status(): winjs.Promise {
|
||||
return this.statusDelayer.trigger(() => this._status());
|
||||
}
|
||||
|
||||
private _status(): winjs.Promise {
|
||||
const config = this.configurationService.getConfiguration<git.IGitConfiguration>('git');
|
||||
|
||||
if (this.allowHugeRepositories || config.allowLargeRepositories) {
|
||||
|
@ -586,6 +577,16 @@ export class GitService extends ee.EventEmitter
|
|||
});
|
||||
}
|
||||
|
||||
private triggerStatus(): void {
|
||||
this.reactiveStatusDelayer.trigger(() => this.status()).done(null, e => {
|
||||
if (errors.isPromiseCanceledError(e)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.messageService.show(severity.Error, e);
|
||||
});
|
||||
}
|
||||
|
||||
public init(): winjs.Promise {
|
||||
return this.run(git.ServiceOperations.INIT, () => this.raw.init());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue