CodeEdit
CodeEdit copied to clipboard
🐞 When the first tab is closed no tab is active
Description
When the user closes the first tab and other tabs exist after it, no other tab is selected and editor area is empty.
To Reproduce
- Open three tabs.
- Click to select the left-most tab.
- Close this tab
- Notice that no tab is selected and editor area is empty.
Expected behavior
After closing the first tab, second (now first) tab should be selected.
Screen Recording
https://user-images.githubusercontent.com/806104/213084164-e4099941-e572-406d-b8ce-b1c8fab628cc.mov
Documenting some of my sleuthing from discord, for posterity.
I'm looking at this tab closing issue... and noticing something worrying. when I breakpoint at the moment a tab is closed, I'm seeing that selectionState.openedTabs is showing a file that I have not opened at any point.

po selectionState.openedTabs
▿ 4 elements
▿ 0 : TabBarItemID
- codeEditor : "/Users/XXX/projects/faceswap/.readthedocs.yml"
▿ 1 : TabBarItemID
- codeEditor : "/Users/XXX/projects/faceswap/setup.py"
▿ 2 : TabBarItemID
- codeEditor : "/Users/XXX/projects/faceswap/tools.py"
▿ 3 : TabBarItemID
- codeEditor : "/Users/XXX/projects/faceswap/update_deps.py"
It looks like CodeEdit is correctly saving the openedTabs
array when saving the workspace state. However, the tab bar uses the getItemByTab(id: TabBarItemID)
method to fetch tabs. This means that after closing and re-opening the workspace all files are closed but the tabs are marked as still open.
That also explains the original issue, there's a tab that's in the openedTabs
array but isn't opened in the openFileItems
array, so the tab bar doesn't display it when it becomes selected.
@austincondiff are you able to recreate this on main branch?
https://user-images.githubusercontent.com/8212554/220164847-9e1abba5-6003-41ba-a6e7-b53850bac4bd.mp4
@Code-DJ In the latest release, I am able to reproduce it.
https://user-images.githubusercontent.com/806104/220169804-7505096c-7c95-46ba-bbd3-71b332d8349b.mp4
Update: in main I am not able to reproduce.
Closing, because we are not able to reproduce.