Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Terminal.sendText addNewLine parameter to align with vscode api #13236

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

<a name="breaking_changes_not_yet_released">[Breaking Changes:](#breaking_changes_not_yet_released)</a>
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-ext/src/common/plugin-api-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-ext/src/main/browser/terminal-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-ext/src/plugin/terminal-ext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 4 additions & 3 deletions packages/plugin/src/theia.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading