Closed
Description
Prerequisites
- I have written a descriptive issue title.
- I have searched all issues to ensure it has not already been reported.
- I have read the troubleshooting guide.
- I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
- If this is a security issue, I have read the security issue reporting guidance.
Summary
When using System.Management.Automation.Host.ChoiceDescription in VSCode terminal, I have to press the key two times. First keypress will not be shown. The keypress will even be delivered to the next entry line and cloak it at the front.
It works in PSextension v2021.12.0 but NOT in current preview.
PowerShell Version
Name Value
---- -----
PSVersion 5.1.19041.1320
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.1320
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Visual Studio Code Version
1.65.2
c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1
x64
Extension Version
ms-vscode.powershell@2021.12.0
ms-vscode.powershell-preview@2022.3.0
tobysmith568.run-in-powershell@1.1.1
Steps to Reproduce
Use this code:
$AvailableEnvironments = @(
@{Choice = '&IAT'; Value = "IAT"; Help = "Test" }
@{Choice = '&Prod'; Value = "Prod"; Help = "Production" }
@{Choice = '&Dev'; Value = "Dev"; Help = "Development" }
)
$title = "Please choose the environment"
$msg = "Which environment do you want to use ?"
$Choices = foreach ($Choice in $AvailableEnvironments) {
New-Object System.Management.Automation.Host.ChoiceDescription $Choice.Choice, $Choice.Help
}
$options = $Choices
$default = 0 # 0=Yes, 1=No
$response = $Host.UI.PromptForChoice($title, $msg, $options, $default)
$MainEnvironment = $AvailableEnvironments[$response].Value
$MainEnvironment
Visuals
Pressed "P" as an answer and then hit enter like expected.
Behaviour: Default value will be used instead and the "P" will end up in the input-line:
Logs
No response