vscode-powershell icon indicating copy to clipboard operation
vscode-powershell copied to clipboard

PowerShell Integrated Console Does Not Work in Constrained Language Mode

Open My-Random-Thoughts opened this issue 4 years ago • 1 comments

Prerequisites

  • [X] I have written a descriptive issue title.
  • [X] I have searched all issues to ensure it has not already been reported.
  • [X] I have read the troubleshooting guide.
  • [ ] I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.

Summary

When in ConstrainedLanguage mode the PowerShell integrated console does not load correctly. All I get is the title message: =====> PowerShell Integrated Console v2021.6.2 <=====

This affects both x32 and x64 terminals.

PowerShell Version

Name                           Value
----                           -----
PSVersion                      5.1.18362.1593
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.1593
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Visual Studio Code Version

`code --version` does not return any output

Version: 1.58.2 (user setup)
Commit: c3f126316369cd610563c75b1b1725e0679adfb3
Date: 2021-07-14T22:10:15.214Z (1 wk ago)
Electron: 12.0.13
Chrome: 89.0.4389.128
Node.js: 14.16.0
V8: 8.9.255.25-electron.0
OS: Windows_NT x64 10.0.18363

Extension Version

[email protected]
`code --{anything}` does not produce any output

PowerShell v2021.6.2 is installed

Steps to Reproduce

Open VSCode, Create New PowerShell Document, Integrated Terminal should open automatically if configured Wait until the heat-death of the universe for it to complete opening

My settings file contains only the following configured terminals:

    "terminal.integrated.profiles.windows":{
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"
        },
    },
    "terminal.integrated.defaultProfile.windows": "PowerShell",

Visuals

No response

Logs

Logs.zip

My-Random-Thoughts avatar Jul 28 '21 11:07 My-Random-Thoughts

Unfortunately we don't currently have extensive tests for Constrained Language Mode compatibility, so while this feature was at one point implemented, we have no way to guarantee that it will continue to work. We will need to work on our side to add sufficient testing so that we can both get the feature working again and then assert (with some amount of confidence) that it'll continue to work. I'm sorry 😢

andyleejordan avatar Aug 03 '21 22:08 andyleejordan

Is there any update on when this may get fixed? I am still using the ISE because of this issue.

My-Random-Thoughts avatar Jan 23 '23 13:01 My-Random-Thoughts

We are currently targeting CLM support in March.

andyleejordan avatar Feb 09 '23 18:02 andyleejordan

Hi there, I tested this out today and it appears now to be functional! I put $ExecutionContext.SessionState.LanguageMode = "ConstrainedLanguage" in my VS Code PowerShell Profile, started the extension, and then in the (functional!) Extension Terminal verified it was set correctly:

PowerShell Extension v2023.5.1
Copyright (c) Microsoft Corporation.

https://aka.ms/vscode-powershell
Type 'help' to get help.

@andys-mac-mini ~/src/vscode-powershell main ≡ +0 ~1 -0 !
> $ExecutionContext.SessionState.LanguageMode                                                                          
ConstrainedLanguage

I then opened a PowerShell script and confirmed that completions and references were working, and was able to start the debugger.

Please let me know if there's anything in particular still broken, but I believe this is resolved!

andyleejordan avatar May 16 '23 00:05 andyleejordan

I'm going to leave this open and "In Progress" until I write some unit tests to continue to verify the above.

andyleejordan avatar May 16 '23 00:05 andyleejordan

Ok, we still have tests...I'm not certain they're running in CI since they require admin. Working on it!

andyleejordan avatar Aug 17 '23 22:08 andyleejordan

Actually, check it, they are! https://dev.azure.com/powershell/PowerShellEditorServices/_build/results?buildId=136511&view=logs&j=1d88a50b-1bd3-5f17-9c4b-9c70eafa81c4&t=c3b24a8d-8e43-56b3-baec-e178a6e665b5&l=556

andyleejordan avatar Aug 17 '23 22:08 andyleejordan