Skip to content

RFC: Remove (or move, or improve) Register-EditorCommand, $psEditor etc. #3563

Closed
@andyleejordan

Description

@andyleejordan

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.

Summary

I have just discovered (after maintaining this extension for the better part of the year) this entire interface around registration of editor commands. It's somewhat documented, but it doesn't seem to completely work.

I found this as I was going through our package's contributed commands, specifically one of the entry points to it: InvokeRegisteredEditorCommand. In #2225 this command was supposed to be exposed in the command palette:

{
"command": "PowerShell.InvokeRegisteredEditorCommand",
"when": "false"
}

But because of the false there it never was. Changing it to true does expose it, but it fails:

Command 'PowerShell: Invoke Registered Editor Command' resulted in an error (Running the contributed command: 'PowerShell.InvokeRegisteredEditorCommand' failed.)

Additionally, I attempted to follow the documented examples. While registration of commands appears to work, and some of simple examples work (such as MyModule.MyCommandWithFunction), complicated commands like MyModule.MyEditCommand which expect a working context do not currently work.

Finally, as previously noted in PowerShell/PowerShellEditorServices#1444, all of the tests for this functionality were long ago disabled.

So it's hard for me to say that this functionality is supported. Clearly it's not in use enough to be receiving bug reports despite being broken.

Proposed Design

Personally, in the name of simplification, I default to removing code that is not in use, not covered in tests, and not contributing to the core extension experience. However, I'm opening this Request For Comment because it is possible others are using this (somehow). If this code is to remain around, at the bare minimum the tests need to be brought back online. I'm not saying I'm about to delete this code right now, but I am saying I don't currently see why or how it should continue to be maintained considering its current state, hence I'm seeking feedback/education/help.

Pinging @TylerLeonhardt, @daviwil, @rjmholt, @SeeminglyScience, @TobiasPSP for comments.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions