提交 b920ce85 编写于 作者: J Joao Moreno

💄

上级 f82fcb8a
......@@ -1034,11 +1034,11 @@
"default": 10,
"description": "%config.detectSubmodulesLimit%"
},
"git.showStagedChangesResourceGroup": {
"git.alwaysShowStagedChangesResourceGroup": {
"type": "boolean",
"scope": "resource",
"default": false,
"description": "%config.showStagedChangesResourceGroup%"
"description": "%config.alwaysShowStagedChangesResourceGroup%"
},
"git.alwaysSignOff": {
"type": "boolean",
......
......@@ -85,7 +85,7 @@
"config.detectSubmodules": "Controls whether to automatically detect git submodules.",
"colors.added": "Color for added resources.",
"config.detectSubmodulesLimit": "Controls the limit of git submodules detected.",
"config.showStagedChangesResourceGroup": "Always show the Staged Changes resource group.",
"config.alwaysShowStagedChangesResourceGroup": "Always show the Staged Changes resource group.",
"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.",
......
......@@ -589,7 +589,8 @@ export class Repository implements Disposable {
const onRelevantGitChange = filterEvent(onRelevantRepositoryChange, uri => /\/\.git\//.test(uri.path));
onRelevantGitChange(this._onDidChangeRepository.fire, this._onDidChangeRepository, this.disposables);
this._sourceControl = scm.createSourceControl('git', 'Git', Uri.file(repository.root));
const root = Uri.file(repository.root);
this._sourceControl = scm.createSourceControl('git', 'Git', root);
this._sourceControl.inputBox.placeholder = localize('commitMessage', "Message (press {0} to commit)");
this._sourceControl.acceptInputCommand = { command: 'git.commitWithInput', title: localize('commit', "Commit"), arguments: [this._sourceControl] };
this._sourceControl.quickDiffProvider = this;
......@@ -600,9 +601,14 @@ export class Repository implements Disposable {
this._indexGroup = this._sourceControl.createResourceGroup('index', localize('staged changes', "Staged Changes"));
this._workingTreeGroup = this._sourceControl.createResourceGroup('workingTree', localize('changes', "Changes"));
const onConfigListener = filterEvent(workspace.onDidChangeConfiguration, e => e.affectsConfiguration('git.showStagedChangesResourceGroup'));
onConfigListener(this.showStagedChangesResourceGroup, this, this.disposables);
this.showStagedChangesResourceGroup();
const updateIndexGroupVisibility = () => {
const config = workspace.getConfiguration('git', root);
this.indexGroup.hideWhenEmpty = !config.get<boolean>('alwaysShowStagedChangesResourceGroup');
};
const onConfigListener = filterEvent(workspace.onDidChangeConfiguration, e => e.affectsConfiguration('git.alwaysShowStagedChangesResourceGroup', root));
onConfigListener(updateIndexGroupVisibility, this, this.disposables);
updateIndexGroupVisibility();
this.mergeGroup.hideWhenEmpty = true;
......@@ -715,12 +721,6 @@ export class Repository implements Disposable {
return this.run(Operation.Config, () => this.repository.config('local', key, value));
}
private showStagedChangesResourceGroup(): void {
const config = workspace.getConfiguration('git');
const gitShowStagedChangesResourceGroup = config.get<string>('showStagedChangesResourceGroup');
this.indexGroup.hideWhenEmpty = !gitShowStagedChangesResourceGroup;
}
@throttle
async status(): Promise<void> {
await this.run(Operation.Status);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册