`Register-EditorCommand` appears broken in preview release
See original GitHub issuePrerequisites
- I have written a descriptive issue title.
- I have searched all issues to ensure it has not already been reported.
- I have read the troubleshooting guide.
- I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
Summary
I am using the Register-EditorCommand in my “Microsoft.VSCode_profile.ps1” profile and assigning it to the alt-f2 in my key bindings file. When I try this with the latest preview, nothing happens. No error, nothing.
If I add a simple “Register-EditorCommand” to my profile file and then try to execute it with the “PowerShell: Show Additional Commands from PowerShell Modules” it appears to hang and/or never return control to the terminal window.
For example if I have something like this in my profile:
Register-EditorCommand -Name TestCommand -DisplayName "Test Command" -ScriptBlock {Write-Host "Test"}
It would normally display “Test” in the terminal and then return control to the terminal. In the preview version it displays “Test” but never returns control. Not sure if you can tell from the screen shots…the first one is the problem (preview version) and the second one is the older release version that works.
So I am not sure if this is the same problem that is happening with the actual script block I am trying to get to work. But it seems odd that it never returns control to the terminal, but in the release version it does. So at this point I am assuming it is related to the problem.
PowerShell Version
Name Value
---- -----
PSVersion 7.2.0
PSEdition Core
GitCommitId 7.2.0
OS Microsoft Windows 10.0.19043
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visual Studio Code Version
1.62.2
3a6960b964327f0e3882ce18fcebd07ed191b316
x64
Extension Version
ms-vscode.powershell@2021.10.2
ms-vscode.powershell-preview@2021.11.0
Steps to Reproduce
- Create a VSCode profile file.
- Add code to profile file to register an editor command:
Register-EditorCommand -Name TestCommand -DisplayName "Test Command" -ScriptBlock {Write-Host "Test"}
- Open a PS1 file in VSCode and try to execute the editor command: “PowerShell: Show Additional Commands from PowerShell Modules”
Visuals
No response
Logs
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (6 by maintainers)
Top GitHub Comments
Thank you.
@SeeminglyScience Easy enough fix, need to interrupt the current prompt lol.