diff --git a/src/vs/workbench/api/common/extHostEditorTabs.ts b/src/vs/workbench/api/common/extHostEditorTabs.ts index e78cf61c04e..0d96283dab9 100644 --- a/src/vs/workbench/api/common/extHostEditorTabs.ts +++ b/src/vs/workbench/api/common/extHostEditorTabs.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type * as vscode from 'vscode'; +import * as vscode from 'vscode'; import * as typeConverters from 'vs/workbench/api/common/extHostTypeConverters'; import { IEditorTabDto, IEditorTabGroupDto, IExtHostEditorTabsShape, MainContext, MainThreadEditorTabsShape, TabInputKind } from 'vs/workbench/api/common/extHost.protocol'; import { URI } from 'vs/base/common/uri'; @@ -36,7 +36,7 @@ class ExtHostEditorTab { // Don't want to lose reference to parent `this` in the getters const that = this; if (!this._apiObject) { - this._apiObject = Object.freeze({ + const obj: vscode.Tab = { get isActive() { // We use a getter function here to always ensure at most 1 active tab per group and prevent iteration for being required return that._dto.id === that._activeTabIdGetter(); @@ -56,7 +56,8 @@ class ExtHostEditorTab { get viewColumn() { return typeConverters.ViewColumn.to(that._dto.viewColumn); } - }); + }; + this._apiObject = Object.freeze(obj); } return this._apiObject; } @@ -112,7 +113,7 @@ class ExtHostEditorTabGroup { // Don't want to lose reference to parent `this` in the getters const that = this; if (!this._apiObject) { - this._apiObject = Object.freeze({ + const obj: vscode.TabGroup = { get isActive() { // We use a getter function here to always ensure at most 1 active group and prevent iteration for being required return that._dto.groupId === that._activeGroupIdGetter(); @@ -124,9 +125,10 @@ class ExtHostEditorTabGroup { return that._tabs.find(tab => tab.tabId === that._activeTabId)?.apiObject; }, get tabs() { - return that._tabs.map(tab => tab.apiObject); + return Object.freeze(that._tabs.map(tab => tab.apiObject)); } - }); + }; + this._apiObject = Object.freeze(obj); } return this._apiObject; } diff --git a/src/vscode-dts/vscode.proposed.tabs.d.ts b/src/vscode-dts/vscode.proposed.tabs.d.ts index 872f5fd97a5..06e28bdf8ee 100644 --- a/src/vscode-dts/vscode.proposed.tabs.d.ts +++ b/src/vscode-dts/vscode.proposed.tabs.d.ts @@ -101,7 +101,7 @@ declare module 'vscode' { /** * The list of tabs contained within the group */ - readonly tabs: Tab[]; + readonly tabs: readonly Tab[]; } export interface TabGroups {