index tree: prevent root from changing collapse state

This commit is contained in:
Joao Moreno 2019-09-06 17:44:25 +02:00
parent 174c9c69ec
commit 8a9f89c285

View file

@ -276,11 +276,15 @@ export class IndexTreeModel<T extends Exclude<any, undefined>, TFilterData = voi
private _setNodeCollapseState(node: IMutableTreeNode<T, TFilterData>, collapsible: boolean, collapsed: boolean, recursive: boolean, deep: boolean): boolean { private _setNodeCollapseState(node: IMutableTreeNode<T, TFilterData>, collapsible: boolean, collapsed: boolean, recursive: boolean, deep: boolean): boolean {
let result = node.collapsible !== collapsible || node.collapsed !== collapsed; let result = node.collapsible !== collapsible || node.collapsed !== collapsed;
node.collapsible = collapsible; if (node === this.root) {
node.collapsed = collapsed; result = false;
} else {
node.collapsible = collapsible;
node.collapsed = collapsed;
if (result) { if (result) {
this._onDidChangeCollapseState.fire({ node, deep }); this._onDidChangeCollapseState.fire({ node, deep });
}
} }
if (recursive) { if (recursive) {