Open rroessler opened 4 months ago
Alongside this, triggering refreshes via "onDidChangeTreeData" causes the current scroll-state to reset to an initial position.
@rroessler do you know what the behavior in VS Code is?
@tsmaeder The original behaviour in VS Code is that when onDidChangeTreeData
is called with specific node as arguments, only those nodes are refreshed. This means that parent nodes would not be refreshed, maintaining their current expansion state.
Currently the Theia extension wrapper forces a refresh on the entire TreeView
widget. As such, nodes that may have been created with a collapsed state (eg: at getChildren
or getTreeItem
) but where then expanded before a refresh occurs, are all refreshed causing flickering/odd effects if refreshing occurs frequently.
Alongside this, the VS Code behaviour has the added bonus of being more efficient as only the nodes requested are refreshed, as opposed to the Theia implementation of refresh all from the root.
@rroessler just so we're talking about the same thing: the example extension you give refreshes the root of the tree, though, right?
@tsmaeder you are correct as the issue also arises from here too. The difference between the two behaviours stems from:
VS Code:
Theia:
@rroessler since you seem to know how what to do, would you be ready to contribute the fix?
@tsmaeder I will try my best to get a fix soon.
Bug Description:
In VSC extensions, whenever a refresh is requested by a
vscode.TreeDataProvider
, trees are refreshed to an "initialized" collapsible state instead of maintaining their current collapsible state.This is an issue for tree-views that show real-time data (eg: custom debugger panels) as refreshes will force all nodes to snap back to their original collapsible state.
Steps to Reproduce:
This issue can be reproduced by implementing a simple tree-view provider that refreshes every 5-seconds. If the root-node is clicked, anytime the interval fires the root-node will reset to the original collapsed state as opposed to adhering to the current expanded state.
Steps to Fix:
This could be fixed by adding a toggle for expanded and collapsed states of nodes at the following: