From c4e58cc9f21678e39c9a9ca6c345b18df1b31393 Mon Sep 17 00:00:00 2001 From: linhsu0723 Date: Mon, 30 Oct 2023 01:03:36 +0800 Subject: [PATCH] Preserve tab order --- src/editorGroupTreeDataProvider.ts | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/editorGroupTreeDataProvider.ts b/src/editorGroupTreeDataProvider.ts index 37b70df..3152016 100644 --- a/src/editorGroupTreeDataProvider.ts +++ b/src/editorGroupTreeDataProvider.ts @@ -6,7 +6,7 @@ import { EditorGroup } from './editorGroup'; export class EditorGroupTreeDataProvider implements vscode.TreeDataProvider { private _onDidChangeTreeData: vscode.EventEmitter = new vscode.EventEmitter(); readonly onDidChangeTreeData: vscode.Event = this._onDidChangeTreeData.event; - + context: vscode.ExtensionContext; constructor(cont: vscode.ExtensionContext) { @@ -31,17 +31,17 @@ export class EditorGroupTreeDataProvider implements vscode.TreeDataProvider>('minimizedGroups'); const primed = minimizedGroups?.map((group) => { const documents = group.documents?.map(({ document, viewColumn }) => new EditorDocument(document, viewColumn)); return new EditorGroup( - group.label, - vscode.TreeItemCollapsibleState.Collapsed, + group.label, + vscode.TreeItemCollapsibleState.Collapsed, documents, ); }); - + return this.context.workspaceState.update('minimizedGroups', primed) .then(() => primed); } @@ -67,6 +67,8 @@ export class EditorGroupTreeDataProvider implements vscode.TreeDataProvider { const documents: EditorDocument[] = []; const minimizedGroups = this.context.workspaceState.get>('minimizedGroups') || []; + await vscode.commands.executeCommand('workbench.action.openEditorAtIndex1'); + await vscode.commands.executeCommand('workbench.files.action.focusOpenEditorsView'); let activeTextEditor = vscode.window.activeTextEditor; let pinnedCheck = activeTextEditor; @@ -74,10 +76,8 @@ export class EditorGroupTreeDataProvider implements vscode.TreeDataProvider