Skip to content

Dev notes on using extension services #236760

Open
@roblourens

Description

Inspired by #236537

I've found it a little confusing to find the right extension service to work with so here are some random notes on things that have tripped me up.

  • There are many different services with "extension" in the name, and when I need to do something, it's hard to know where to start.
    • Probably the most common ones are IExtensionService, IExtensionsWorkbenchService, IExtensionManagementService, and I don't fully understand the distinction
  • In the above issue, we used IExtensionManagementService#getInstalled
    getInstalled(type?: ExtensionType, profileLocation?: URI, productVersion?: IProductVersion): Promise<ILocalExtension[]>;
    to check whether the Copilot extension was installed. This seemed reasonable but it actually returns all local and remote extensions, whether enabled or disabled due to being in the wrong EH. And, it returns them the two sets in random order based on a race. I think this is a serious footgun.
    • And I think we've made the same mistake in other places. If I look at references to getInstalled I see a lot of usages. eg I get @ext: completions in the settings editor for workspace extensions in a remote window that are only installed locally and not on the remote
    • I think IExtensionsWorkbenchService#queryLocal was the right thing to use but there's also IExtensionService#extensions and I'm not sure what the difference is
  • There are two different types called IExtension at and
    export interface IExtension {
  • The name queryLocal and ILocalExtension were a little confusing now that "remote extensions" exist

Some things that might help could be some tsdoc on the services and methods that explain when to use them or what exactly they return. Or a .md doc file with a "guide to extensions services" that lays this stuff out.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions