mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 05:51:32 +01:00
Fix #145684
This commit is contained in:
@@ -11,6 +11,7 @@ import { Emitter } from 'vs/base/common/event';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { CustomEditorTabInput, NotebookDiffEditorTabInput, NotebookEditorTabInput, TerminalEditorTabInput, TextDiffTabInput, TextTabInput, ViewColumn, WebviewEditorTabInput } from 'vs/workbench/api/common/extHostTypes';
|
||||
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
|
||||
import { assertIsDefined } from 'vs/base/common/types';
|
||||
|
||||
export interface IExtHostEditorTabs extends IExtHostEditorTabsShape {
|
||||
readonly _serviceBrand: undefined;
|
||||
@@ -178,9 +179,10 @@ export class ExtHostEditorTabs implements IExtHostEditorTabs {
|
||||
private readonly _proxy: MainThreadEditorTabsShape;
|
||||
private readonly _onDidChangeTab = new Emitter<vscode.Tab>();
|
||||
private readonly _onDidChangeTabGroup = new Emitter<void>();
|
||||
private readonly _onDidChangeActiveTabGroup = new Emitter<vscode.TabGroup | undefined>();
|
||||
private readonly _onDidChangeActiveTabGroup = new Emitter<vscode.TabGroup>();
|
||||
|
||||
private _activeGroupId: number | undefined;
|
||||
// Have to use ! because this gets initialized via an RPC proxy
|
||||
private _activeGroupId!: number;
|
||||
|
||||
private _extHostTabGroups: ExtHostEditorTabGroup[] = [];
|
||||
|
||||
@@ -204,10 +206,8 @@ export class ExtHostEditorTabs implements IExtHostEditorTabs {
|
||||
},
|
||||
get activeTabGroup() {
|
||||
const activeTabGroupId = that._activeGroupId;
|
||||
if (activeTabGroupId === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
return that._extHostTabGroups.find(candidate => candidate.groupId === activeTabGroupId)?.apiObject;
|
||||
const activeTabGroup = assertIsDefined(that._extHostTabGroups.find(candidate => candidate.groupId === activeTabGroupId)?.apiObject);
|
||||
return activeTabGroup;
|
||||
},
|
||||
close: async (tab: vscode.Tab | vscode.Tab[], preserveFocus?: boolean) => {
|
||||
const tabs = Array.isArray(tab) ? tab : [tab];
|
||||
@@ -255,8 +255,8 @@ export class ExtHostEditorTabs implements IExtHostEditorTabs {
|
||||
});
|
||||
|
||||
// Set the active tab group id
|
||||
const activeTabGroupId = tabGroups.find(group => group.isActive === true)?.groupId;
|
||||
if (this._activeGroupId !== activeTabGroupId) {
|
||||
const activeTabGroupId = assertIsDefined(tabGroups.find(group => group.isActive === true)?.groupId);
|
||||
if (activeTabGroupId !== undefined && this._activeGroupId !== activeTabGroupId) {
|
||||
this._activeGroupId = activeTabGroupId;
|
||||
this._onDidChangeActiveTabGroup.fire(this.tabGroups.activeTabGroup);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user