Liking cljdoc? Tell your friends :D

dots.vscode.pseudoterminal

Defines the interface of a terminal pty, enabling extensions to control a terminal.

Defines the interface of a terminal pty, enabling extensions to control a terminal.
raw docstring

closecljs

(close pseudoterminal)

Implement to handle when the terminal is closed by an act of the user.

Returns: void

Implement to handle when the terminal is closed by an act of the user.

**Returns:** `void`
sourceraw docstring

handle-inputcljs

(handle-input pseudoterminal data)

Implement to handle incoming keystrokes in the terminal or when an extension calls {@link Terminal.sendText }. data contains the keystrokes/text serialized into their corresponding VT sequence representation.

Parameters:

  • data: string - The incoming data.

Example: Echo input in the terminal. The sequence for enter (\r) is translated to CRLF to go to a new line and move the cursor to the start of the line.

const writeEmitter = new vscode.EventEmitter<string>();
const pty: vscode.Pseudoterminal = {
onDidWrite: writeEmitter.event,
open: () => {},
close: () => {},
handleInput: data => writeEmitter.fire(data === '\r' ? '\r\n' : data)
};
vscode.window.createTerminal({ name: 'Local echo', pty });

Returns: void

Implement to handle incoming keystrokes in the terminal or when an extension calls
{@link Terminal.sendText }. `data` contains the keystrokes/text serialized into
their corresponding VT sequence representation.

**Parameters:**
- `data`: `string` - The incoming data.

**Example:** Echo input in the terminal. The sequence for enter (`\r`) is translated to
CRLF to go to a new line and move the cursor to the start of the line.
```typescript
const writeEmitter = new vscode.EventEmitter<string>();
const pty: vscode.Pseudoterminal = {
onDidWrite: writeEmitter.event,
open: () => {},
close: () => {},
handleInput: data => writeEmitter.fire(data === '\r' ? '\r\n' : data)
};
vscode.window.createTerminal({ name: 'Local echo', pty });
```

**Returns:** `void`
sourceraw docstring

on-did-change-namecljs

(on-did-change-name pseudoterminal)
(on-did-change-name pseudoterminal listener)
(on-did-change-name pseudoterminal listener this-args)
(on-did-change-name pseudoterminal listener this-args disposables)

An event that when fired allows changing the name of the terminal.

Events fired before {@link Pseudoterminal.open } is called will be be ignored.

Example: Change the terminal name to "My new terminal".

const writeEmitter = new vscode.EventEmitter<string>();
const changeNameEmitter = new vscode.EventEmitter<string>();
const pty: vscode.Pseudoterminal = {
  onDidWrite: writeEmitter.event,
  onDidChangeName: changeNameEmitter.event,
  open: () => changeNameEmitter.fire('My new terminal'),
  close: () => {}
};
vscode.window.createTerminal({ name: 'My terminal', pty });

Parameters:

  • listener: (e: T) => any - The listener function will be called when the event happens.
  • this-args: any - The this-argument which will be used when calling the event listener.
  • disposables: Disposable[] | undefined - An array to which a {@link Disposable } will be added.

Returns: Disposable - A disposable which unsubscribes the event listener.

An event that when fired allows changing the name of the terminal.

Events fired before {@link Pseudoterminal.open } is called will be be ignored.

**Example:** Change the terminal name to "My new terminal".
```typescript
const writeEmitter = new vscode.EventEmitter<string>();
const changeNameEmitter = new vscode.EventEmitter<string>();
const pty: vscode.Pseudoterminal = {
  onDidWrite: writeEmitter.event,
  onDidChangeName: changeNameEmitter.event,
  open: () => changeNameEmitter.fire('My new terminal'),
  close: () => {}
};
vscode.window.createTerminal({ name: 'My terminal', pty });
```

**Parameters:**
- `listener`: `(e: T) => any` - The listener function will be called when the event happens.
- `this-args`: `any` - The `this`-argument which will be used when calling the event listener.
- `disposables`: `Disposable[] | undefined` - An array to which a {@link Disposable } will be added.

**Returns:** `Disposable` - A disposable which unsubscribes the event listener.
sourceraw docstring

on-did-closecljs

(on-did-close pseudoterminal)
(on-did-close pseudoterminal listener)
(on-did-close pseudoterminal listener this-args)
(on-did-close pseudoterminal listener this-args disposables)

An event that when fired will signal that the pty is closed and dispose of the terminal.

Events fired before {@link Pseudoterminal.open } is called will be be ignored.

A number can be used to provide an exit code for the terminal. Exit codes must be positive and a non-zero exit codes signals failure which shows a notification for a regular terminal and allows dependent tasks to proceed when used with the CustomExecution API.

Example: Exit the terminal when "y" is pressed, otherwise show a notification.

const writeEmitter = new vscode.EventEmitter<string>();
const closeEmitter = new vscode.EventEmitter<void>();
const pty: vscode.Pseudoterminal = {
  onDidWrite: writeEmitter.event,
  onDidClose: closeEmitter.event,
  open: () => writeEmitter.fire('Press y to exit successfully'),
  close: () => {},
  handleInput: data => {
    if (data !== 'y') {
      vscode.window.showInformationMessage('Something went wrong');
    }
    closeEmitter.fire();
  }
};
const terminal = vscode.window.createTerminal({ name: 'Exit example', pty });
terminal.show(true);

Parameters:

  • listener: (e: T) => any - The listener function will be called when the event happens.
  • this-args: any - The this-argument which will be used when calling the event listener.
  • disposables: Disposable[] | undefined - An array to which a {@link Disposable } will be added.

Returns: Disposable - A disposable which unsubscribes the event listener.

An event that when fired will signal that the pty is closed and dispose of the terminal.

Events fired before {@link Pseudoterminal.open } is called will be be ignored.

A number can be used to provide an exit code for the terminal. Exit codes must be
positive and a non-zero exit codes signals failure which shows a notification for a
regular terminal and allows dependent tasks to proceed when used with the
`CustomExecution` API.

**Example:** Exit the terminal when "y" is pressed, otherwise show a notification.
```typescript
const writeEmitter = new vscode.EventEmitter<string>();
const closeEmitter = new vscode.EventEmitter<void>();
const pty: vscode.Pseudoterminal = {
  onDidWrite: writeEmitter.event,
  onDidClose: closeEmitter.event,
  open: () => writeEmitter.fire('Press y to exit successfully'),
  close: () => {},
  handleInput: data => {
    if (data !== 'y') {
      vscode.window.showInformationMessage('Something went wrong');
    }
    closeEmitter.fire();
  }
};
const terminal = vscode.window.createTerminal({ name: 'Exit example', pty });
terminal.show(true);
```

**Parameters:**
- `listener`: `(e: T) => any` - The listener function will be called when the event happens.
- `this-args`: `any` - The `this`-argument which will be used when calling the event listener.
- `disposables`: `Disposable[] | undefined` - An array to which a {@link Disposable } will be added.

**Returns:** `Disposable` - A disposable which unsubscribes the event listener.
sourceraw docstring

on-did-override-dimensionscljs

(on-did-override-dimensions pseudoterminal)
(on-did-override-dimensions pseudoterminal listener)
(on-did-override-dimensions pseudoterminal listener this-args)
(on-did-override-dimensions pseudoterminal listener this-args disposables)

An event that when fired allows overriding the {@link Pseudoterminal.setDimensions dimensions} of the terminal. Note that when set, the overridden dimensions will only take effect when they are lower than the actual dimensions of the terminal (ie. there will never be a scroll bar). Set to undefined for the terminal to go back to the regular dimensions (fit to the size of the panel).

Events fired before {@link Pseudoterminal.open } is called will be be ignored.

Example: Override the dimensions of a terminal to 20 columns and 10 rows

const dimensionsEmitter = new vscode.EventEmitter<vscode.TerminalDimensions>();
const pty: vscode.Pseudoterminal = {
  onDidWrite: writeEmitter.event,
  onDidOverrideDimensions: dimensionsEmitter.event,
  open: () => {
    dimensionsEmitter.fire({
      columns: 20,
      rows: 10
    });
  },
  close: () => {}
};
vscode.window.createTerminal({ name: 'My terminal', pty });

Parameters:

  • listener: (e: T) => any - The listener function will be called when the event happens.
  • this-args: any - The this-argument which will be used when calling the event listener.
  • disposables: Disposable[] | undefined - An array to which a {@link Disposable } will be added.

Returns: Disposable - A disposable which unsubscribes the event listener.

An event that when fired allows overriding the {@link Pseudoterminal.setDimensions dimensions} of the
terminal. Note that when set, the overridden dimensions will only take effect when they
are lower than the actual dimensions of the terminal (ie. there will never be a scroll
bar). Set to `undefined` for the terminal to go back to the regular dimensions (fit to
the size of the panel).

Events fired before {@link Pseudoterminal.open } is called will be be ignored.

**Example:** Override the dimensions of a terminal to 20 columns and 10 rows
```typescript
const dimensionsEmitter = new vscode.EventEmitter<vscode.TerminalDimensions>();
const pty: vscode.Pseudoterminal = {
  onDidWrite: writeEmitter.event,
  onDidOverrideDimensions: dimensionsEmitter.event,
  open: () => {
    dimensionsEmitter.fire({
      columns: 20,
      rows: 10
    });
  },
  close: () => {}
};
vscode.window.createTerminal({ name: 'My terminal', pty });
```

**Parameters:**
- `listener`: `(e: T) => any` - The listener function will be called when the event happens.
- `this-args`: `any` - The `this`-argument which will be used when calling the event listener.
- `disposables`: `Disposable[] | undefined` - An array to which a {@link Disposable } will be added.

**Returns:** `Disposable` - A disposable which unsubscribes the event listener.
sourceraw docstring

on-did-writecljs

(on-did-write pseudoterminal)
(on-did-write pseudoterminal listener)
(on-did-write pseudoterminal listener this-args)
(on-did-write pseudoterminal listener this-args disposables)

An event that when fired will write data to the terminal. Unlike {@link Terminal.sendText } which sends text to the underlying child pseudo-device (the child), this will write the text to parent pseudo-device (the terminal itself).

Note writing \n will just move the cursor down 1 row, you need to write \r as well to move the cursor to the left-most cell.

Events fired before {@link Pseudoterminal.open } is called will be be ignored.

Example: Write red text to the terminal

const writeEmitter = new vscode.EventEmitter<string>();
const pty: vscode.Pseudoterminal = {
  onDidWrite: writeEmitter.event,
  open: () => writeEmitter.fire('\x1b[31mHello world\x1b[0m'),
  close: () => {}
};
vscode.window.createTerminal({ name: 'My terminal', pty });

Example: Move the cursor to the 10th row and 20th column and write an asterisk

writeEmitter.fire('\x1b[10;20H*');

Parameters:

  • listener: (e: T) => any - The listener function will be called when the event happens.
  • this-args: any - The this-argument which will be used when calling the event listener.
  • disposables: Disposable[] | undefined - An array to which a {@link Disposable } will be added.

Returns: Disposable - A disposable which unsubscribes the event listener.

An event that when fired will write data to the terminal. Unlike
{@link Terminal.sendText } which sends text to the underlying child
pseudo-device (the child), this will write the text to parent pseudo-device (the
_terminal_ itself).

Note writing `\n` will just move the cursor down 1 row, you need to write `\r` as well
to move the cursor to the left-most cell.

Events fired before {@link Pseudoterminal.open } is called will be be ignored.

**Example:** Write red text to the terminal
```typescript
const writeEmitter = new vscode.EventEmitter<string>();
const pty: vscode.Pseudoterminal = {
  onDidWrite: writeEmitter.event,
  open: () => writeEmitter.fire('\x1b[31mHello world\x1b[0m'),
  close: () => {}
};
vscode.window.createTerminal({ name: 'My terminal', pty });
```

**Example:** Move the cursor to the 10th row and 20th column and write an asterisk
```typescript
writeEmitter.fire('\x1b[10;20H*');
```

**Parameters:**
- `listener`: `(e: T) => any` - The listener function will be called when the event happens.
- `this-args`: `any` - The `this`-argument which will be used when calling the event listener.
- `disposables`: `Disposable[] | undefined` - An array to which a {@link Disposable } will be added.

**Returns:** `Disposable` - A disposable which unsubscribes the event listener.
sourceraw docstring

opencljs

(open pseudoterminal)
(open pseudoterminal initial-dimensions)

Implement to handle when the pty is open and ready to start firing events.

Parameters:

  • initial-dimensions: TerminalDimensions | undefined - The dimensions of the terminal, this will be undefined if the terminal panel has not been opened before this is called.

Returns: void

Implement to handle when the pty is open and ready to start firing events.

**Parameters:**
- `initial-dimensions`: `TerminalDimensions | undefined` - The dimensions of the terminal, this will be undefined if the
terminal panel has not been opened before this is called.

**Returns:** `void`
sourceraw docstring

set-dimensionscljs

(set-dimensions pseudoterminal dimensions)

Implement to handle when the number of rows and columns that fit into the terminal panel changes, for example when font size changes or when the panel is resized. The initial state of a terminal's dimensions should be treated as undefined until this is triggered as the size of a terminal isn't known until it shows up in the user interface.

When dimensions are overridden by {@link Pseudoterminal.onDidOverrideDimensions onDidOverrideDimensions}, setDimensions will continue to be called with the regular panel dimensions, allowing the extension continue to react dimension changes.

Parameters:

  • dimensions: TerminalDimensions - The new dimensions.

Returns: void

Implement to handle when the number of rows and columns that fit into the terminal panel
changes, for example when font size changes or when the panel is resized. The initial
state of a terminal's dimensions should be treated as `undefined` until this is triggered
as the size of a terminal isn't known until it shows up in the user interface.

When dimensions are overridden by
{@link Pseudoterminal.onDidOverrideDimensions onDidOverrideDimensions}, `setDimensions` will
continue to be called with the regular panel dimensions, allowing the extension continue
to react dimension changes.

**Parameters:**
- `dimensions`: `TerminalDimensions` - The new dimensions.

**Returns:** `void`
sourceraw docstring

set-on-did-change-name!cljs

(set-on-did-change-name! pseudoterminal value)

An event that when fired allows changing the name of the terminal.

Events fired before {@link Pseudoterminal.open } is called will be be ignored.

Example: Change the terminal name to "My new terminal".

const writeEmitter = new vscode.EventEmitter<string>();
const changeNameEmitter = new vscode.EventEmitter<string>();
const pty: vscode.Pseudoterminal = {
  onDidWrite: writeEmitter.event,
  onDidChangeName: changeNameEmitter.event,
  open: () => changeNameEmitter.fire('My new terminal'),
  close: () => {}
};
vscode.window.createTerminal({ name: 'My terminal', pty });
An event that when fired allows changing the name of the terminal.

Events fired before {@link Pseudoterminal.open } is called will be be ignored.

**Example:** Change the terminal name to "My new terminal".
```typescript
const writeEmitter = new vscode.EventEmitter<string>();
const changeNameEmitter = new vscode.EventEmitter<string>();
const pty: vscode.Pseudoterminal = {
  onDidWrite: writeEmitter.event,
  onDidChangeName: changeNameEmitter.event,
  open: () => changeNameEmitter.fire('My new terminal'),
  close: () => {}
};
vscode.window.createTerminal({ name: 'My terminal', pty });
```
sourceraw docstring

set-on-did-close!cljs

(set-on-did-close! pseudoterminal value)

An event that when fired will signal that the pty is closed and dispose of the terminal.

Events fired before {@link Pseudoterminal.open } is called will be be ignored.

A number can be used to provide an exit code for the terminal. Exit codes must be positive and a non-zero exit codes signals failure which shows a notification for a regular terminal and allows dependent tasks to proceed when used with the CustomExecution API.

Example: Exit the terminal when "y" is pressed, otherwise show a notification.

const writeEmitter = new vscode.EventEmitter<string>();
const closeEmitter = new vscode.EventEmitter<void>();
const pty: vscode.Pseudoterminal = {
  onDidWrite: writeEmitter.event,
  onDidClose: closeEmitter.event,
  open: () => writeEmitter.fire('Press y to exit successfully'),
  close: () => {},
  handleInput: data => {
    if (data !== 'y') {
      vscode.window.showInformationMessage('Something went wrong');
    }
    closeEmitter.fire();
  }
};
const terminal = vscode.window.createTerminal({ name: 'Exit example', pty });
terminal.show(true);
An event that when fired will signal that the pty is closed and dispose of the terminal.

Events fired before {@link Pseudoterminal.open } is called will be be ignored.

A number can be used to provide an exit code for the terminal. Exit codes must be
positive and a non-zero exit codes signals failure which shows a notification for a
regular terminal and allows dependent tasks to proceed when used with the
`CustomExecution` API.

**Example:** Exit the terminal when "y" is pressed, otherwise show a notification.
```typescript
const writeEmitter = new vscode.EventEmitter<string>();
const closeEmitter = new vscode.EventEmitter<void>();
const pty: vscode.Pseudoterminal = {
  onDidWrite: writeEmitter.event,
  onDidClose: closeEmitter.event,
  open: () => writeEmitter.fire('Press y to exit successfully'),
  close: () => {},
  handleInput: data => {
    if (data !== 'y') {
      vscode.window.showInformationMessage('Something went wrong');
    }
    closeEmitter.fire();
  }
};
const terminal = vscode.window.createTerminal({ name: 'Exit example', pty });
terminal.show(true);
```
sourceraw docstring

set-on-did-override-dimensions!cljs

(set-on-did-override-dimensions! pseudoterminal value)

An event that when fired allows overriding the {@link Pseudoterminal.setDimensions dimensions} of the terminal. Note that when set, the overridden dimensions will only take effect when they are lower than the actual dimensions of the terminal (ie. there will never be a scroll bar). Set to undefined for the terminal to go back to the regular dimensions (fit to the size of the panel).

Events fired before {@link Pseudoterminal.open } is called will be be ignored.

Example: Override the dimensions of a terminal to 20 columns and 10 rows

const dimensionsEmitter = new vscode.EventEmitter<vscode.TerminalDimensions>();
const pty: vscode.Pseudoterminal = {
  onDidWrite: writeEmitter.event,
  onDidOverrideDimensions: dimensionsEmitter.event,
  open: () => {
    dimensionsEmitter.fire({
      columns: 20,
      rows: 10
    });
  },
  close: () => {}
};
vscode.window.createTerminal({ name: 'My terminal', pty });
An event that when fired allows overriding the {@link Pseudoterminal.setDimensions dimensions} of the
terminal. Note that when set, the overridden dimensions will only take effect when they
are lower than the actual dimensions of the terminal (ie. there will never be a scroll
bar). Set to `undefined` for the terminal to go back to the regular dimensions (fit to
the size of the panel).

Events fired before {@link Pseudoterminal.open } is called will be be ignored.

**Example:** Override the dimensions of a terminal to 20 columns and 10 rows
```typescript
const dimensionsEmitter = new vscode.EventEmitter<vscode.TerminalDimensions>();
const pty: vscode.Pseudoterminal = {
  onDidWrite: writeEmitter.event,
  onDidOverrideDimensions: dimensionsEmitter.event,
  open: () => {
    dimensionsEmitter.fire({
      columns: 20,
      rows: 10
    });
  },
  close: () => {}
};
vscode.window.createTerminal({ name: 'My terminal', pty });
```
sourceraw docstring

set-on-did-write!cljs

(set-on-did-write! pseudoterminal value)

An event that when fired will write data to the terminal. Unlike {@link Terminal.sendText } which sends text to the underlying child pseudo-device (the child), this will write the text to parent pseudo-device (the terminal itself).

Note writing \n will just move the cursor down 1 row, you need to write \r as well to move the cursor to the left-most cell.

Events fired before {@link Pseudoterminal.open } is called will be be ignored.

Example: Write red text to the terminal

const writeEmitter = new vscode.EventEmitter<string>();
const pty: vscode.Pseudoterminal = {
  onDidWrite: writeEmitter.event,
  open: () => writeEmitter.fire('\x1b[31mHello world\x1b[0m'),
  close: () => {}
};
vscode.window.createTerminal({ name: 'My terminal', pty });

Example: Move the cursor to the 10th row and 20th column and write an asterisk

writeEmitter.fire('\x1b[10;20H*');
An event that when fired will write data to the terminal. Unlike
{@link Terminal.sendText } which sends text to the underlying child
pseudo-device (the child), this will write the text to parent pseudo-device (the
_terminal_ itself).

Note writing `\n` will just move the cursor down 1 row, you need to write `\r` as well
to move the cursor to the left-most cell.

Events fired before {@link Pseudoterminal.open } is called will be be ignored.

**Example:** Write red text to the terminal
```typescript
const writeEmitter = new vscode.EventEmitter<string>();
const pty: vscode.Pseudoterminal = {
  onDidWrite: writeEmitter.event,
  open: () => writeEmitter.fire('\x1b[31mHello world\x1b[0m'),
  close: () => {}
};
vscode.window.createTerminal({ name: 'My terminal', pty });
```

**Example:** Move the cursor to the 10th row and 20th column and write an asterisk
```typescript
writeEmitter.fire('\x1b[10;20H*');
```
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close