Skip to content

Commit 9fbfe5d

Browse files
authored
Add okLabel to pick input (microsoft#235744)
Fixes microsoft#194519
1 parent e095f63 commit 9fbfe5d

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

src/vs/platform/quickinput/browser/quickInput.ts

+11
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ export class QuickPick<T extends IQuickPickItem, O extends { useSeparators: bool
562562
private _valueSelection: Readonly<[number, number]> | undefined;
563563
private valueSelectionUpdated = true;
564564
private _ok: boolean | 'default' = 'default';
565+
private _okLabel: string | undefined;
565566
private _customButton = false;
566567
private _customButtonLabel: string | undefined;
567568
private _customButtonHover: string | undefined;
@@ -812,6 +813,15 @@ export class QuickPick<T extends IQuickPickItem, O extends { useSeparators: bool
812813
this.update();
813814
}
814815

816+
get okLabel() {
817+
return this._okLabel ?? localize('ok', "OK");
818+
}
819+
820+
set okLabel(okLabel: string | undefined) {
821+
this._okLabel = okLabel;
822+
this.update();
823+
}
824+
815825
inputHasFocus(): boolean {
816826
return this.visible ? this.ui.inputBox.hasFocus() : false;
817827
}
@@ -1101,6 +1111,7 @@ export class QuickPick<T extends IQuickPickItem, O extends { useSeparators: bool
11011111
this.selectedItemsToConfirm = null;
11021112
}
11031113
}
1114+
this.ui.ok.label = this.okLabel || '';
11041115
this.ui.customButton.label = this.customLabel || '';
11051116
this.ui.customButton.element.title = this.customHover || '';
11061117
if (!visibilities.inputBox) {

src/vs/platform/quickinput/common/quickInput.ts

+5
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,11 @@ export interface IQuickPick<T extends IQuickPickItem, O extends { useSeparators:
477477
*/
478478
ok: boolean | 'default';
479479

480+
/**
481+
* The OK button label.
482+
*/
483+
okLabel: string | undefined;
484+
480485
/**
481486
* An event that is fired when the custom button is triggered. The custom button is a button with text rendered to the right of the input.
482487
*/

src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts

+1
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ export class SimpleFileDialog extends Disposable implements ISimpleFileDialog {
283283
this.filePickBox.sortByLabel = false;
284284
this.filePickBox.ignoreFocusOut = true;
285285
this.filePickBox.ok = true;
286+
this.filePickBox.okLabel = this.options.openLabel;
286287
if ((this.scheme !== Schemas.file) && this.options && this.options.availableFileSystems && (this.options.availableFileSystems.length > 1) && (this.options.availableFileSystems.indexOf(Schemas.file) > -1)) {
287288
this.filePickBox.customButton = true;
288289
this.filePickBox.customLabel = nls.localize('remoteFileDialog.local', 'Show Local');

0 commit comments

Comments
 (0)