add isPreview and group reference to tab

This commit is contained in:
Logan Ramos
2022-03-18 14:15:16 -04:00
parent 1b6d264067
commit e2ce6d92a9
7 changed files with 58 additions and 29 deletions

View File

@@ -672,12 +672,12 @@ export interface IEditorTabGroupDto {
export interface IEditorTabDto {
id: string;
viewColumn: EditorGroupColumn;
label: string;
input: AnyInputDto;
editorId?: string;
isActive: boolean;
isPinned: boolean;
isPreview: boolean;
isDirty: boolean;
}

View File

@@ -25,10 +25,12 @@ class ExtHostEditorTab {
private _apiObject: vscode.Tab | undefined;
private _dto!: IEditorTabDto;
private _input: AnyTabInput | undefined;
private _parentGroup: ExtHostEditorTabGroup;
private readonly _activeTabIdGetter: () => string;
constructor(dto: IEditorTabDto, activeTabIdGetter: () => string) {
constructor(dto: IEditorTabDto, parentGroup: ExtHostEditorTabGroup, activeTabIdGetter: () => string) {
this._activeTabIdGetter = activeTabIdGetter;
this._parentGroup = parentGroup;
this.acceptDtoUpdate(dto);
}
@@ -53,8 +55,11 @@ class ExtHostEditorTab {
get isPinned() {
return that._dto.isDirty;
},
get viewColumn() {
return typeConverters.ViewColumn.to(that._dto.viewColumn);
get isPreview() {
return that._dto.isPreview;
},
get parentGroup() {
return that._parentGroup.apiObject;
}
};
this._apiObject = Object.freeze<vscode.Tab>(obj);
@@ -105,7 +110,7 @@ class ExtHostEditorTabGroup {
if (tabDto.isActive) {
this._activeTabId = tabDto.id;
}
this._tabs.push(new ExtHostEditorTab(tabDto, () => this.activeTabId()));
this._tabs.push(new ExtHostEditorTab(tabDto, this, () => this.activeTabId()));
}
}