Skip to content

Commit

Permalink
revert index tree twistie changes (#201789)
Browse files Browse the repository at this point in the history
* Revert "Tree - revert options propagation (#199755)"

This reverts commit 5dab501.

* Revert "update collapsible when children change"

This reverts commit a8dd7f6.
  • Loading branch information
joaomoreno committed Jan 4, 2024
1 parent e2eb6c0 commit 907fef5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 38 deletions.
4 changes: 2 additions & 2 deletions src/vs/base/browser/ui/tree/asyncDataTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ export class CompressibleAsyncDataTree<TInput, T, TFilterData = void> extends As
return { focus, selection, expanded, scrollTop: this.scrollTop };
}

protected override render(node: IAsyncDataTreeNode<TInput, T>, viewStateContext?: IAsyncDataTreeViewStateContext<TInput, T>): void {
protected override render(node: IAsyncDataTreeNode<TInput, T>, viewStateContext?: IAsyncDataTreeViewStateContext<TInput, T>, options?: IAsyncDataTreeUpdateChildrenOptions<T>): void {
if (!this.identityProvider) {
return super.render(node, viewStateContext);
}
Expand Down Expand Up @@ -1316,7 +1316,7 @@ export class CompressibleAsyncDataTree<TInput, T, TFilterData = void> extends As
const oldSelection = getUncompressedIds(this.tree.getSelection() as IAsyncDataTreeNode<TInput, T>[]);
const oldFocus = getUncompressedIds(this.tree.getFocus() as IAsyncDataTreeNode<TInput, T>[]);

super.render(node, viewStateContext);
super.render(node, viewStateContext, options);

const selection = this.getSelection();
let didChangeSelection = false;
Expand Down
6 changes: 0 additions & 6 deletions src/vs/base/browser/ui/tree/indexTreeModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ export class IndexTreeModel<T extends Exclude<any, undefined>, TFilterData = voi
const nodesToInsertIterator = Iterable.map(toInsert, el => this.createTreeNode(el, parentNode, parentNode.visible ? TreeVisibility.Visible : TreeVisibility.Hidden, revealed, treeListElementsToInsert, onDidCreateNode));

const lastIndex = location[location.length - 1];
const lastHadChildren = parentNode.children.length > 0;

// figure out what's the visible child start index right before the
// splice point
Expand Down Expand Up @@ -317,11 +316,6 @@ export class IndexTreeModel<T extends Exclude<any, undefined>, TFilterData = voi

this._onDidSplice.fire({ insertedNodes: nodesToInsert, deletedNodes });

const currentlyHasChildren = parentNode.children.length > 0;
if (lastHadChildren !== currentlyHasChildren) {
this.setCollapsible(location.slice(0, -1), currentlyHasChildren);
}

let node: IIndexTreeNode<T, TFilterData> | undefined = parentNode;

while (node) {
Expand Down
30 changes: 0 additions & 30 deletions src/vs/base/test/browser/ui/tree/indexTreeModel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,36 +313,6 @@ suite('IndexTreeModel', () => {
assert.deepStrictEqual(list[2].depth, 1);
}));

test('updates collapsible', () => withSmartSplice(options => {
const list: ITreeNode<number>[] = [];
const model = new IndexTreeModel<number>('test', toList(list), -1);

model.splice([0], 0, [
{
element: 0, children: [
{ element: 1 },
]
},
], options);

assert.strictEqual(list[0].collapsible, true);
assert.strictEqual(list[1].collapsible, false);

model.splice([0, 0], 1, [], options);
{
const [first, second] = list;
assert.strictEqual(first.collapsible, false);
assert.strictEqual(second, undefined);
}

model.splice([0, 0], 0, [{ element: 1 }], options);
{
const [first, second] = list;
assert.strictEqual(first.collapsible, true);
assert.strictEqual(second.collapsible, false);
}
}));

test('expand', () => withSmartSplice(options => {
const list: ITreeNode<number>[] = [];
const model = new IndexTreeModel<number>('test', toList(list), -1);
Expand Down

0 comments on commit 907fef5

Please sign in to comment.