提交 fda8a1be 编写于 作者: J Johannes Rieken

have valueSelection instead of noValuePreselect, #10582

上级 f15d1e96
......@@ -757,10 +757,13 @@ export class QuickOpenWidget implements IModelProvider {
}
}
public setValue(value: string, select: boolean): void {
public setValue(value: string, selection?: [number, number]): void {
if (this.inputBox) {
this.inputBox.value = value;
if (select) {
if (Array.isArray(selection)) {
const [start, end] = selection;
this.inputBox.select({ start, end });
} else {
this.inputBox.select();
}
}
......@@ -920,4 +923,4 @@ export class QuickOpenWidget implements IModelProvider {
this.inputBox.dispose();
this.tree.dispose();
}
}
\ No newline at end of file
}
......@@ -67,9 +67,9 @@ export interface IInputOptions {
value?: string;
/**
* whether to automatically select the first value set
* the selection of value, default to the whole word
*/
noValuePreselect?: boolean;
valueSelection?: [number, number];
/**
* the text to display underneath the input box
......
......@@ -1466,9 +1466,12 @@ declare module 'vscode' {
value?: string;
/**
* Whether to preselect the given `value` when the box is first shown.
* Selection of the prefilled [`value`](#InputBoxOptions.value). Defined as tuple of two number where the
* first is the inclusive start index and the second the exclusive end index. When `undefined` the whole
* word will be selected, when empty (start equals end) only the cursor will be set,
* otherwise the defined range will be selected.
*/
noValuePreselect?: boolean;
valueSelection?: [number, number];
/**
* The text to display underneath the input box.
......
......@@ -82,7 +82,7 @@ export class MainThreadQuickOpen extends MainThreadQuickOpenShape {
if (options) {
inputOptions.password = options.password;
inputOptions.placeHolder = options.placeHolder;
inputOptions.noValuePreselect = options.noValuePreselect;
inputOptions.valueSelection = options.valueSelection;
inputOptions.prompt = options.prompt;
inputOptions.value = options.value;
inputOptions.ignoreFocusLost = options.ignoreFocusOut;
......
......@@ -65,7 +65,7 @@ interface IWorkbenchQuickOpenConfiguration {
interface IInternalPickOptions {
value?: string;
valueSelect?: boolean;
valueSelection?: [number, number];
placeHolder?: string;
inputDecoration?: Severity;
password?: boolean;
......@@ -184,7 +184,7 @@ export class QuickOpenController extends Component implements IQuickOpenService
password: options.password,
placeHolder: options.placeHolder,
value: lastValue === void 0 ? options.value : lastValue,
valueSelect: options.noValuePreselect ? false : lastValue === void 0,
valueSelection: options.valueSelection,
inputDecoration: currentDecoration,
onDidType: (value) => {
lastValue = value;
......@@ -306,7 +306,7 @@ export class QuickOpenController extends Component implements IQuickOpenService
// Respect input value
if (options.value) {
this.pickOpenWidget.setValue(options.value, options.valueSelect);
this.pickOpenWidget.setValue(options.value, options.valueSelection);
}
// Respect password
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册