question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Register-EditorCommand` appears broken in preview release

See original GitHub issue

Prerequisites

  • 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. image

image

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:closed
  • Created 2 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Feb 24, 2022

Thank you.

1reaction
andschwacommented, Feb 23, 2022

@SeeminglyScience Easy enough fix, need to interrupt the current prompt lol.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix Broken Registry Items in Windows 10 - groovyPost
In the Registry Editor window, confirm you want to restore the Windows Registry by pressing the Yes option. Confirming a Registry backup repair....
Read more >
Corrupted Registry Unable to Boot - How To Fix with CMD ...
My only way to work on the system is to boot into the installation USB, and navigate to the command prompt. Whenever I...
Read more >
How to Get Rid of Broken Registry Items | Simple-Steps Guide
Open the run prompt command by simultaneously pressing Press Windows and R keys. Key in cmd, then simultaneously press Shift and Ctrl and...
Read more >
How to Fix Corrupt Registry in Windows 10 - Lifewire
Enter this command in the Command Prompt to scan for corrupted Windows system files and repair them. Use a Registry cleaner program. These...
Read more >
Use command-line options to edit registries with regedit.exe
Learn about these hidden regedit command-line options you can use to adjust the Windows registry when you need to make quick edits.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found