zowe / zowe-explorer-vscode

Visual Studio Code Extension for Zowe, which lets users interact with z/OS Data Sets, Unix System Services, and Jobs on a remote mainframe instance. Powered by Zowe SDKs.
Eclipse Public License 2.0
159 stars 89 forks source link

Don't require extenders to call `registerCustomProfilesType` #2868

Open t1m0thyj opened 2 months ago

t1m0thyj commented 2 months ago

I believe the second block of code you posted would be the right approach with the current state of the ProfilesCache. In initForZowe we do a refresh of the profiles cache, and during that refresh, we get all the types using ProfilesCache.getAllProfileTypes. If you do not call registerCustomProfilesType beforehand, it will not consider that type unless it has already been registered under one of the APIs (MVS, USS, or JES).

That was my assumption too since it makes total sense to have an external profile type registered before the attempt of refreshing the cache. I think, before that extra reloadProfiles() call was actually protecting us from the problems by refreshing one more time, when all the parameters are actually set.

Ideally, I'd like to register those custom types as a part of the logic in initForZowe so that extenders don't have to call registerCustomProfilesType - rather, we can do it ourselves during initialization if the type doesn't already exist. I don't think this would be breaking since allExternalTypes is already a set, so continuing to call the registerCustomProfilesType function from an extender's perspective shouldn't affect anything.

Those were my thoughts exactly! Moreover, if the order of those calls is crucial to make it work right, I would expect it to be called internally by initForZowe() and at the right time to avoid making a mistake as the extender.

Originally posted by @roman-kupriyanov in https://github.com/zowe/zowe-explorer-vscode/issues/2838#issuecomment-2061409832

github-actions[bot] commented 2 months ago

Thank you for raising this enhancement request. The community has 90 days to vote on it. If the enhancement receives at least 10 upvotes, it is added to our development backlog. If it receives fewer votes, the issue is closed.

roman-kupriyanov commented 2 months ago

Thanks @t1m0thyj for the follow up 🙏 It would be nice to have the ZE API init process even more simplified and less error prone for the extenders 👍