mirror of
https://github.com/Microsoft/vscode
synced 2024-09-18 01:58:27 +00:00
Fix #145828
This commit is contained in:
parent
fd7f35aa4c
commit
64f37bc300
|
@ -473,7 +473,7 @@ export class MainThreadEditorTabs implements MainThreadEditorTabsShape {
|
|||
return;
|
||||
}
|
||||
|
||||
async $closeTab(tabIds: string[], preserveFocus?: boolean): Promise<void> {
|
||||
async $closeTab(tabIds: string[], preserveFocus?: boolean): Promise<boolean> {
|
||||
const groups: Map<IEditorGroup, EditorInput[]> = new Map();
|
||||
for (const tabId of tabIds) {
|
||||
const tabInfo = this._tabInfoLookup.get(tabId);
|
||||
|
@ -492,9 +492,12 @@ export class MainThreadEditorTabs implements MainThreadEditorTabsShape {
|
|||
}
|
||||
}
|
||||
// Loop over keys of the groups map and call closeEditors
|
||||
let results: boolean[] = [];
|
||||
for (const [group, editors] of groups) {
|
||||
await group.closeEditors(editors, { preserveFocus });
|
||||
results.push(await group.closeEditors(editors, { preserveFocus }));
|
||||
}
|
||||
// TODO @jrieken This isn't quite right how can we say true for some but not others?
|
||||
return results.every(result => result);
|
||||
}
|
||||
//#endregion
|
||||
}
|
||||
|
|
|
@ -668,7 +668,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, preserveFocus?: boolean): void;
|
||||
$closeTab(tabIds: string[], preserveFocus?: boolean): Promise<void>;
|
||||
$closeTab(tabIds: string[], preserveFocus?: boolean): Promise<boolean>;
|
||||
}
|
||||
|
||||
export interface IEditorTabGroupDto {
|
||||
|
|
|
@ -219,8 +219,7 @@ export class ExtHostEditorTabs implements IExtHostEditorTabs {
|
|||
}
|
||||
extHostTabIds.push(extHostTab.tabId);
|
||||
}
|
||||
this._proxy.$closeTab(extHostTabIds, preserveFocus);
|
||||
return;
|
||||
return this._proxy.$closeTab(extHostTabIds, preserveFocus);
|
||||
},
|
||||
move: async (tab: vscode.Tab, viewColumn: ViewColumn, index: number, preservceFocus?: boolean) => {
|
||||
const extHostTab = this._findExtHostTabFromApi(tab);
|
||||
|
|
|
@ -350,6 +350,7 @@ suite('ExtHostEditorTabs', function () {
|
|||
// override/implement $moveTab or $closeTab
|
||||
override async $closeTab(tabIds: string[], preserveFocus?: boolean) {
|
||||
closedTabIds.push(tabIds);
|
||||
return true;
|
||||
}
|
||||
})
|
||||
);
|
||||
|
@ -387,6 +388,7 @@ suite('ExtHostEditorTabs', function () {
|
|||
// override/implement $moveTab or $closeTab
|
||||
override async $closeTab(tabIds: string[], preserveFocus?: boolean) {
|
||||
closedTabIds.push(tabIds);
|
||||
return true;
|
||||
}
|
||||
})
|
||||
);
|
||||
|
|
6
src/vscode-dts/vscode.proposed.tabs.d.ts
vendored
6
src/vscode-dts/vscode.proposed.tabs.d.ts
vendored
|
@ -157,9 +157,11 @@ declare module 'vscode' {
|
|||
* Note: In the case of a dirty tab, a confirmation dialog will be shown which may be cancelled. If cancelled the tab is still valid
|
||||
* @param tab The tab to close, must be reference equal to a tab given by the API
|
||||
* @param preserveFocus When `true` focus will remain in its current position. If `false` it will jump to the next tab.
|
||||
* @returns A promise that resolves true when then tab is closed. Otherwise it will return false.
|
||||
* If false is returned the tab is still valid.
|
||||
*/
|
||||
close(tab: Tab[], preserveFocus?: boolean): Thenable<void>;
|
||||
close(tab: Tab, preserveFocus?: boolean): Thenable<void>;
|
||||
close(tab: Tab[], preserveFocus?: boolean): Thenable<boolean>;
|
||||
close(tab: Tab, preserveFocus?: boolean): Thenable<boolean>;
|
||||
|
||||
/**
|
||||
* Moves a tab to the given index within the column.
|
||||
|
|
Loading…
Reference in a new issue