Merge pull request #4115 from ajshedivy/vscode-api/update-submenu-items

VSCoce API: update submenu items on config reload
This commit is contained in:
Tomasz Stefaniak 2025-02-21 08:28:05 -08:00 • committed by GitHub
commit 50f687d732
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 0 deletions

View file

@ -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();

View file

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