Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCM - incoming/outgoing improve state management #198132

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/vs/workbench/contrib/scm/browser/scmViewPane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2421,11 +2421,12 @@ export class SCMViewPane extends ViewPane {
Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.providerCountBadge'), this.disposables)(updateProviderCountVisibility, this, this.disposables);
updateProviderCountVisibility();

this.createTree(this.treeContainer);
const viewState = this.loadTreeViewState();
this.createTree(this.treeContainer, viewState);

this.onDidChangeBodyVisibility(async visible => {
if (visible) {
await this.tree.setInput(this.scmViewService, this.loadTreeViewState());
await this.tree.setInput(this.scmViewService, viewState);

const onDidChangeConfiguration = (e?: IConfigurationChangeEvent) => {
if (!e || e.affectsConfiguration('scm.showActionButton') || e.affectsConfiguration('scm.alwaysShowRepositories') || e.affectsConfiguration('scm.experimental.showSyncInformation')) {
Expand Down Expand Up @@ -2467,7 +2468,7 @@ export class SCMViewPane extends ViewPane {
this.updateIndentStyles(this.themeService.getFileIconTheme());
}

private createTree(container: HTMLElement): void {
private createTree(container: HTMLElement, viewState?: IAsyncDataTreeViewState): void {
const overflowWidgetsDomNode = $('.scm-overflow-widgets-container.monaco-editor');

this.inputRenderer = this.instantiationService.createInstance(InputRenderer, this.layoutCache, overflowWidgetsDomNode, (input, height) => { this.tree.updateElementHeight(input, height); });
Expand Down Expand Up @@ -2510,7 +2511,15 @@ export class SCMViewPane extends ViewPane {
overrideStyles: {
listBackground: this.viewDescriptorService.getViewLocationById(this.id) === ViewContainerLocation.Panel ? PANEL_BACKGROUND : SIDE_BAR_BACKGROUND
},
collapseByDefault: (e: unknown) => isSCMHistoryItemGroupTreeElement(e) || isSCMHistoryItemTreeElement(e) || isSCMHistoryItemChangeTreeElement(e),
collapseByDefault: (e: unknown) => {
// Repository, Resource Group, Resource Folder (Tree), History Item Change Folder (Tree)
if (isSCMRepository(e) || isSCMResourceGroup(e) || isSCMResourceNode(e) || isSCMHistoryItemChangeNode(e)) {
return false;
}

// History Item Group, History Item, or History Item Change
return (viewState?.expanded ?? []).indexOf(getSCMResourceId(e as TreeElement)) === -1;
},
accessibilityProvider: this.instantiationService.createInstance(SCMAccessibilityProvider)
}) as WorkbenchCompressibleAsyncDataTree<ISCMViewService, TreeElement, FuzzyScore>;

Expand Down