diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e7aff65789f0..6824caf10ceda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ - [Previous Changelogs](https://github.com/eclipse-theia/theia/tree/master/doc/changelogs/) +## v1.28.0 - Unreleased +- [plugin] added support for property `SourceControlInputBox#visible` [#11412](https://github.com/eclipse-theia/theia/pull/11412) - Contributed on behalf of STMicroelectronics + ## v1.27.0 - 6/30/2022 - [core] added better styling for active sidepanel borders [#11330](https://github.com/eclipse-theia/theia/pull/11330) diff --git a/packages/plugin-ext/src/common/plugin-api-rpc.ts b/packages/plugin-ext/src/common/plugin-api-rpc.ts index 53066e6c5e5fe..d7c06e5d304c3 100644 --- a/packages/plugin-ext/src/common/plugin-api-rpc.ts +++ b/packages/plugin-ext/src/common/plugin-api-rpc.ts @@ -871,6 +871,7 @@ export interface ScmMain { $setInputBoxValue(sourceControlHandle: number, value: string): void; $setInputBoxPlaceholder(sourceControlHandle: number, placeholder: string): void; + $setInputBoxVisible(sourceControlHandle: number, visible: boolean): void; } export interface SourceControlProviderFeatures { diff --git a/packages/plugin-ext/src/main/browser/scm-main.ts b/packages/plugin-ext/src/main/browser/scm-main.ts index 685e8d7e6bbe7..280471cb2d73e 100644 --- a/packages/plugin-ext/src/main/browser/scm-main.ts +++ b/packages/plugin-ext/src/main/browser/scm-main.ts @@ -430,4 +430,14 @@ export class ScmMainImpl implements ScmMain { repository.input.placeholder = placeholder; } + + $setInputBoxVisible(sourceControlHandle: number, visible: boolean): void { + const repository = this.repositories.get(sourceControlHandle); + + if (!repository) { + return; + } + + repository.input.visible = visible; + } } diff --git a/packages/plugin-ext/src/plugin/scm.ts b/packages/plugin-ext/src/plugin/scm.ts index bd6f57b8d3eb1..200326b713716 100644 --- a/packages/plugin-ext/src/plugin/scm.ts +++ b/packages/plugin-ext/src/plugin/scm.ts @@ -311,6 +311,17 @@ export class ScmInputBoxImpl implements theia.SourceControlInputBox { this._placeholder = placeholder; } + private _visible: boolean = true; + + get visible(): boolean { + return this._visible; + } + + set visible(visible: boolean) { + this.proxy.$setInputBoxVisible(this.sourceControlHandle, visible); + this._visible = visible; + } + private _validateInput: ValidateInput | undefined; get validateInput(): ValidateInput | undefined { diff --git a/packages/plugin/src/theia.d.ts b/packages/plugin/src/theia.d.ts index ef0147ebc0056..03ecb3e4c1e81 100644 --- a/packages/plugin/src/theia.d.ts +++ b/packages/plugin/src/theia.d.ts @@ -9609,6 +9609,11 @@ export module '@theia/plugin' { * A string to show as place holder in the input box to guide the user. */ placeholder: string; + + /** + * Controls whether the input box is visible (default is true). + */ + visible: boolean; } interface QuickDiffProvider { diff --git a/packages/scm/src/browser/scm-commit-widget.tsx b/packages/scm/src/browser/scm-commit-widget.tsx index 445357c42ac87..276be910864cc 100644 --- a/packages/scm/src/browser/scm-commit-widget.tsx +++ b/packages/scm/src/browser/scm-commit-widget.tsx @@ -130,7 +130,7 @@ export class ScmCommitWidget extends ReactWidget implements StatefulWidget { const keybinding = this.keybindings.acceleratorFor(this.keybindings.getKeybindingsForCommand('scm.acceptInput')[0]).join('+'); const message = format(input.placeholder || '', keybinding); - return
+ const textArea = input.visible ? - + : ''; + return
+ {textArea}