From 971331334e6bd243619b66ffe795d42e1f9d0223 Mon Sep 17 00:00:00 2001 From: Gabriel DeBacker Date: Wed, 23 Jan 2019 09:01:10 -0800 Subject: [PATCH] Updates based on API change request --- src/vs/vscode.proposed.d.ts | 49 ++++++++++++++++--- .../api/node/extHostTerminalService.ts | 6 +-- 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index bd857731fce..38f45c1af80 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -924,7 +924,7 @@ declare module 'vscode' { /** * Represents a terminal without a process where all interaction and output in the terminal is * controlled by an extension. This is similar to an output window but has the same VT sequence - * compatility as the regular terminal. + * compatibility as the regular terminal. * * Note that an instance of [Terminal](#Terminal) will be created when a TerminalRenderer is * created with all its APIs available for use by extensions. When using the Terminal object @@ -972,7 +972,7 @@ declare module 'vscode' { readonly maximumDimensions: TerminalDimensions | undefined; /** - * The corressponding [Terminal](#Terminal) for this TerminalRenderer. + * The corresponding [Terminal](#Terminal) for this TerminalRenderer. */ readonly terminal: Terminal; @@ -1012,7 +1012,7 @@ declare module 'vscode' { readonly onDidAcceptInput: Event; /** - * An event which fires when the [maximum dimensions](#TerminalRenderer.maimumDimensions) of + * An event which fires when the [maximum dimensions](#TerminalRenderer.maximumDimensions) of * the terminal renderer change. */ readonly onDidChangeMaximumDimensions: Event; @@ -1107,7 +1107,7 @@ declare module 'vscode' { } //#endregion - //#region SignatureHelpContext active paramters - mjbvz + //#region SignatureHelpContext active parameters - mjbvz export interface SignatureHelpContext { /** * The currently active [`SignatureHelp`](#SignatureHelp). @@ -1118,6 +1118,43 @@ declare module 'vscode' { } //#endregion + /** + * Interface used to render ANSI output (typically to a [terminal](TerminalRenderer). + */ + export interface AnsiRenderer { + /** + * The dimensions of the renderer, the rows and columns of the renderer can only be set to + * a value smaller than the maximum value, if this is undefined the renderer will auto fit + * to the maximum value [maximumDimensions](AnsiRenderer.maximumDimensions). + */ + dimensions: TerminalDimensions | undefined; + + /** + * The maximum dimensions of the renderer, this will be undefined immediately after a + * renderer is created and also until the renderer becomes visible in the UI. + * Listen to [onDidChangeMaximumDimensions](AnsiRenderer.onDidChangeMaximumDimensions) + * to get notified when this value changes. + */ + readonly maximumDimensions: TerminalDimensions | undefined; + + /** + * Write text to the terminal. + * @param text The text to write. + */ + write(text: string): void; + + /** + * An event which fires on keystrokes entered in the renderer. + */ + readonly onDidAcceptInput: Event; + + /** + * An event which fires when the [maximum dimensions](#AnsiRenderer.maximumDimensions) of + * the renderer change. + */ + readonly onDidChangeMaximumDimensions: Event; + } + /** * Class used to execute an extension callback as a task. */ @@ -1125,12 +1162,12 @@ declare module 'vscode' { /** * @param callback The callback that will be called when the extension callback task is executed. */ - constructor(callback: (terminalRenderer: TerminalRenderer, cancellationToken: CancellationToken, thisArg?: any) => Thenable); + constructor(callback: (ansiRenderer: AnsiRenderer, cancellationToken: CancellationToken, thisArg?: any) => Thenable); /** * The callback used to execute the task. */ - callback: (terminalRenderer: TerminalRenderer, cancellationToken: CancellationToken, thisArg?: any) => Thenable; + callback: (ansiRenderer: AnsiRenderer, cancellationToken: CancellationToken, thisArg?: any) => Thenable; } /** diff --git a/src/vs/workbench/api/node/extHostTerminalService.ts b/src/vs/workbench/api/node/extHostTerminalService.ts index b2c8adfb3f7..faf59841f87 100644 --- a/src/vs/workbench/api/node/extHostTerminalService.ts +++ b/src/vs/workbench/api/node/extHostTerminalService.ts @@ -164,7 +164,7 @@ export class ExtHostTerminal extends BaseExtHostTerminal implements vscode.Termi } } -export class ExtHostTerminalRenderer extends BaseExtHostTerminal implements vscode.TerminalRenderer { +export class ExtHostTerminalRenderer extends BaseExtHostTerminal implements vscode.TerminalRenderer, vscode.AnsiRenderer { public get name(): string { return this._name; } public set name(newName: string) { this._name = newName; @@ -361,11 +361,11 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape { } public $acceptTerminalOpened(id: number, name: string, isRendererOnly: boolean): void { - // If this is a terminal created by one of the public createrTerminal* APIs + // If this is a terminal created by one of the public createTerminal* APIs // then @acceptTerminalOpened was called from the main thread task // to indicate that the terminal is ready for use. // In those cases, we don't need to create the extension host objects - // as they alrady exist, but, we do still need to fire the events + // as they already exist, but, we do still need to fire the events // to our consumers. const index = this._getTerminalObjectIndexById(this._terminals, id); if (index !== null) { -- GitLab