提交 731ea1ef 编写于 作者: J Joao Moreno

git: report progress

上级 2caf36fd
......@@ -5,7 +5,7 @@
'use strict';
import { Uri, EventEmitter, Event, SCMResource, SCMResourceDecorations, SCMResourceGroup, Disposable } from 'vscode';
import { Uri, EventEmitter, Event, SCMResource, SCMResourceDecorations, SCMResourceGroup, Disposable, window } from 'vscode';
import { Repository, IRef, IBranch, IRemote, IPushOptions } from './git';
import { throttle, anyEvent, eventToPromise, filterEvent, mapEvent } from './util';
import { watch } from './watch';
......@@ -365,16 +365,18 @@ export class Model {
}
private async run(operation: Operation, fn: () => Promise<void> = () => Promise.resolve()): Promise<void> {
this._operations = this._operations.start(operation);
this._onRunOperation.fire(operation);
try {
await fn();
await this.update();
} finally {
this._operations = this._operations.end(operation);
this._onDidRunOperation.fire(operation);
}
window.withScmProgress(async () => {
this._operations = this._operations.start(operation);
this._onRunOperation.fire(operation);
try {
await fn();
await this.update();
} finally {
this._operations = this._operations.end(operation);
this._onDidRunOperation.fire(operation);
}
});
}
@decorate(throttle)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册