Skip to content

Commit

Permalink
data tree view state should store scrollTop, #74410
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Jun 21, 2019
1 parent 94e7cd9 commit 59e2699
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/vs/base/browser/ui/tree/dataTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface IDataTreeViewState {
readonly focus: string[];
readonly selection: string[];
readonly expanded: string[];
readonly scrollTop: number;
}

export class DataTree<TInput, T, TFilterData = void> extends AbstractTree<T | null, TFilterData, T | null> {
Expand Down Expand Up @@ -80,6 +81,10 @@ export class DataTree<TInput, T, TFilterData = void> extends AbstractTree<T | nu
this._refresh(input, isCollapsed, onDidCreateNode);
this.setFocus(focus);
this.setSelection(selection);

if (viewState && typeof viewState.scrollTop === 'number') {
this.scrollTop = viewState.scrollTop;
}
}

updateChildren(element: TInput | T = this.input!): void {
Expand Down Expand Up @@ -193,6 +198,6 @@ export class DataTree<TInput, T, TFilterData = void> extends AbstractTree<T | nu
queue.push(...node.children);
}

return { focus, selection, expanded };
return { focus, selection, expanded, scrollTop: this.scrollTop };
}
}

0 comments on commit 59e2699

Please sign in to comment.