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
Currently, in order to get any information from the user, an extension has the following options:
showInputBox()
showQuickPick()
Both of those methods allow getting a single piece of information. (as opposed to a form containing multiple fields for the user to fill in)
While this is particularly efficient for getting simple data. (e.g. a "Rename" command might use showInputBox() to get the new name of a variable) it is (IMHO) rather inconvenient for getting more complex information.
For instance, if an extension wants to show a "wizard" that creates a new project in the currently open directory, an intuitive way would be to show a "window" that allows the user to fill in such parameters as:
Project name
The version of the language/standard to use
Project template
etc.
Since, VSCode doesn't provide an API for showing custom windows, the only way for getting these information would be to show consecutive input boxes. (using showInputBox())
This means:
The user has to remember what they have entered
If the user remembers making a mistake in a previously validated input box, they have to cancel and start over
A concrete example of such behavior can be seen in the yo extension.
Having all the fields displayed simultaneously would allow the user to:
Write AND correct themselves without having to start all over each time they make a mistake
Have a recap of all the information that has been entered and make changes if needed
Some extensions (e.g. CMake Tools) are working around this limitation by:
Showing an HTML page that contains input fields, buttons, etc. (implementing TextDocumentContentProvider)
Getting the information back using an HTTP server and WebSockets
(Perhaps, I haven't checked, but seems doable) Updating the content of the HTML page if needed
Clever!
I think, however, that it would be better if VSCode provided some API for showing simple, custom windows that would (at least) allow getting multiple data at once.
Currently, in order to get any information from the user, an extension has the following options:
showInputBox()
showQuickPick()
Both of those methods allow getting a single piece of information. (as opposed to a form containing multiple fields for the user to fill in)
While this is particularly efficient for getting simple data. (e.g. a "Rename" command might use
showInputBox()
to get the new name of a variable) it is (IMHO) rather inconvenient for getting more complex information.For instance, if an extension wants to show a "wizard" that creates a new project in the currently open directory, an intuitive way would be to show a "window" that allows the user to fill in such parameters as:
Since, VSCode doesn't provide an API for showing custom windows, the only way for getting these information would be to show consecutive input boxes. (using
showInputBox()
)This means:
A concrete example of such behavior can be seen in the yo extension.
Having all the fields displayed simultaneously would allow the user to:
Some extensions (e.g. CMake Tools) are working around this limitation by:
TextDocumentContentProvider
)Clever!
I think, however, that it would be better if VSCode provided some API for showing simple, custom windows that would (at least) allow getting multiple data at once.
Some ideas:
showForm([{fieldName: "name", fieldType: "type"}...], okCallback, cancelCallback)
showDialog(message, okCallback)
showFancyWindow(be, creative)
The text was updated successfully, but these errors were encountered: