-
Notifications
You must be signed in to change notification settings - Fork 29.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to bring up a dialog with multiple inputs #9936
Comments
Note that my particular use case would be satisfied by an API call that only presents a series of input boxes, with no quick picks allowed, e.g.
or
However, as I was writing the suggested API, I thought, "Well, why not allow both input boxes and quick picks together in a single dialog, like how HTML forms aren't limited to just text inputs?" But it might turn out to be better/simpler to keep the two concepts separate, and just write a |
I don't think the |
As I mentioned earlier (exactly a year ago, as it happens), I think the |
is this going anywhere? we'd love to see this being implemented, would even help in this. |
would love to use vscode native for wizards -- seems i am not alone. also this would be useful cross platform - the linux label is probably restrictive as pointed out twice by the post author |
@ZenMagus feel free to test https://github.com/redhat-developer/vscode-wizard |
Hi @jeffmaury thank you for taking the time to show me @jasongin 's repository. I actually did look at this before posting and it looks nice. Coming from an Eclipse background I am trying to use vscode native for most things, including wizards. - i may have to go down the 'use a webview for everything' route though as the vscode scaffolding is taking a long time to mature but am trying to resist. Thanks again, |
This would be great to have. |
Feature request
It would be nice if an extension could present a single dialog with multiple input fields. For example, the New Project command in Ionide asks for project directory and project name, and it would be nice to be able to input both at once in a single dialog. Another use case: I would like to implement the Project Scaffold init script as another option in Ionide's New Project setup. It asks at least seven questions (more if you choose to let it run
git init
for you), and asking each question one at a time in separate dialogs makes for a less-than-ideal user experience. I'd like to be able to present all seven questions in a single dialog.Suggested API
showInputDialog(options: Map<string, InputBoxOptions|QuickPickOptions>, quickPickItems?: Map<string, string[] | Thenable<string[]>>): Thenable<Map<string,string>>
options
is an ES6 Map whose keys are the names of the fields we're asking the user to fill in. The user won't see these names, but they will be used as the keys of the resulting Map object. Their ordering matters, since the order of the keys in the Map will be used as the order in which to present the fields in the interaction dialog. (If using an ES6 Map is not yet possible in VS Code, thenoptions
would be a plain old Javascript object. In that case, an additionalfieldOrder
parameter, an array of strings, would be required -- see below for suggested API if ES6 Map is not yet possible).The values of the
options
Map will be the InputBoxOptions or QuickPickOptions for that particular field in the interaction dialog. These will be treated exactly as they are in theshowInputBox
andshowQuickPick
functions. If any values of theoptions
Map areQuickPickOptions
, then thequickPickItems
parameter is required. Its keys must match the keys ofoptions
that have aQuickPickOptions
value, and its value is the list of items to pick from (exactly equivalent to theitems
parameter of theshowQuickPick
function). And, just likeshowQuickPick
, there would need to be another overload that would match theshowQuickPick<T extends QuickPickItem>(items: T[] | Thenable<T[]>, ...)
overload. I.e.,showInputDialog<T extends QuickPickItem>(options: Map<string, InputBoxOptions|QuickPickOptions>, quickPickItems?: Map<string, T[] | Thenable<T[]>>): Thenable<Map<string,string|T>>
The difference between this and the non-generic
showInputDialog
would be exactly the same as the difference betweenshowQuickPick<T>
and non-genericshowQuickPick
, so I won't go into further detail on this overload.The return value of
showInputDialog
would be a promise that resolves to an ES6 Map whose keys are the same as the keys of theoptions
parameter, and whose values are the result of what the user typed. If the user canceled the dialog by pressing Escape, the values of the Map will beundefined
; otherwise, they will be strings in the case ofInputBoxOptions
fields, and either strings orT
instances in the case ofQuickPickOptions
fields (whereT
, of course, extendsQuickPickItem
, and is only returned in the generic version ofshowInputDialog
).As mentioned above, if it is not yet possible in VS Code's codebase to use an ES6 Map, then my suggested API would look like:
showInputDialog(fieldOrder: string[], options: object, quickPickItems?: object): Thenable<object>
or:
showInputDialog<T extends QuickPickItem>(fieldOrder: string[], options: object, quickPickItems?: object): Thenable<object>
for the generic version (returning
T
instances, rather than strings, for any QuickPick fields). The keys and values of the input and output objects would be identical to theMap
version; only thefieldOrder
parameter is added to specify the order in which the fields should be listed in the dialog.Usage example
Since that specification is a bit hard to read, here is an example.
The text was updated successfully, but these errors were encountered: