mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Fix #145111
This commit is contained in:
parent
037fd05f03
commit
ed5a545047
|
@ -1287,7 +1287,7 @@ export class Repository implements Disposable {
|
|||
t.additionalResourcesAndViewTypes.find(r => r.resource!.scheme === 'git')));
|
||||
|
||||
// Close editors
|
||||
diffEditorTabsToClose.forEach(t => t.close());
|
||||
diffEditorTabsToClose.forEach(t => t.close(false));
|
||||
}
|
||||
|
||||
async branch(name: string, _checkout: boolean, _ref?: string): Promise<void> {
|
||||
|
|
|
@ -349,7 +349,7 @@ export class MainThreadEditorTabs {
|
|||
return;
|
||||
}
|
||||
|
||||
async $closeTab(tab: IEditorTabDto): Promise<void> {
|
||||
async $closeTab(tab: IEditorTabDto, preserveFocus: boolean): Promise<void> {
|
||||
const group = this._editorGroupsService.getGroup(columnToEditorGroup(this._editorGroupsService, tab.viewColumn));
|
||||
if (!group) {
|
||||
return;
|
||||
|
@ -359,7 +359,7 @@ export class MainThreadEditorTabs {
|
|||
if (!editor) {
|
||||
return;
|
||||
}
|
||||
await group.closeEditor(editor);
|
||||
await group.closeEditor(editor, { preserveFocus });
|
||||
}
|
||||
//#endregion
|
||||
}
|
||||
|
|
|
@ -612,7 +612,7 @@ export interface ExtHostEditorInsetsShape {
|
|||
export interface MainThreadEditorTabsShape extends IDisposable {
|
||||
// manage tabs: move, close, rearrange etc
|
||||
$moveTab(tab: IEditorTabDto, index: number, viewColumn: EditorGroupColumn): void;
|
||||
$closeTab(tab: IEditorTabDto): Promise<void>;
|
||||
$closeTab(tab: IEditorTabDto, preserveFocus: boolean): Promise<void>;
|
||||
}
|
||||
|
||||
export interface IEditorTabGroupDto {
|
||||
|
|
|
@ -22,7 +22,7 @@ export interface IEditorTab {
|
|||
isDirty: boolean;
|
||||
additionalResourcesAndViewTypes: { resource: vscode.Uri | undefined; viewType: string | undefined }[];
|
||||
move(index: number, viewColumn: ViewColumn): Promise<void>;
|
||||
close(): Promise<void>;
|
||||
close(preserveFocus: boolean): Promise<void>;
|
||||
}
|
||||
|
||||
export interface IEditorTabGroup {
|
||||
|
@ -122,13 +122,11 @@ export class ExtHostEditorTabs implements IExtHostEditorTabs {
|
|||
move: async (index: number, viewColumn: ViewColumn) => {
|
||||
this._proxy.$moveTab(tabDto, index, typeConverters.ViewColumn.from(viewColumn));
|
||||
// TODO: Need an on did change tab event at the group level
|
||||
// await raceTimeout(Event.toPromise(this._onDidChangeTabs.event), 1000);
|
||||
return;
|
||||
},
|
||||
close: async () => {
|
||||
await this._proxy.$closeTab(tabDto);
|
||||
close: async (preserveFocus) => {
|
||||
await this._proxy.$closeTab(tabDto, preserveFocus);
|
||||
// TODO: Need an on did change tab event at the group level
|
||||
// await raceTimeout(Event.toPromise(this._onDidChangeTabs.event), 1000);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
|
3
src/vscode-dts/vscode.proposed.tabs.d.ts
vendored
3
src/vscode-dts/vscode.proposed.tabs.d.ts
vendored
|
@ -87,8 +87,7 @@ declare module 'vscode' {
|
|||
* should no longer be used for further actions.
|
||||
*/
|
||||
// TODO@API move into TabGroups, support one or many tabs or tab groups
|
||||
// TODO@API add `preserveFocus`
|
||||
close(): Thenable<void>;
|
||||
close(preserveFocus: boolean): Thenable<void>;
|
||||
}
|
||||
|
||||
export namespace window {
|
||||
|
|
Loading…
Reference in a new issue