mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
tabs - move move into TabGroups
This commit is contained in:
@@ -657,7 +657,7 @@ export type AnyInputDto = UnknownInputDto | TextInputDto | TextDiffInputDto | No
|
||||
|
||||
export interface MainThreadEditorTabsShape extends IDisposable {
|
||||
// manage tabs: move, close, rearrange etc
|
||||
$moveTab(tabId: string, index: number, viewColumn: EditorGroupColumn): void;
|
||||
$moveTab(tabId: string, index: number, viewColumn: EditorGroupColumn, preserveFocus?: boolean): void;
|
||||
$closeTab(tabIds: string[], preserveFocus?: boolean): Promise<void>;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,11 +25,9 @@ class ExtHostEditorTab {
|
||||
private _apiObject: vscode.Tab | undefined;
|
||||
private _dto!: IEditorTabDto;
|
||||
private _input: AnyTabInput | undefined;
|
||||
private readonly _proxy: MainThreadEditorTabsShape;
|
||||
private readonly _activeTabIdGetter: () => string;
|
||||
|
||||
constructor(dto: IEditorTabDto, proxy: MainThreadEditorTabsShape, activeTabIdGetter: () => string) {
|
||||
this._proxy = proxy;
|
||||
constructor(dto: IEditorTabDto, activeTabIdGetter: () => string) {
|
||||
this._activeTabIdGetter = activeTabIdGetter;
|
||||
this.acceptDtoUpdate(dto);
|
||||
}
|
||||
@@ -57,10 +55,6 @@ class ExtHostEditorTab {
|
||||
},
|
||||
get viewColumn() {
|
||||
return typeConverters.ViewColumn.to(that._dto.viewColumn);
|
||||
},
|
||||
move: async (index: number, viewColumn: ViewColumn) => {
|
||||
this._proxy.$moveTab(that._dto.id, index, typeConverters.ViewColumn.from(viewColumn));
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -110,7 +104,7 @@ class ExtHostEditorTabGroup {
|
||||
if (tabDto.isActive) {
|
||||
this._activeTabId = tabDto.id;
|
||||
}
|
||||
this._tabs.push(new ExtHostEditorTab(tabDto, proxy, () => this.activeTabId()));
|
||||
this._tabs.push(new ExtHostEditorTab(tabDto, () => this.activeTabId()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,6 +200,14 @@ class ExtHostTabGroups {
|
||||
}
|
||||
this._proxy.$closeTab(extHostTabIds, preserveFocus);
|
||||
return;
|
||||
},
|
||||
move: async (tab: vscode.Tab, viewColumn: ViewColumn, index: number, preservceFocus?: boolean) => {
|
||||
const extHostTab = this.findExtHostTabFromApi(tab);
|
||||
if (!extHostTab) {
|
||||
throw new Error('Invalid tab');
|
||||
}
|
||||
this._proxy.$moveTab(extHostTab.tabId, index, typeConverters.ViewColumn.from(viewColumn), preservceFocus);
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user