From 757da367d3ac5592bba881f99bd132def2f8fcaa Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 12 Oct 2021 12:11:17 -0700 Subject: [PATCH] Clean up types for Tab public api - prefer using `| undefined` for managed types - Add readonly --- src/vs/vscode.proposed.d.ts | 11 +++++++---- src/vs/workbench/api/common/extHostEditorTabs.ts | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index e38d4a2ab6c..f701bdf515b 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -2265,24 +2265,27 @@ declare module 'vscode' { readonly viewColumn: ViewColumn; /** - * The resource represented by the tab if availble. + * The resource represented by the tab if available. * Note: Not all tabs have a resource associated with them. */ - readonly resource?: Uri; + readonly resource: Uri | undefined; /** * The identifier of the view contained in the tab * This is equivalent to `viewType` for custom editors and `notebookType` for notebooks. * The built-in text editor has an id of 'default' for all configurations. */ - readonly viewId?: string; + readonly viewId: string | undefined; /** * All the resources and viewIds represented by a tab * {@link Tab.resource resource} and {@link Tab.viewId viewId} will * always be at index 0. */ - additionalResourcesAndViewIds: { resource?: Uri, viewId?: string }[]; + readonly additionalResourcesAndViewIds: readonly { + readonly resource: Uri | undefined, + readonly viewId: string | undefined + }[]; /** * Whether or not the tab is currently active diff --git a/src/vs/workbench/api/common/extHostEditorTabs.ts b/src/vs/workbench/api/common/extHostEditorTabs.ts index 9e896035ad5..414d90f4580 100644 --- a/src/vs/workbench/api/common/extHostEditorTabs.ts +++ b/src/vs/workbench/api/common/extHostEditorTabs.ts @@ -17,10 +17,10 @@ export interface IEditorTab { label: string; viewColumn: ViewColumn; index: number; - resource?: vscode.Uri; - viewId?: string; + resource: vscode.Uri | undefined; + viewId: string | undefined; isActive: boolean; - additionalResourcesAndViewIds: { resource?: vscode.Uri, viewId?: string }[]; + additionalResourcesAndViewIds: { resource: vscode.Uri | undefined, viewId: string | undefined }[]; move(index: number, viewColumn: ViewColumn): Promise; close(): Promise; }