Skip to content

Add a public API to enable add-on extensions #2537

Open
@SeeminglyScience

Description

@SeeminglyScience

Summary of the new feature

As a writer of a PowerShellEditorServices extension I want to enable users to install a vscode extension containing my module.

I need that extension to be able to:

  1. Use the integrated console to install the module from the gallery, or provide an additional PSModulePath
  2. Import the PSES extension module on vscode extension activation

I want that extension to be able to:

  1. Register new requests and notifications that PSES would redirect to my module

The current install process is as follows:

  1. Install the module manually from the gallery
  2. Add an Import-Module statement to your profile
  3. Manually add keybinds to keybinds.json (using syntax you can only determine from reading vscode-powershell's source or a posted example)

That's a lot to ask of folks just to try out a module.

Proposed technical implementation details (optional)

The getExtension function allows vscode extensions to acquire a public API from another extension. This API would need to be surfaced by vscode-powershell internally, and optionally (though ideally) a typescript type definition would also be published to npm.

The bare minimum needed in this API would be an exported function that just imports a module from a path. Something like:

tryImportPowerShellModule(path: string) => bool

Edit: Actually a simple import function would be pretty inconsistent since it would be lost every time the console was restarted/version changed. Maybe something like:

registerPSESExtensionModule(path: string) => void;

Where vscode-powershell internally tracks registered modules and reimports them at startup.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions