diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 5837d44b84a..0c815176d6b 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -2233,7 +2233,12 @@ declare module 'vscode' { readonly label: string; /** - * The position of the tab + * The index of the tab within the column + */ + readonly index: number; + + /** + * The column which the tab belongs to */ readonly viewColumn: ViewColumn; @@ -2250,6 +2255,13 @@ declare module 'vscode' { */ readonly viewId?: string; + /** + * All the resources and viewIds represented by a tab + * {@link Tab.resource resource} and {@link Tab.viewId viewId} will + * always be at index 0. + */ + additionalResourcesAndViewIds?: { resource: Uri, viewId: string }[]; + /** * Whether or not the tab is currently active * Dictated by being the selected tab in the active group diff --git a/src/vs/workbench/api/common/extHostEditorTabs.ts b/src/vs/workbench/api/common/extHostEditorTabs.ts index e44e5d04fdf..d2c2e2a5554 100644 --- a/src/vs/workbench/api/common/extHostEditorTabs.ts +++ b/src/vs/workbench/api/common/extHostEditorTabs.ts @@ -14,6 +14,7 @@ import { ViewColumn } from 'vs/workbench/api/common/extHostTypes'; export interface IEditorTab { label: string; viewColumn: ViewColumn; + index: number; resource?: vscode.Uri; viewId?: string; isActive: boolean; @@ -58,12 +59,15 @@ export class ExtHostEditorTabs implements IExtHostEditorTabs { return Object.freeze({ label: dto.label, viewColumn: typeConverters.ViewColumn.to(dto.viewColumn), + index, resource: URI.revive(dto.resource), viewId: dto.editorId, isActive: dto.isActive }); }); - this._tabs = this._tabs.sort((t1, t2) => t1.viewColumn - t2.viewColumn); + this._tabs = this._tabs.sort((t1, t2) => { + return t1.viewColumn === t2.viewColumn ? t1.index - t2.index : t1.viewColumn - t2.viewColumn; + }); const oldActiveTab = this._activeTab; this._activeTab = activeIndex === -1 ? undefined : this._tabs[activeIndex]; if (this._activeTab !== oldActiveTab) {