diff --git a/extensions/git/package.json b/extensions/git/package.json index fb0dcce72d2..befecc5ab71 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -1034,6 +1034,12 @@ "default": 10, "description": "%config.detectSubmodulesLimit%" }, + "git.showStagedChangesResourceGroup": { + "type": "boolean", + "scope": "resource", + "default": false, + "description": "%config.showStagedChangesResourceGroup%" + }, "git.alwaysSignOff": { "type": "boolean", "scope": "resource", diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index 21ca066b1fb..7ee94d8c0d8 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -85,6 +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.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.", diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index 1950e7c7935..c2a5349ff2a 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -600,8 +600,11 @@ 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(); + this.mergeGroup.hideWhenEmpty = true; - this.indexGroup.hideWhenEmpty = true; this.disposables.push(this.mergeGroup); this.disposables.push(this.indexGroup); @@ -712,6 +715,12 @@ 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('showStagedChangesResourceGroup'); + this.indexGroup.hideWhenEmpty = !gitShowStagedChangesResourceGroup; + } + @throttle async status(): Promise { await this.run(Operation.Status);