提交 7ffa9219 编写于 作者: J Joao Moreno

fixes #52037

上级 deaf7756
......@@ -1045,6 +1045,12 @@
"default": [],
"scope": "window",
"description": "%config.ignoredRepositories%"
},
"git.showProgress": {
"type": "boolean",
"description": "%config.showProgress%",
"default": true,
"scope": "resource"
}
}
},
......@@ -1209,4 +1215,4 @@
"@types/which": "^1.0.28",
"mocha": "^3.2.0"
}
}
}
\ No newline at end of file
......@@ -87,6 +87,7 @@
"config.detectSubmodulesLimit": "Controls the limit of git submodules detected.",
"config.alwaysSignOff": "Controls the signoff flag for all commits.",
"config.ignoredRepositories": "List of git repositories to ignore.",
"config.showProgress": "Controls whether git actions should show progress.",
"colors.modified": "Color for modified resources.",
"colors.deleted": "Color for deleted resources.",
"colors.untracked": "Color for untracked resources.",
......
......@@ -407,11 +407,32 @@ export interface OperationResult {
class ProgressManager {
private enabled = false;
private disposable: IDisposable = EmptyDisposable;
constructor(repository: Repository) {
const start = onceEvent(filterEvent(repository.onDidChangeOperations, () => repository.operations.shouldShowProgress()));
const end = onceEvent(filterEvent(debounceEvent(repository.onDidChangeOperations, 300), () => !repository.operations.shouldShowProgress()));
constructor(private repository: Repository) {
const onDidChange = filterEvent(workspace.onDidChangeConfiguration, e => e.affectsConfiguration('git', Uri.file(this.repository.root)));
onDidChange(_ => this.updateEnablement());
this.updateEnablement();
}
private updateEnablement(): void {
const config = workspace.getConfiguration('git', Uri.file(this.repository.root));
if (config.get<boolean>('showProgress')) {
this.enable();
} else {
this.disable();
}
}
private enable(): void {
if (this.enabled) {
return;
}
const start = onceEvent(filterEvent(this.repository.onDidChangeOperations, () => this.repository.operations.shouldShowProgress()));
const end = onceEvent(filterEvent(debounceEvent(this.repository.onDidChangeOperations, 300), () => !this.repository.operations.shouldShowProgress()));
const setup = () => {
this.disposable = start(() => {
......@@ -421,10 +442,21 @@ class ProgressManager {
};
setup();
this.enabled = true;
}
dispose(): void {
private disable(): void {
if (!this.enabled) {
return;
}
this.disposable.dispose();
this.disposable = EmptyDisposable;
this.enabled = false;
}
dispose(): void {
this.disable();
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册