vscode-restore-git-branch-tabs icon indicating copy to clipboard operation
vscode-restore-git-branch-tabs copied to clipboard

Does restore tabs in same order

Open mfp22 opened this issue 5 years ago • 4 comments

When you switch between branches with multiple tabs (6+) open in each, it doesn't open them in the same order they were last time you had that branch checked out.

If it were a tradeoff between retaining the tab order and taking twice as long to open the tabs, I would rather retain the order.

mfp22 avatar Dec 12 '19 19:12 mfp22

I am not sure if this is possible with the current API. But I agree, I like keeping the order of the tabs. I will try to look into this.

gkotas avatar Dec 13 '19 14:12 gkotas

@gkotas any progress on this? I just found the extension and it's great, but this is kinda a deal-breaker for me

dkniffin avatar Mar 19 '21 21:03 dkniffin

I ended up digging into this on my own for a bit to see if I could figure it out. I pretty quickly found that DocumentManager#open is what will likely need to be updated to accomplish this.

The difficulty is that VSCode's API doesn't seem to have (afaict) a reliable way to get the editor grid data. There's ViewColumn, but I have no idea how that works. The docs are not very helpful. It gives a number, but it doesn't seem to have any concept of the 2d grid or the editor sizes.

Also worth noting, there's an open GH issue for a new "Open Editors" API. Maybe that would provide what we need for this, but I'm not sure.

dkniffin avatar Mar 19 '21 22:03 dkniffin

Just an update here: it looks like that GH issue was resolved, so I think this feature could be implemented now! Maybe if I get annoyed enough, I'll dig into it myself, but if anyone else gets the chance first, go for it.

The docs for the new API are here: https://code.visualstudio.com/api/references/vscode-api#TabInputText

dkniffin avatar Dec 22 '22 20:12 dkniffin