Extension should notify user when Constrained or Restricted language mode is enabled
Please fill in these details so that we can help you!
System Details
- Operating system name and version: Windows 10 Enterprise 64-bit (1607)
- VS Code version: 1.5.1
- PowerShell extension version: 0.7.2
- Output from
$PSVersionTable:
Name Value
---- -----
PSVersion 5.1.14393.103
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.103
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Issue Description
Everytime when I open any PS script with VS Code and PS extension installed I get these errors:
Error: Could not start language service: undefined Error: Couldn't start client PowerShell Editor Services
Attached Logs
Follow the instructions in the README about capturing and sending logs.
Hi @z442a9, it appears that your machine must have some policy set which enabled ConstrainedLanguage mode. This is preventing the language service from loading successfully.
Open a normal PowerShell prompt and run this line and let me know if the output is ConstrainedLanguage or RestrictedLanguage:
$ExecutionContext.SessionState.LanguageMode
You may have to talk to your administrator to see if this can be turned off for the PowerShell extension to work correctly. I'll add a warning message in the UI to notify the user that the extension won't work when this mode is turned on.
Hi
When I run the command the output is: ConstrainedLanguage
Hello, I see that this issue is still open but notification is already here for a long time for me in VS Code. Isn't it time to move to next step, i.e. removing the need for the message by supporting constrained mode like Powershell ISE does?
Because we're not a native app (like the ISE), but instead a client/server, with the server being a PowerShell process running a module that hosts PowerShell execution, I suspect trying to implement this we'd have widespread problems with things like the whitelisted types (i.e. EditorServices is just an ordinary PowerShell module which uses non-whitelisted types for everything from just starting the host to creating the message transport channel, so getting it to start in ConstrainedLanguage mode would be a significant work item).
I'll see if I can do some investigating on the feasibility of this.
Closing this in favor of #754