-
Notifications
You must be signed in to change notification settings - Fork 490
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
Run Script in External PowerShell Console, accepting parameter #705
Comments
I'm not sure why, but the descriptions on points 2 and 3 are showing as code. Sorry! |
When you run in the integrated terminal you can pass parameters to this script. Click on the gear icon in the debug view to edit the launch.json file:
Add your args to the For the external console debug support, you can |
@rkeithhill
...and this is the test script I'm try to run:
The editor's status bar turns orange, but the script doesn't appear to execute. Regarding the external launch: |
@rkeithhill I bounced the editor, and now the debugger is actually running the script - so that bit is better now. So, if I understand how this is supposed to be working, the |
This seems to be a bug in the handling of an |
@rkeithhill Is it possible to have the editor interactively prompt you for this value (like it does for the PID)? |
OK I looked into the ignored arguments issue. The problem doesn't reside in VSCode. The args get passed to the PowerShellEditorServices:
The problem in PSES is that we execute the unsaved editor contents by essentially asking PowerShell to execute the string @daviwil We might be able to work around this by wrapping the string like so: if (arguments != null)
{
scriptString = string.Forma("& {{ {0} }} {1}", scriptString, arguments);
}
psCommand.AddScript(scriptString); There are probably several ways to make this work. What do you think? |
@mpearon RE prompting for arguments ... this is a feature from PowerGUI editor that I miss. I think we might be able to do this. I'm going to look into it. If I can make it work, you'll probably have to replace the |
I want this UI to remember the args you typed in the previous debug session so you don't have to keep re-entering the same values (at least during the same VSCode session). But there appears to be a bug in VSCode (or I'm using it wrong). Waiting to get resolution on this before finalizing the PR for this feature. |
@rkeithhill @daviwil |
If there are no objections from @rkeithhill and @daviwil , I'll close this issue. |
Ahh! I didn't realize we hadn't closed it out yet :) Thanks Matthew! |
System Details
$PSVersionTable
:PSVersion 5.1.14393.1066
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.1066
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Issue Description
The ability to run a script in an external console from within vsCode would be awesome.
This feature was present in PowerGUI, but broke with the release of Win10 v1607 - and I don't have a machine pre-1607 around, so I can't demonstrate the feature in its entirety...but what I can show follows.
There were two ways to execute a script, and a way to pass a parameter to both methods:
1. Running in integrated terminal
This did just want vsCode does, but it offered an extra feature that I'll mention in No. 3.
The text was updated successfully, but these errors were encountered: