Skip to content

Commit

Permalink
Add links to proposed terminal APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed Nov 29, 2019
1 parent d75b403 commit 94c6893
Showing 1 changed file with 58 additions and 40 deletions.
98 changes: 58 additions & 40 deletions src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -736,21 +736,7 @@ declare module 'vscode' {

//#endregion

//#region Terminal

/**
* An [event](#Event) which fires when a [Terminal](#Terminal)'s dimensions change.
*/
export interface TerminalDimensionsChangeEvent {
/**
* The [terminal](#Terminal) for which the dimensions have changed.
*/
readonly terminal: Terminal;
/**
* The new value for the [terminal's dimensions](#Terminal.dimensions).
*/
readonly dimensions: TerminalDimensions;
}
//#region Terminal data write event https://github.com/microsoft/vscode/issues/78502

export interface TerminalDataWriteEvent {
/**
Expand All @@ -763,6 +749,19 @@ declare module 'vscode' {
readonly data: string;
}

namespace window {
/**
* An event which fires when the terminal's pty slave pseudo-device is written to. In other
* words, this provides access to the raw data stream from the process running within the
* terminal, including VT sequences.
*/
export const onDidWriteTerminalData: Event<TerminalDataWriteEvent>;
}

//#endregion

//#region Terminal exit status https://github.com/microsoft/vscode/issues/62103

export interface TerminalExitStatus {
/**
* The exit code that a terminal exited with, it can have the following values:
Expand All @@ -774,49 +773,68 @@ declare module 'vscode' {
readonly code: number | undefined;
}

namespace window {
/**
* An event which fires when the [dimensions](#Terminal.dimensions) of the terminal change.
*/
export const onDidChangeTerminalDimensions: Event<TerminalDimensionsChangeEvent>;

export interface Terminal {
/**
* An event which fires when the terminal's pty slave pseudo-device is written to. In other
* words, this provides access to the raw data stream from the process running within the
* terminal, including VT sequences.
* The exit status of the terminal, this will be undefined while the terminal is active.
*
* **Example:** Show a notification with the exit code when the terminal exits with a
* non-zero exit code.
* ```typescript
* window.onDidCloseTerminal(t => {
* if (t.exitStatus && t.exitStatus.code) {
* vscode.window.showInformationMessage(`Exit code: ${t.exitStatus.code}`);
* }
* });
* ```
*/
export const onDidWriteTerminalData: Event<TerminalDataWriteEvent>;
readonly exitStatus: TerminalExitStatus | undefined;
}

//#endregion

//#region Terminal creation options https://github.com/microsoft/vscode/issues/63052

export interface Terminal {
/**
* The object used to initialize the terminal, this is useful for things like detecting the
* shell type of shells not launched by the extension or detecting what folder the shell was
* launched in.
*/
readonly creationOptions: Readonly<TerminalOptions | ExtensionTerminalOptions>;
}

//#endregionn

//#region Terminal dimensions property and change event https://github.com/microsoft/vscode/issues/55718

/**
* An [event](#Event) which fires when a [Terminal](#Terminal)'s dimensions change.
*/
export interface TerminalDimensionsChangeEvent {
/**
* The [terminal](#Terminal) for which the dimensions have changed.
*/
readonly terminal: Terminal;
/**
* The new value for the [terminal's dimensions](#Terminal.dimensions).
*/
readonly dimensions: TerminalDimensions;
}

namespace window {
/**
* An event which fires when the [dimensions](#Terminal.dimensions) of the terminal change.
*/
export const onDidChangeTerminalDimensions: Event<TerminalDimensionsChangeEvent>;
}

export interface Terminal {
/**
* The current dimensions of the terminal. This will be `undefined` immediately after the
* terminal is created as the dimensions are not known until shortly after the terminal is
* created.
*/
readonly dimensions: TerminalDimensions | undefined;

/**
* The exit status of the terminal, this will be undefined while the terminal is active.
*
* **Example:** Show a notification with the exit code when the terminal exits with a
* non-zero exit code.
* ```typescript
* window.onDidCloseTerminal(t => {
* if (t.exitStatus && t.exitStatus.code) {
* vscode.window.showInformationMessage(`Exit code: ${t.exitStatus.code}`);
* }
* });
* ```
*/
readonly exitStatus: TerminalExitStatus | undefined;
}

//#endregion
Expand Down

0 comments on commit 94c6893

Please sign in to comment.