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.
Summary
Currently when you invoke an unsaved script with this launch config:
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell: Current File",
"script": "${file}",
"args": [],
"cwd": "${file}"
},
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell: Current File w/ Args",
"script": "${file}",
"args": [
"${command:SpecifyScriptArgs}"
],
"cwd": "${file}"
},
Given a simple unsaved script that says:
"This is a {0} test" -f $args[0]
The run occurs like this:
. $args[0] "This is a test -f $args[0]"
(Note the first args[0] isn't specified in the script)
And produces no output.
Instead it should be using either the call operator or the '.' operator (this should be a configurable preference to determine if variables remain in scope of the PSIC or not):
.{<scriptGoesHere>} <argsGoHere>
So for this example, running the script with the 'fun' arg should result in the command:
.{"This is a {0} test" -f $args[0]} fun
Which produces the intended result.
PowerShell Version
Name Value
---- -----
PSVersion 7.1.4
PSEdition Core
GitCommitId 7.1.4
OS Microsoft Windows 10.0.22000
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visual Studio Code Version
1.62.0-insider
dc1a6699060423b8c4d2ced736ad70195378fddf
x64
Extension Version
ms-vscode.powershell-preview@2021.10.3
Steps to Reproduce
See description
Visuals
No response
Logs
No response