You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Same as #111944 but for VS Code extensions (It's not obvious to me if original issue is the literal duplicate and was closed due to the inactivity, or if it was meant to be used only inside VS Code codebase (at least I see valueSelection attribute available in the corresponding file for VS Code))
Copying the description from the original description:
Currently there seem to be two text selection modes for QuickPick values:
If quickPick.value is set beforequickPick.show() is called, then the value (text) will be selected when the quick pick becomes visible, and typing a character will replace the input text unless the selection is changed first.
If quickPick.value is set afterquickPick.show() is called, then the caret will be placed at the end of the text value, ready for more characters to be typed at the end.
These selection modes seem to be undocumented.
It would be useful to be able to select a range of text rather than all or nothing.This would allow more powerful text input control by extensions. For example, it could be used to facilitate commands with multiple auto-completed arguments. An example API could be something like
const input = vscode.window.createQuickPick();
input.value = "a text string";
input.setValueSelection(2, 6);
input.show()
The quick pick would be displayed with the word "text" selected.
The text was updated successfully, but these errors were encountered:
CrafterKolyan
changed the title
API to select character range of QuickPick input text value (re-open)
API to select character range of QuickPick input text value for VSCode extensions
Nov 7, 2024
Same as #111944 but for VS Code extensions (It's not obvious to me if original issue is the literal duplicate and was closed due to the inactivity, or if it was meant to be used only inside VS Code codebase (at least I see
valueSelection
attribute available in the corresponding file for VS Code))vscode/src/vs/platform/quickinput/common/quickInput.ts
Lines 586 to 589 in a38d2d0
Copying the description from the original description:
Currently there seem to be two text selection modes for
QuickPick
values:If
quickPick.value
is set beforequickPick.show()
is called, then the value (text) will be selected when the quick pick becomes visible, and typing a character will replace the input text unless the selection is changed first.If
quickPick.value
is set afterquickPick.show()
is called, then the caret will be placed at the end of the text value, ready for more characters to be typed at the end.These selection modes seem to be undocumented.
It would be useful to be able to select a range of text rather than all or nothing.This would allow more powerful text input control by extensions. For example, it could be used to facilitate commands with multiple auto-completed arguments. An example API could be something like
The quick pick would be displayed with the word "text" selected.
The text was updated successfully, but these errors were encountered: