From 761bf9b5aaed269bb065759fa6f74b8f63d3bab3 Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Mon, 6 Dec 2021 09:13:07 -0800 Subject: [PATCH 1/4] finalize terminal location API, fix #45407 --- .../common/extensionsApiProposals.ts | 1 - src/vscode-dts/vscode.d.ts | 36 +++++++++++++++ .../vscode.proposed.terminalLocation.d.ts | 45 ------------------- 3 files changed, 36 insertions(+), 46 deletions(-) delete mode 100644 src/vscode-dts/vscode.proposed.terminalLocation.d.ts diff --git a/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts b/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts index d413ce4beaba1..2c734e5a0d20d 100644 --- a/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts +++ b/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts @@ -49,7 +49,6 @@ export const allApiProposals = Object.freeze({ taskPresentationGroup: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.taskPresentationGroup.d.ts', terminalDataWriteEvent: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDataWriteEvent.d.ts', terminalDimensions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDimensions.d.ts', - terminalLocation: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalLocation.d.ts', terminalNameChangeEvent: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalNameChangeEvent.d.ts', testCoverage: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testCoverage.d.ts', testObserver: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testObserver.d.ts', diff --git a/src/vscode-dts/vscode.d.ts b/src/vscode-dts/vscode.d.ts index 08d8ec29761ca..bc8708e2b6c5c 100644 --- a/src/vscode-dts/vscode.d.ts +++ b/src/vscode-dts/vscode.d.ts @@ -5922,6 +5922,42 @@ declare module 'vscode' { dispose(): void; } + export interface TerminalOptions { + location?: TerminalLocation | TerminalEditorLocationOptions | TerminalSplitLocationOptions; + } + + export interface ExtensionTerminalOptions { + location?: TerminalLocation | TerminalEditorLocationOptions | TerminalSplitLocationOptions; + } + + export enum TerminalLocation { + Panel = 1, + Editor = 2, + } + + export interface TerminalEditorLocationOptions { + /** + * A view column in which the {@link Terminal terminal} should be shown in the editor area. + * Use {@link ViewColumn.Active active} to open in the active editor group, other values are + * adjusted to be `Min(column, columnCount + 1)`, the + * {@link ViewColumn.Active active}-column is not adjusted. Use + * {@linkcode ViewColumn.Beside} to open the editor to the side of the currently active one. + */ + viewColumn: ViewColumn; + /** + * An optional flag that when `true` will stop the {@link Terminal} from taking focus. + */ + preserveFocus?: boolean; + } + + export interface TerminalSplitLocationOptions { + /** + * The parent terminal to split this terminal beside. This works whether the parent terminal + * is in the panel or the editor area. + */ + parentTerminal: Terminal; + } + /** * Represents the state of a {@link Terminal}. */ diff --git a/src/vscode-dts/vscode.proposed.terminalLocation.d.ts b/src/vscode-dts/vscode.proposed.terminalLocation.d.ts deleted file mode 100644 index 9c2a10a3febe7..0000000000000 --- a/src/vscode-dts/vscode.proposed.terminalLocation.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module 'vscode' { - - // https://github.com/microsoft/vscode/issues/45407 - - export interface TerminalOptions { - location?: TerminalLocation | TerminalEditorLocationOptions | TerminalSplitLocationOptions; - } - - export interface ExtensionTerminalOptions { - location?: TerminalLocation | TerminalEditorLocationOptions | TerminalSplitLocationOptions; - } - - export enum TerminalLocation { - Panel = 1, - Editor = 2, - } - - export interface TerminalEditorLocationOptions { - /** - * A view column in which the {@link Terminal terminal} should be shown in the editor area. - * Use {@link ViewColumn.Active active} to open in the active editor group, other values are - * adjusted to be `Min(column, columnCount + 1)`, the - * {@link ViewColumn.Active active}-column is not adjusted. Use - * {@linkcode ViewColumn.Beside} to open the editor to the side of the currently active one. - */ - viewColumn: ViewColumn; - /** - * An optional flag that when `true` will stop the {@link Terminal} from taking focus. - */ - preserveFocus?: boolean; - } - - export interface TerminalSplitLocationOptions { - /** - * The parent terminal to split this terminal beside. This works whether the parent terminal - * is in the panel or the editor area. - */ - parentTerminal: Terminal; - } -} From 6921d0fb3a49b1084bb5a0e92002180d4dc85371 Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Mon, 6 Dec 2021 09:26:14 -0800 Subject: [PATCH 2/4] remove proposed check --- src/vs/workbench/api/common/extHost.api.impl.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index ed882131258b1..5e30cb10cb0ba 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -656,9 +656,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I }, createTerminal(nameOrOptions?: vscode.TerminalOptions | vscode.ExtensionTerminalOptions | string, shellPath?: string, shellArgs?: string[] | string): vscode.Terminal { if (typeof nameOrOptions === 'object') { - if ('location' in nameOrOptions) { - checkProposedApiEnabled(extension, 'terminalLocation'); - } if ('pty' in nameOrOptions) { return extHostTerminalService.createExtensionTerminal(nameOrOptions); } From 8d321feb1cd72df109adca2f171c53ef85bb3c12 Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Mon, 6 Dec 2021 10:50:53 -0800 Subject: [PATCH 3/4] add jsdoc --- src/vscode-dts/vscode.d.ts | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/vscode-dts/vscode.d.ts b/src/vscode-dts/vscode.d.ts index bc8708e2b6c5c..4ce56f176b421 100644 --- a/src/vscode-dts/vscode.d.ts +++ b/src/vscode-dts/vscode.d.ts @@ -5922,19 +5922,18 @@ declare module 'vscode' { dispose(): void; } - export interface TerminalOptions { - location?: TerminalLocation | TerminalEditorLocationOptions | TerminalSplitLocationOptions; - } - - export interface ExtensionTerminalOptions { - location?: TerminalLocation | TerminalEditorLocationOptions | TerminalSplitLocationOptions; - } - + /** + * The location of the terminal. + */ export enum TerminalLocation { Panel = 1, Editor = 2, } + /** + * Assumes a {@link TerminalLocation} of editor and allows specifying a {@link ViewColumn} and + * {@link preserveFocus} property + */ export interface TerminalEditorLocationOptions { /** * A view column in which the {@link Terminal terminal} should be shown in the editor area. @@ -5950,6 +5949,9 @@ declare module 'vscode' { preserveFocus?: boolean; } + /** + * Uses the parent {@link Terminal}'s location for the terminal + */ export interface TerminalSplitLocationOptions { /** * The parent terminal to split this terminal beside. This works whether the parent terminal @@ -9734,6 +9736,11 @@ declare module 'vscode' { * recommended for the best contrast and consistency across themes. */ color?: ThemeColor; + + /** + * The {@link TerminalLocation} or {@link TerminalEditorLocationOptions} or {@link TerminalSplitLocationOptions} for the terminal. + */ + location?: TerminalLocation | TerminalEditorLocationOptions | TerminalSplitLocationOptions; } /** @@ -9762,6 +9769,11 @@ declare module 'vscode' { * recommended for the best contrast and consistency across themes. */ color?: ThemeColor; + + /** + * The {@link TerminalLocation} or {@link TerminalEditorLocationOptions} or {@link TerminalSplitLocationOptions} for the terminal. + */ + location?: TerminalLocation | TerminalEditorLocationOptions | TerminalSplitLocationOptions; } /** From e4d684f89ee040e475a6b84ca26499216e855ed4 Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Mon, 6 Dec 2021 12:02:43 -0800 Subject: [PATCH 4/4] more jsdocs --- src/vscode-dts/vscode.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/vscode-dts/vscode.d.ts b/src/vscode-dts/vscode.d.ts index 4ce56f176b421..afdb41a05051c 100644 --- a/src/vscode-dts/vscode.d.ts +++ b/src/vscode-dts/vscode.d.ts @@ -5926,7 +5926,13 @@ declare module 'vscode' { * The location of the terminal. */ export enum TerminalLocation { + /** + * In the terminal view + */ Panel = 1, + /** + * In the editor area + */ Editor = 2, }