🐞 Project Navigator should remember expanded folders
Description
When expanding folders in a nested file system from the Project Navigator, we should remember what folders are expanded.
To Reproduce
- Open a folder with a nested file system
- Below the root project folder (level 0), expand a folder from the root (level 1)
- Expand a child folder of level 1 (level 2)
- Collapse the previously expanded folder on level 1
- Expand the same level 1 folder
- Notice that the previously expanded level 2 folder under the level 1 folder is no longer expanded.
Expected Behavior
After collapsing a folder containing expanded folders, upon re-expanding it, the previously expanded child folders should still be expanded. We should keep track of and remember expanded state.
Version Information
CodeEdit: 0.0.3-alpha
Screenshots
https://github.com/CodeEditApp/CodeEdit/assets/806104/f401e79a-a7e8-4577-963f-055c0191bb3b
@austincondiff I would like to work on this issue. Could you please assign it to me?
I would like to this as option. See an example from IntelliJ below
Seems like a good idea to have it as an option in the navigation settings. Although I believe it is a default behaviour in xcode.
Sure, make it default behavior. But we try to keep in mind that just because Xcode does something a certain way, doesn't mean it's the best
- Open a folder with a nested file system
- Below the root project folder (level 0), expand a folder from the root (level 1)
- Expand a child folder of level 1 (level 2)
- Collapse the previously expanded folder on level 1
- Expand the same level 1 folder
- Notice that the previously expanded level 2 folder under the level 1 folder is no longer expanded.
I followed these steps but I failed to reproduce this issue on the main branch. I installed the alpha release v0.0.3 and still couldn't reproduce it. Behaviour for me was same as the expected behaviour.
I would like to this as option. See an example from IntelliJ below
@matthijseikelenboom While I couldn't reproduce the issue, I'm still working on adding the option in the Navigation settings and letting users choose the behaviour themselves.
@smishralm10 could you reproduce it on a local build though?
@austincondiff No, I could not. The expanded children folders were maintaining their expanded state after parent folder was collapsed and expanded again.
Okay, I'm able to reproduce the issue but the behaviour is slightly different for me. So, the child folders don't collapse when I'm present on the CodeEdit window but as soon as I switch to another window (using cmd + tab or left-mouse) and come back to CodeEdit window the folders are no longer expanded.
The behaviour is clear in the video below.
https://github.com/CodeEditApp/CodeEdit/assets/32999485/0c3621d9-bd3b-497b-9e0f-9693ddd290e8
I'm looking into this.
@smishralm10 have you found anything out about this?
This one is trickier than I thought it would be. Initially, looking at the original behaviour, I thought itemForPersistentObject and persistentObjectForItem might not be implemented correctly. However, while investigating, I found that expanded state of children are saved and restored correctly. Closing and reopening the window restores the expanded state as well.
Children are not expanded again when the focus of the window is changed, which is a weird behaviour. I looked around, but couldn't figure out why was this happening.
Later, I wasn't able to work on this issue because of my day job but will look into it this week.
I notice that closing the window and reopening retains this state, but changing icon tabs does not,
Closing because after testing, I notice that this is working as expected now.