-
Notifications
You must be signed in to change notification settings - Fork 491
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
PowerShell Integrated Console clarification questions (syntax highlighting and execution policy) #1217
Comments
The syntax highlighting you refer to is a function of the PSReadLine module which is not yet compatible with the integrated terminal. This is due to change soon though: #535 As far as the execution policy, I'm not aware of a way to set the via VSCode settings, but the integrated console does honor the settings from Set-ExecutionPolicy If you want the integrated console to use a different policy, I'd probably put it in my $profile.currentUserAllHosts inside an if statement. |
Thanks for the info @dsolodow. The default Integrated Terminal does seem to honor Set-ExecutionPolicy when set in an independent PowerShell window, but the "PowerShell Integrated Console" that loads with the vscode-powershell extension does not seem to honor it (see screenshot). It seems to default to "RemoteSigned". When I try to set the policy within the PS Integrated Console it errors (see screenshot). Somehow the powershell process being kicked off by the vscode-powershell extension seems to be setting a policy of RemoteSigned that cannot be overwritten? |
Fascinating. What happens if you run Set-ExecutionPolicy Unrestricted -Scope Process |
It appears it may be configurable by adding the following line of code to Microsoft.VSCode_profile.ps1.
Let me know if this is the only way you know of. Thanks @dsolodow ! |
Yeah, adding it to the profile was something I mentioned earlier. :) If ($host.Name -eq 'Visual Studio Code Host')
{
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
} |
Thanks. Sorry I didn't make that connection at first. :) Thanks for the pointer on the general profile script. |
I tried setting the execution policy in the profile for integrated console, but the integrated console won't run the profile script for the exact same reason. Anyone have any ideas? |
@thenning can you attach your logs so that we can better assist :) Here's the doc: |
System Details
$PSVersionTable
:Name Value
PSVersion 5.1.15063.786
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.15063.786
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
1.20.1
f88bbf9137d24d36d968ea6b2911786bfe103002
x64
Major Minor Build Revision
1 6 0 0
ms-python.python@2018.1.0
ms-vscode.PowerShell@1.6.0
nhoizey.gremlins@0.7.0
robertohuertasm.vscode-icons@7.20.0
Key : PSVersion
Value : 5.1.15063.786
Name : PSVersion
Key : PSEdition
Value : Desktop
Name : PSEdition
Key : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0...}
Name : PSCompatibleVersions
Key : BuildVersion
Value : 10.0.15063.786
Name : BuildVersion
Key : CLRVersion
Value : 4.0.30319.42000
Name : CLRVersion
Key : WSManStackVersion
Value : 3.0
Name : WSManStackVersion
Key : PSRemotingProtocolVersion
Value : 2.3
Name : PSRemotingProtocolVersion
Key : SerializationVersion
Value : 1.1.0.1
Name : SerializationVersion
Issue Description
I have two questions about the behavior of the vscode-powershell extension.
Attached Logs
Follow the instructions in the README
about capturing and sending logs.
The text was updated successfully, but these errors were encountered: