diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index 834fa4dcf47..72afa29eeea 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -758,7 +758,6 @@ export class Repository implements Disposable { onConfigListenerForInputBoxVisibility(updateInputBoxVisibility, this, this.disposables); updateInputBoxVisibility(); - this.workingTreeGroup.hideWhenEmpty = true; this.mergeGroup.hideWhenEmpty = true; this.untrackedGroup.hideWhenEmpty = true; diff --git a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts index 3789cfe32ef..25553a428e8 100644 --- a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts +++ b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts @@ -876,7 +876,7 @@ class ViewModel { item.disposable.dispose(); } - this.refresh(item); + this.refresh(); } private createGroupItem(group: ISCMResourceGroup): IGroupItem { @@ -899,7 +899,9 @@ class ViewModel { } private onDidSpliceGroup(item: IGroupItem, { start, deleteCount, toInsert }: ISplice): void { + const before = item.resources.length; const deleted = item.resources.splice(start, deleteCount, ...toInsert); + const after = item.resources.length; if (this._mode === ViewModelMode.Tree) { for (const resource of deleted) { @@ -911,8 +913,11 @@ class ViewModel { } } - // TODO@joao: this is here because we hide the input box when there are no changes - this.refresh(); + if (before !== after && (before === 0 || after === 0)) { + this.refresh(); + } else { + this.refresh(item); + } } setVisible(visible: boolean): void { @@ -948,13 +953,16 @@ class ViewModel { private render(item: IRepositoryItem | IGroupItem): ICompressedTreeElement { if (isRepositoryItem(item)) { const children: ICompressedTreeElement[] = []; + const hasSomeChanges = item.groupItems.some(item => item.element.elements.length > 0); - if (item.element.input.visible && item.groupItems.some(item => item.element.elements.length > 0)) { - children.push({ element: item.element.input, incompressible: true, collapsible: false }); + if (this.items.length === 1 || hasSomeChanges) { + if (item.element.input.visible) { + children.push({ element: item.element.input, incompressible: true, collapsible: false }); + } + + children.push(...item.groupItems.map(i => this.render(i))); } - children.push(...item.groupItems.map(i => this.render(i))); - return { element: item.element, children, incompressible: true, collapsible: true }; } else { const children = this.mode === ViewModelMode.List @@ -1372,12 +1380,9 @@ class SCMInputWidget extends Disposable { const dimension: Dimension = { width: this.element.clientWidth - 2, height: editorHeight, - // height: editorHeight - 2 }; - // templateData.input.layout(/* { height: editorHeight, width: this.layoutCache.width! - 12 - 2 - 2 } */); this.inputEditor.layout(dimension); - // this.validationContainer.style.top = `${dimension.height + 1}px`; } private getInputEditorFontFamily(): string {