API Proposal for multiline quick input
See original GitHub issueProblem
Currently there’s no way to take a multiline input via showInputBox
. We need one because we use showInputBox
to take the commit message (which can be multiline) in git extension. (#40295, #39969)
Solution APIs
TLDR: allow passing a multiline
property to the showInputBox
options
-
PROPOSED API: Allow passing a
multiline
property to theshowInputBox
options.-
Problem: Users can have
{ multiline: true, password: true }
which won’t work because it’s a textarea. More importantly in future there could be more options applicable to only multiline (eg an option mapping to textarea’srow
attribute) or to only singleline-
PROPOSED Solution: It’s okay just document it
-
Solution: It’s okay just document it and throw an error if such case arises
-
Solution: make the type of options like
{ multiline?: false, password?: boolean } | { multiline?: true, password?: false }
- Problem: Terrible typescript inference and error message ergonomics if the options are not literal
- Problem: It’s typescript-only solutiton
-
-
-
API: Have another function called
showMultilineInputBox
that takes options only applicable to it (meaning doesn’t takepassword
property as option)- Problem: Feels a little overkill especially at the moment as we only one option (ie
password
) exclusive to singleline. It would have been okay if we had a bunch of options only exclusive to multiline egmaxHeight
,autoGrow
,initialRows
, etc. or bunch of options exclusive to singleline
- Problem: Feels a little overkill especially at the moment as we only one option (ie
Solution Behaviors
TLDR: when multiline
is set to true, showInputBox
shows a multline quick input where the user hits shift+enter to insert a newline and works exactly like current quick input
- PROPOSED Behavior: Allow users to insert a newline with shift+enter instead of submitting
- Behavior: Allow users to insert a newline with enter instead of submitting and have shift+enter submit it.
- Problem: The behavior is not “additive” to singleline behavior as user would expect enter to submit it in multiline also as it does in singleline
- Behavior: Allow users to insert a newline with enter instead of submitting and have a button to submit it.
- Problem: Kinda kills the whole point of “quick input” you’ll have to press tab to focus to button and hit enter, foreign to quick action ui and not additive to singleline behavior
Implementation
Issue Analytics
- State:
- Created 3 years ago
- Reactions:50
- Comments:11 (5 by maintainers)
Top GitHub Comments
Just started coding my extension for VSCode, it lacs basic UI input methods. No multiline inputs, no way to design a simple dialog box (we need to use Electron apps like the Color Palette is using and do IPC…). I’m surprised VScode extension API lacks so many basic features.
Feature needed, pleaaaase 😃