Add index to tab

This commit is contained in:
Logan Ramos
2021-09-21 14:27:27 -04:00
parent 356ce71231
commit f713624feb
2 changed files with 18 additions and 2 deletions

View File

@@ -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) {