From e23a5db71403e65e37938147f688d03abe9b8712 Mon Sep 17 00:00:00 2001 From: Adam Shedivy Date: Wed, 12 Feb 2025 13:50:29 -0600 Subject: [PATCH] Add method to retrieve submenu context provider titles and update messenger on change --- core/config/ConfigHandler.ts | 11 +++++++++++ core/core.ts | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 9d2899153..62a8e4963 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -82,6 +82,17 @@ export class ConfigHandler { void this.init(); } + /** + * 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() { const workspaceId = await this.getWorkspaceId(); const lastSelectedOrgIds = diff --git a/core/core.ts b/core/core.ts index 74b53f833..955758aaf 100644 --- a/core/core.ts +++ b/core/core.ts @@ -138,6 +138,11 @@ export class Core { result: serializedResult, profileId: this.configHandler.currentProfile.profileDescription.id, }); + + // update additional submenu context providers registered via VSCode API + this.messenger.send("refreshSubmenuItems", { + providers: this.configHandler.getAdditionalSubmenuContextProviders() + }); }); this.configHandler.onDidChangeAvailableProfiles((profiles) =>