This commit is contained in:
Logan Ramos 2022-03-15 09:55:57 -04:00
parent 037fd05f03
commit ed5a545047
No known key found for this signature in database
GPG key ID: D9CCFF14F0B18183
5 changed files with 8 additions and 11 deletions

View file

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

View file

@ -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
}

View file

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

View file

@ -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;
}
});

View file

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