Skip to content

args not passed to script being debugged from launch.json #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pkskelly opened this issue Nov 23, 2015 · 3 comments
Closed

args not passed to script being debugged from launch.json #24

pkskelly opened this issue Nov 23, 2015 · 3 comments
Assignees
Labels
Issue-Enhancement A feature request (enhancement). Up for Grabs Will shepherd PRs.
Milestone

Comments

@pkskelly
Copy link

I have tried several combinations of "args": [] and none of them produce a $args in the debugger. Should the "args" parameter for a configuration work? Looking through the source but not finding anything yet.
{
"version": "0.1.0",
"configurations": [
{
"name": "PowerShell",
"type": "PowerShell",
"program": "PowerShell Scripts/output.ps1",
"args": ["Verbose:$true"],
"request": "launch"
}
]
}

The debugger launches fine, but attempts using "-Verbose", "-Verbose:$true", or "/Verbose:$true" do not get passed to $args. The "output.ps1" file is very simple:

Write-Output $args
Get-Process
Write-Verbose -Message "Debugging PS in VSCode!"

@daviwil
Copy link
Contributor

daviwil commented Nov 23, 2015

Hi Pete,

Currently this 'args' parameter is for arguments to the launched process, they currently don't get sent along to the script that is debugged. This is great feedback though, I'll try to make this possible in a future release.

Thanks!

@pkskelly
Copy link
Author

Thanks @daviwil

@daviwil daviwil added the Issue-Enhancement A feature request (enhancement). label Nov 24, 2015
@daviwil daviwil added the Up for Grabs Will shepherd PRs. label Dec 1, 2015
@rkeithhill rkeithhill added this to the 0.4.0 milestone Feb 7, 2016
@rkeithhill rkeithhill self-assigned this Feb 7, 2016
@rkeithhill
Copy link
Contributor

I have a working prototype for this. It requires changes mostly on the PSES side but there are a few changes required to the package.json file as well. For your case you would pass the parameter like so:

"args": ["-Verbose"],

or if you wanted to get pedantic:

"args": ["-Verbose:$true"],

or

"args": ["-Verbose:", "$true"],

Essentially the args string gets passed directly to the script to execute. If there is more than one args string, then I would join them with a space and pass that string to the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement A feature request (enhancement). Up for Grabs Will shepherd PRs.
Projects
None yet
Development

No branches or pull requests

3 participants