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.

Add a public API to enable add-on extensions

See original GitHub issue

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<T> 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.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:6
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
EklipZgitcommented, Jun 23, 2020

I believe it is very important that features like those in EditorServicesCommandSuite be addable as extensions. Some of that functionality is incredibly important to powershell development, and the vast, vast majority of users are probably completely unaware of its existence. Heck, everyone I know that uses it found out about it from twitter, or by wishing features existed and googling it and finding https://sqldbawithabeard.com/2018/03/11/easily-splatting-powershell-with-vs-code/

Ease of discovery, ease of use, reliability are all lacking here, and having better extension support (and better keymapping support, ideally) should improve discovery and ease of use. The number of users using EditorServicesCommandSuite is probably abysmally small compared to the number of users that would benefit from it.

1reaction
SeeminglySciencecommented, Mar 11, 2020

Yeah that’s something. That would at least take away the burden of updating away from the user. Not sure if that’s an implementation detail we’d want to encourage folks to depend on though.

Also that, and also the setting to force imports (if we have/had it) would have a lot of timing issues. Especially if both extensions are starting, and mine needs to update or something. Ideally it would be something the PSIC could also handle after initialization.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Proposed API - Visual Studio Code
These are the steps for testing a proposed API in local extension development: Use Insiders release of VS Code. To your package.json ,...
Read more >
Using the Chrome Web Store Publish API
Overview. The Chrome Web Store Publish API provides a set of REST endpoints for programmatically creating, updating, and publishing items in ...
Read more >
Using the Microsoft Edge Add-ons API
To use the Microsoft Edge Add-ons API, you need to enable the API for your project in the Microsoft Partner Center, by creating...
Read more >
Extensions—ArcGIS REST APIs
This resource is a collection of all the custom server object extensions that have been uploaded and registered with the server. You can...
Read more >
Extending the REST API (REST Application Developer's Guide)
Use the resource service extension capability to make new REST service endpoints available through a REST Client API instance. To make a resource...
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