Add method to retrieve submenu context provider titles and update messenger on change

This commit is contained in:
Adam Shedivy 2025-02-12 13:50:29 -06:00
parent a8a5841d27
commit e23a5db714
2 changed files with 16 additions and 0 deletions

View file

@ -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 =

View file

@ -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) =>