提交 431567e9 编写于 作者: J Johannes Rieken

reset view state when direction changes

上级 5c4d58ee
......@@ -194,7 +194,7 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget {
addClass(treeContainer, 'tree');
container.appendChild(treeContainer);
const options: IAsyncDataTreeOptions<callHTree.Call, FuzzyScore> = {
identityProvider: new callHTree.IdentityProvider(),
identityProvider: new callHTree.IdentityProvider(() => this._direction),
ariaLabel: localize('tree.aria', "Call Hierarchy"),
expandOnlyOnTwistieClick: true,
};
......@@ -387,6 +387,7 @@ export class CallHierarchyTreePeekWidget extends PeekViewWidget {
if (this._direction !== newDirection) {
this._treeViewStates.set(this._direction, this._tree.getViewState());
this._direction = newDirection;
this._tree.setFocus([]);
this.showItem(item);
}
};
......
......@@ -86,8 +86,13 @@ export class SingleDirectionDataSource implements IAsyncDataSource<CallHierarchy
}
export class IdentityProvider implements IIdentityProvider<Call> {
constructor(
public getDirection: () => CallHierarchyDirection
) { }
getId(element: Call): { toString(): string; } {
return hash(element.item.uri.toString(), hash(JSON.stringify(element.item.range))).toString() + (element.parent ? this.getId(element.parent) : '');
return this.getDirection() + hash(element.item.uri.toString(), hash(JSON.stringify(element.item.range))).toString() + (element.parent ? this.getId(element.parent) : '');
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册