Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retain the tree expansion state after tree refresh #39505

Closed
sandy081 opened this issue Dec 3, 2017 · 4 comments
Closed

Retain the tree expansion state after tree refresh #39505

sandy081 opened this issue Dec 3, 2017 · 4 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority tree-views Extension tree view issues verified Verification succeeded
Milestone

Comments

@sandy081
Copy link
Member

sandy081 commented Dec 3, 2017

To reproduce

  • Install the jsonOutline extension (Clone it, build it and link it in extensions folder)
  • Open any json file, that will show the json outline view
  • Expand and collapse some nodes
  • Refresh the complete outline / or any node

Expected: Expansion states are preserved.
Observed: Expansion states are reset to initial state.

kapture 2017-12-03 at 20 16 39

@sandy081 sandy081 self-assigned this Dec 3, 2017
@sandy081 sandy081 added bug Issue identified by VS Code Team member as probable bug tree-views Extension tree view issues important Issue identified as high-priority labels Dec 3, 2017
@sandy081 sandy081 added this to the November 2017 milestone Dec 3, 2017
@sandy081
Copy link
Member Author

sandy081 commented Dec 3, 2017

Fixed by cb926d5

kapture 2017-12-03 at 20 13 06

@sandy081 sandy081 closed this as completed Dec 3, 2017
@letmaik
Copy link
Member

letmaik commented Dec 3, 2017

To clarify, how are two tree items before and after a refresh matched up to determine that they are the same? It seems each item has a string ID constructed from the tree path.
So:

a
  - b
  - c

Where a has an ID of 0/0:a and a/b has 0/0:a/0:b. However, if I had the following updated tree:

a/0:b
b
  - c

Then the first tree item would likely also have the ID previously assigned to a/b: 0/0:a/0:b. Or is there some escaping going on? I know, it is an artificial example and probably no tree item ever will have such a weird label.
I'm not saying this is an issue, just trying to understand it and find corner cases that may blow up something.

@sandy081
Copy link
Member Author

sandy081 commented Dec 3, 2017

@letmaik Good point. There is no escaping happening. Had similar assumption that this is not a practical scenario. But do not like to leave this case open. Will do the escaping.

@octref octref added the verified Verification succeeded label Dec 6, 2017
@weinand
Copy link
Contributor

weinand commented Dec 14, 2017

@letmaik I have similar issue with IDs because in my case tree node labels (and hence IDs) change dynamically. Please find a workaround in #40018 (comment). This approach could cover your case as well.

I'd recommend to fix the custom tree by never using the node's label as an ID. Instead assign unique and unchangeable IDs to the TreeItems.

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority tree-views Extension tree view issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants