提交 10129c61 编写于 作者: J Johannes Rieken

fixes #9376

when re-showing the quick pick for input honor the last typed value and only select the default value
上级 7218a80c
......@@ -759,12 +759,14 @@ export class QuickOpenWidget implements IModelProvider {
}
}
public setValue(value: string): void {
public setValue(value: string, select: boolean): void {
if (this.inputBox) {
this.inputBox.value = value;
if (select) {
this.inputBox.select();
}
}
}
public setPassword(isPassword: boolean): void {
if (this.inputBox) {
......
......@@ -52,6 +52,7 @@ interface IPickOpenEntryItem extends IPickOpenEntry {
interface IInternalPickOptions {
value?: string;
valueSelect?: boolean;
placeHolder?: string;
inputDecoration?: Severity;
password?: boolean;
......@@ -122,15 +123,15 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
}
}
public input(options?: IInputOptions): TPromise<string> {
const defaultMessage = options && options.prompt
public input(options: IInputOptions = {}): TPromise<string> {
const defaultMessage = options.prompt
? nls.localize('inputModeEntryDescription', "{0} (Press 'Enter' to confirm or 'Escape' to cancel)", options.prompt)
: nls.localize('inputModeEntry', "Press 'Enter' to confirm your input or 'Escape' to cancel");
let currentPick = defaultMessage;
let currentValidation = TPromise.as(true);
let currentDecoration: Severity;
let lastValue = options && options.value || '';
let lastValue = options.value || '';
const init = (resolve: (value: IPickOpenEntry | TPromise<IPickOpenEntry>) => any, reject: (value: any) => any) => {
......@@ -141,7 +142,8 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
autoFocus: { autoFocusFirstEntry: true },
password: options.password,
placeHolder: options.placeHolder,
value: options.value,
value: lastValue || options.value,
valueSelect: !lastValue || lastValue === options.value,
inputDecoration: currentDecoration,
onDidType: (value) => {
lastValue = value;
......@@ -255,7 +257,7 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
// Respect input value
if (options.value) {
this.pickOpenWidget.setValue(options.value);
this.pickOpenWidget.setValue(options.value, options.valueSelect);
}
// Respect password
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册