Skip to content

Commit

Permalink
SCM - 💄 code cleanup (#200977)
Browse files Browse the repository at this point in the history
  • Loading branch information
lszomoru authored Dec 15, 2023
1 parent a5698e8 commit 11cc162
Showing 1 changed file with 12 additions and 28 deletions.
40 changes: 12 additions & 28 deletions src/vs/workbench/contrib/scm/browser/scmViewPane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1060,12 +1060,8 @@ class SCMTreeCompressionDelegate implements ITreeCompressionDelegate<TreeElement
class SCMTreeFilter implements ITreeFilter<TreeElement> {

filter(element: TreeElement): boolean {
if (ResourceTree.isResourceNode(element)) {
return true;
} else if (isSCMResourceGroup(element)) {
if (isSCMResourceGroup(element)) {
return element.resources.length > 0 || !element.hideWhenEmpty;
} else if (isSCMViewSeparator(element)) {
return true;
} else {
return true;
}
Expand Down Expand Up @@ -3249,30 +3245,18 @@ class SCMTreeDataSource implements IAsyncDataSource<ISCMViewService, TreeElement

// Incoming/Outgoing Separator
if (historyItemGroups.length > 0) {
const showIncomingChanges = this.showIncomingChanges();
const showOutgoingChanges = this.showOutgoingChanges();
if (showIncomingChanges !== 'never' && showOutgoingChanges !== 'never') {
children.push({
label: localize('syncSeparatorHeader', "Incoming/Outgoing"),
ariaLabel: localize('syncSeparatorHeaderAriaLabel', "Incoming and outgoing changes"),
repository: inputOrElement,
type: 'separator'
} as SCMViewSeparatorElement);
} else if (showIncomingChanges === 'never') {
children.push({
label: localize('syncOutgoingSeparatorHeader', "Outgoing"),
ariaLabel: localize('syncOutgoingSeparatorHeaderAriaLabel', "Outgoing changes"),
repository: inputOrElement,
type: 'separator'
} as SCMViewSeparatorElement);
} else if (showOutgoingChanges === 'never') {
children.push({
label: localize('syncIncomingSeparatorHeader', "Incoming"),
ariaLabel: localize('syncIncomingSeparatorHeaderAriaLabel', "Incoming changes"),
repository: inputOrElement,
type: 'separator'
} as SCMViewSeparatorElement);
let label = localize('syncSeparatorHeader', "Incoming/Outgoing");
let ariaLabel = localize('syncSeparatorHeaderAriaLabel', "Incoming and outgoing changes");

if (this.showIncomingChanges() !== 'never' && this.showOutgoingChanges() === 'never') {
label = localize('syncIncomingSeparatorHeader', "Incoming");
ariaLabel = localize('syncIncomingSeparatorHeaderAriaLabel', "Incoming changes");
} else if (this.showIncomingChanges() === 'never' && this.showOutgoingChanges() !== 'never') {
label = localize('syncOutgoingSeparatorHeader', "Outgoing");
ariaLabel = localize('syncOutgoingSeparatorHeaderAriaLabel', "Outgoing changes");
}

children.push({ label, ariaLabel, repository: inputOrElement, type: 'separator' } as SCMViewSeparatorElement);
}

children.push(...historyItemGroups);
Expand Down

0 comments on commit 11cc162

Please sign in to comment.