iulianraduat / save-restore-editors

A Visual Studio Code extension for saving and restoring all opened text editors
GNU General Public License v3.0
12 stars 1 forks source link

The order of tabs. #3

Closed seabye closed 1 year ago

seabye commented 2 years ago

Save multiple groups of tabs and then turn off all tabs. The order of restoration is different from the order of preservation.I need it the same, but it is random.

iulianraduat commented 2 years ago

Hi @seabye,

I tried to replicate your problem and the tab groups are saved and restored in correct order.

VSCode keeps a list of viewColumn in which are one or more tabs. These columns are numbered started with 1 and from top to bottom, left to right. So if there are 3 columns and 2 rows, with the second column taking both rows, the viewColumn 1 is top-left, the viewColumn 2 is bottom-left, viewColumn 3 is in the middle, viewColumn 4 is top-right and viewColumn 5 is bottom-right. At restore time, VSCode will recreate them in a single row.

Taking into account that at the save time there can be a different editor layout than at the restore time and that VSCode provides a command to set a layout but no API to read its current editor layout, it makes sense to do not force the old editor layout (maybe except when there is no viewColumns).

When you say random I expect that each time you have the tabs restored they are different than the last time you restored them.

I hope that this clarified the way VSCode and this extensions works.

Cheers, Iulian

seabye commented 2 years ago

@iulian-radu-at

save:

order

two open: 1 2 one: 1 two: 2

The order of saving is correct.

The recovery will be 80% correct, but partially incorrect, and errors may appear anywhere before or after.

I've tried turning off all other extensions, nothing to do with other extensions.

I'm guessing that the reason for the difference from your test results may be computer performance. Or folder depth.

From the perspective of the interface display process, it seems that it is not completely from left to right, from top to bottom.

Execution environment:

macOS: 10.14.6 macOS: 12.6

vsCode: 1.72.2 2022-10-12

ArturoDent commented 1 year ago

There is now a vscode.getLayout() command:

getLayout(): EditorGroupLayout {

// Example return value: // { orientation: 0, groups: [ { groups: [ { size: 0.4 }, { size: 0.6 } ], size: 0.5 }, { groups: [ {}, {} ], size: 0.5 } ] }

const layout = await vscode.commands.executeCommand('vscode.getEditorLayout');
iulianraduat commented 1 year ago

https://github.com/microsoft/vscode/blob/main/src/vs/workbench/browser/parts/editor/editorCommands.ts#L300

seabye commented 1 year ago

Before it can be recovered as I need. I use it to save the open tab and recover the tab with the row script of the command line. It can ensure that it is opened with VSCode one by one in order.

But this clumsy method can only restore the tabs in the same group.

iulianraduat commented 1 year ago

This issue should be fixed with version 1.4.0.

Please install and check it and provide feedback if it works as expected.

Thanks, Iulian

iulianraduat commented 1 year ago

Closed as no response from issuer

seabye commented 1 year ago

@iulian-radu-at No 1.5 is still the same. I found a plug -in called 'Restore Editors' in the store, which can be restored quickly in the correct order. It's just that it cannot be exported... What will cause it that it cannot be repaired: Only one label group is still unable to recover in order. I tried this in multiple operating systems.

Restore Editors v1.0.1 ✓ Sep-18-2023 11-04-35

Save and restore tabs v1.5.0 Sep-18-2023 11-04-54