From 1dc2b29aafaa3bc2a56a83f724508eaa1ebfc979 Mon Sep 17 00:00:00 2001 From: Logan Ramos Date: Wed, 23 Mar 2022 11:43:10 -0400 Subject: [PATCH] Fix #145895 --- src/vs/workbench/api/browser/mainThreadEditorTabs.ts | 7 +++++++ src/vs/workbench/api/common/extHost.api.impl.ts | 3 ++- src/vs/workbench/api/common/extHost.protocol.ts | 9 +++++++-- src/vs/workbench/api/common/extHostEditorTabs.ts | 6 ++++-- src/vs/workbench/api/common/extHostTypes.ts | 4 ++++ src/vscode-dts/vscode.proposed.tabs.d.ts | 6 +++++- 6 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadEditorTabs.ts b/src/vs/workbench/api/browser/mainThreadEditorTabs.ts index f9de7641a83..9cb136c257e 100644 --- a/src/vs/workbench/api/browser/mainThreadEditorTabs.ts +++ b/src/vs/workbench/api/browser/mainThreadEditorTabs.ts @@ -17,6 +17,7 @@ import { NotebookEditorInput } from 'vs/workbench/contrib/notebook/common/notebo import { CustomEditorInput } from 'vs/workbench/contrib/customEditor/browser/customEditorInput'; import { URI } from 'vs/base/common/uri'; import { WebviewInput } from 'vs/workbench/contrib/webviewPanel/browser/webviewEditorInput'; +import { TerminalEditorInput } from 'vs/workbench/contrib/terminal/browser/terminalEditorInput'; interface TabInfo { @@ -115,6 +116,12 @@ export class MainThreadEditorTabs implements MainThreadEditorTabsShape { }; } + if (editor instanceof TerminalEditorInput) { + return { + kind: TabInputKind.TerminalEditorInput + }; + } + if (editor instanceof DiffEditorInput) { if (editor.modified instanceof AbstractTextResourceEditorInput && editor.original instanceof AbstractTextResourceEditorInput) { return { diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index 6621fb3c15c..ef332ceaa2d 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -1338,7 +1338,8 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I TabKindCustom: extHostTypes.CustomEditorTabInput, TabKindNotebook: extHostTypes.NotebookEditorTabInput, TabKindNotebookDiff: extHostTypes.NotebookDiffEditorTabInput, - TabKindWebview: extHostTypes.WebviewEditorTabInput + TabKindWebview: extHostTypes.WebviewEditorTabInput, + TabKindTerminal: extHostTypes.TerminalEditorTabInput }; }; } diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index c88b150976b..ab5bce8eb6a 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -616,7 +616,8 @@ export const enum TabInputKind { NotebookInput, NotebookDiffInput, CustomEditorInput, - WebviewEditorInput + WebviewEditorInput, + TerminalEditorInput } export interface UnknownInputDto { @@ -658,7 +659,11 @@ export interface WebviewInputDto { viewType: string; } -export type AnyInputDto = UnknownInputDto | TextInputDto | TextDiffInputDto | NotebookInputDto | NotebookDiffInputDto | CustomInputDto | WebviewInputDto; +export interface TabInputDto { + kind: TabInputKind.TerminalEditorInput; +} + +export type AnyInputDto = UnknownInputDto | TextInputDto | TextDiffInputDto | NotebookInputDto | NotebookDiffInputDto | CustomInputDto | WebviewInputDto | TabInputDto; export interface MainThreadEditorTabsShape extends IDisposable { // manage tabs: move, close, rearrange etc diff --git a/src/vs/workbench/api/common/extHostEditorTabs.ts b/src/vs/workbench/api/common/extHostEditorTabs.ts index 6ff22e97729..800fe3773e2 100644 --- a/src/vs/workbench/api/common/extHostEditorTabs.ts +++ b/src/vs/workbench/api/common/extHostEditorTabs.ts @@ -9,7 +9,7 @@ import { IEditorTabDto, IEditorTabGroupDto, IExtHostEditorTabsShape, MainContext import { URI } from 'vs/base/common/uri'; import { Emitter } from 'vs/base/common/event'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; -import { CustomEditorTabInput, NotebookDiffEditorTabInput, NotebookEditorTabInput, TextDiffTabInput, TextTabInput, ViewColumn, WebviewEditorTabInput } from 'vs/workbench/api/common/extHostTypes'; +import { CustomEditorTabInput, NotebookDiffEditorTabInput, NotebookEditorTabInput, TerminalEditorTabInput, TextDiffTabInput, TextTabInput, ViewColumn, WebviewEditorTabInput } from 'vs/workbench/api/common/extHostTypes'; import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService'; export interface IExtHostEditorTabs extends IExtHostEditorTabsShape { @@ -19,7 +19,7 @@ export interface IExtHostEditorTabs extends IExtHostEditorTabsShape { export const IExtHostEditorTabs = createDecorator('IExtHostEditorTabs'); -type AnyTabInput = TextTabInput | TextDiffTabInput | CustomEditorTabInput | NotebookEditorTabInput | NotebookDiffEditorTabInput | WebviewEditorTabInput; +type AnyTabInput = TextTabInput | TextDiffTabInput | CustomEditorTabInput | NotebookEditorTabInput | NotebookDiffEditorTabInput | WebviewEditorTabInput | TerminalEditorTabInput; class ExtHostEditorTab { private _apiObject: vscode.Tab | undefined; @@ -90,6 +90,8 @@ class ExtHostEditorTab { return new NotebookEditorTabInput(URI.revive(this._dto.input.uri), this._dto.input.notebookType); case TabInputKind.NotebookDiffInput: return new NotebookDiffEditorTabInput(URI.revive(this._dto.input.original), URI.revive(this._dto.input.modified), this._dto.input.notebookType); + case TabInputKind.TerminalEditorInput: + return new TerminalEditorTabInput(); default: return undefined; } diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index d295e4fd8ce..700ab99bffb 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -3627,4 +3627,8 @@ export class NotebookEditorTabInput { export class NotebookDiffEditorTabInput { constructor(readonly original: URI, readonly modified: URI, readonly notebookType: string) { } } + +export class TerminalEditorTabInput { + constructor() { } +} //#endregion diff --git a/src/vscode-dts/vscode.proposed.tabs.d.ts b/src/vscode-dts/vscode.proposed.tabs.d.ts index e85ad7bb398..6aa373af754 100644 --- a/src/vscode-dts/vscode.proposed.tabs.d.ts +++ b/src/vscode-dts/vscode.proposed.tabs.d.ts @@ -45,6 +45,10 @@ declare module 'vscode' { constructor(original: Uri, modified: Uri, notebookType: string); } + export class TabKindTerminal { + constructor(); + } + /** * Represents a tab within the window */ @@ -63,7 +67,7 @@ declare module 'vscode' { * Defines the structure of the tab i.e. text, notebook, custom, etc. * Resource and other useful properties are defined on the tab kind. */ - readonly kind: TabKindText | TabKindTextDiff | TabKindCustom | TabKindWebview | TabKindNotebook | TabKindNotebookDiff | unknown; + readonly kind: TabKindText | TabKindTextDiff | TabKindCustom | TabKindWebview | TabKindNotebook | TabKindNotebookDiff | TabKindTerminal | unknown; /** * Whether or not the tab is currently active