diff --git a/CHANGELOG.md b/CHANGELOG.md index 505c6060e9f59..d36802d4511a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ## not yet released - [plugin] stub multiDocumentHighlightProvider proposed API [#13248](https://github.com/eclipse-theia/theia/pull/13248) - contributed on behalf of STMicroelectronics +- [terminal] rename terminal.sendText() parameter from addNewLine to shouldExecute [#13236](https://github.com/eclipse-theia/theia/pull/13236) - contributed on behalf of STMicroelectronics - [terminal] update terminalQuickFixProvider proposed API according to vscode 1.85 version [#13240](https://github.com/eclipse-theia/theia/pull/13240) - contributed on behalf of STMicroelectronics [Breaking Changes:](#breaking_changes_not_yet_released) diff --git a/packages/plugin-ext/src/common/plugin-api-rpc.ts b/packages/plugin-ext/src/common/plugin-api-rpc.ts index 5516220d17cd3..c0616d5177df6 100644 --- a/packages/plugin-ext/src/common/plugin-api-rpc.ts +++ b/packages/plugin-ext/src/common/plugin-api-rpc.ts @@ -327,9 +327,9 @@ export interface TerminalServiceMain { * Send text to the terminal by id. * @param id - terminal widget id. * @param text - text content. - * @param addNewLine - in case true - add new line after the text, otherwise - don't apply new line. + * @param shouldExecute - in case true - Indicates that the text being sent should be executed rather than just inserted in the terminal. */ - $sendText(id: string, text: string, addNewLine?: boolean): void; + $sendText(id: string, text: string, shouldExecute?: boolean): void; /** * Write data to the terminal by id. diff --git a/packages/plugin-ext/src/main/browser/terminal-main.ts b/packages/plugin-ext/src/main/browser/terminal-main.ts index fe1876c7bf8b4..590955fc27faa 100644 --- a/packages/plugin-ext/src/main/browser/terminal-main.ts +++ b/packages/plugin-ext/src/main/browser/terminal-main.ts @@ -181,11 +181,11 @@ export class TerminalServiceMainImpl implements TerminalServiceMain, TerminalLin return undefined; } - $sendText(id: string, text: string, addNewLine?: boolean): void { + $sendText(id: string, text: string, shouldExecute?: boolean): void { const terminal = this.terminals.getById(id); if (terminal) { text = text.replace(/\r?\n/g, '\r'); - if (addNewLine && text.charAt(text.length - 1) !== '\r') { + if (shouldExecute && text.charAt(text.length - 1) !== '\r') { text += '\r'; } terminal.sendText(text); diff --git a/packages/plugin-ext/src/plugin/terminal-ext.ts b/packages/plugin-ext/src/plugin/terminal-ext.ts index 7c158fd36a8cb..627c322b4ec4b 100644 --- a/packages/plugin-ext/src/plugin/terminal-ext.ts +++ b/packages/plugin-ext/src/plugin/terminal-ext.ts @@ -463,8 +463,8 @@ export class TerminalExtImpl implements Terminal { this.creationOptions = this.options; } - sendText(text: string, addNewLine: boolean = true): void { - this.id.promise.then(id => this.proxy.$sendText(id, text, addNewLine)); + sendText(text: string, shouldExecute: boolean = true): void { + this.id.promise.then(id => this.proxy.$sendText(id, text, shouldExecute)); } show(preserveFocus?: boolean): void { diff --git a/packages/plugin/src/theia.d.ts b/packages/plugin/src/theia.d.ts index c27a73a6b6ddc..e1cbea324ebed 100644 --- a/packages/plugin/src/theia.d.ts +++ b/packages/plugin/src/theia.d.ts @@ -3043,10 +3043,11 @@ export module '@theia/plugin' { /** * Send text to the terminal. - * @param text - text content. - * @param addNewLine - in case true - apply new line after the text, otherwise don't apply new line. This defaults to `true`. + * @param text - The text to send. + * @param shouldExecute - Indicates that the text being sent should be executed rather than just inserted in the terminal. + * The character added is \r, independent from the platform (compared to platform specific in vscode). This defaults to `true`. */ - sendText(text: string, addNewLine?: boolean): void; + sendText(text: string, shouldExecute?: boolean): void; /** * Show created terminal on the UI.