diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index e4360b761..659584056 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -92,6 +92,17 @@ export class ConfigHandler { }); } + /** + * Retrieves the titles of additional context providers that are of type "submenu". + * + * @returns {string[]} An array of titles of the additional context providers that have a description type of "submenu". + */ + getAdditionalSubmenuContextProviders(): string[] { + return this.additionalContextProviders + .filter(provider => provider.description.type === "submenu") + .map(provider => provider.description.title); + } + private async init() { try { await this.fetchControlPlaneProfiles(); diff --git a/core/core.ts b/core/core.ts index 8316068d5..8a9df812e 100644 --- a/core/core.ts +++ b/core/core.ts @@ -128,6 +128,14 @@ export class Core { profileId: this.configHandler.currentProfile?.profileDescription.id ?? null, }); + + // update additional submenu context providers registered via VSCode API + const additionalProviders = this.configHandler.getAdditionalSubmenuContextProviders(); + if (additionalProviders.length > 0) { + this.messenger.send("refreshSubmenuItems", { + providers: additionalProviders, + }); + } }); this.configHandler.onDidChangeAvailableProfiles(