vscode: [Extension Authoring] TreeDataProvider update doesn't cause update of collapsibleState of TreeItems
- VSCode Version: 1.25.0
- OS Version: Win10
Steps to Reproduce:
- Create
TreeDataProvider
- Put a
TreeItemCollapsibleState.Collapsed
TreeItem there and save a ref to it - Fire
TreeDataProvider#onDidChangeTreeData
Note:
as expected now there is a collapsedTreeItem
in theTreeDataProvider
- Change collapsibleState of the
TreeItem
to theTreeItemCollapsibleState.Expanded
via the stored ref - Fire
TreeDataProvider#onDidChangeTreeData
Expected result:
There is an expanded TreeItem
in the TreeDataProvider
Actual result:
There is a collapsed TreeItem
in the TreeDataProvider
Note 1:
It worked correctly in VSCode 1.24.0 but not in 1.25.0 for me
Note 2:
changing collapsibleState in the UI still works.
Note 3:
changing collapsibleState from TreeItemCollapsibleState.Expanded/Collapsed to TreeItemCollapsibleState.None works fine.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 3
- Comments: 16 (10 by maintainers)
There are plans to add an API to expand/collapse - https://github.com/Microsoft/vscode/issues/55879
.collapse
was never added on the view, so it’s currently impossible to collapse a single item!.reveal({expand:false})
does not work either.For example, try to implement toggle-expansion-on-select behavior to mimic the built-in explorer. Can track the real state using
onDid(Expand|Collapse)Element
, but can only set a new state of expanded, using.reveal({expand:true})
- impossible to set collapsed. Any workarounds appreciated. : )As mentioned earlier in this bug, updating an existing TreeItem’s
collapsibleState
has no effect.Current stable (1.31) and insiders (1.32).
Thanks!
I’m also having this problem.
I want to add a collapse/expand button to the navigation bar, but the only ways that I’ve found for actually collapsing/expanding the tree are:
The obvious solution would be just setting
TreeItem.collapsibleState
to something, which doesn’t work.Duplicate of #30918