vscode-powershell: Canceling prompt is not possible in preview extension

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.

Summary

When you use mandatory parameters and it prompts you to enter value it’s impossible to cancel it with CTRL+C or SHIFT+F5. You need to go thru the whole process and then it stops.

function Test-Me {
    [cmdletBinding()]
    param(
        [Parameter(Mandatory = $true)] $Test
    )
}

Test-Me

Same thing applies to Read-Host

PowerShell Version

Name                           Value
----                           -----
PSVersion                      5.1.22000.282
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22000.282
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
TylerLeonhardt.vscode-inline-values-powershell@0.0.5

Steps to Reproduce

  1. Run any command that has mandatory parameters
  2. Try to cancel it
  3. Alternatively try with Read-Host
  4. Try to cancel it

Visuals

No response

Logs

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 34 (30 by maintainers)

Most upvoted comments

I’m on cutting edge Windows 11 😉 It’s not a blocker at all. Lately, I’m really enjoying the plugin and its features. don’t have to restart, everything seems to work. This is one of those things that shows up, but I know I can just press CTRL+C, and a few times enter and it will work 😉

I typed the command, it prompted - i typed text … pressed CTRL+C, it didn’t work, I pressed enter - and as you see below it didn’t assign the value to anything.

image

That means CTRL+C actually worked, but I think it’s related to other issue that sometimes you need to press ENTER to see the prompt when the script is “done”. It may be just visual bug.

Thank you guys! Sorry for this false bug report.

I have it disabled "terminal.integrated.windowsEnableConpty": false, after enabling it —> IT WORKS!

But it doesn’t repro for you… so maybe some of my settings is affecting this.

It’s strange, for sure, and I want to get it fixed. Thank you for the kind words, we’re really working on launching this soon to the stable channel. We know it’s not perfect, but are increasingly convinced that it’s much better than it was. Preparing hopefully the second-to-last preview right now!