diff --git a/src/vs/workbench/parts/terminal/common/terminal.ts b/src/vs/workbench/parts/terminal/common/terminal.ts index 1bffc84c62cd8dacd14cc392817cabdabf4549f4..e46517d157f625fcab5ea7d2101deee23fcc2acb 100644 --- a/src/vs/workbench/parts/terminal/common/terminal.ts +++ b/src/vs/workbench/parts/terminal/common/terminal.ts @@ -102,6 +102,13 @@ export interface IShellLaunchConfig { ignoreConfigurationCwd?: boolean; /** Whether to wait for a key press before closing the terminal. */ waitOnExit?: boolean; + /** + * A string including ANSI escape sequences that will be written to the terminal emulator + * _before_ the terminal process has launched, a trailing \n is added at the end of the string. + * This allows for example the terminal instance to display a styled message as the first line + * of the terminal. Use \x1b over \033 or \e for the escape control character. + */ + initialText?: string; } export interface ITerminalService { diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts index 12e5e03e5eef27c69efd05eb594300fcbbd639df..19c450b674479e3b1cc8ff344b01bc885888bf5b 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts @@ -192,6 +192,9 @@ export class TerminalInstance implements ITerminalInstance { this._xterm = xterm({ scrollback: this._configHelper.config.scrollback }); + if (this._shellLaunchConfig.initialText) { + this._xterm.writeln(this._shellLaunchConfig.initialText); + } this._process.on('message', (message) => this._sendPtyDataToXterm(message)); this._xterm.on('data', (data) => { if (this._process) {