Some providers should be deregistered/re-registered when the related feature is disabled/enabled
Right now, we're always registering our providers in client.ts, even if the associated feature is disabled by settings.
If multiple providers are registered, depending on the feature, VS Code may invoke multiple and merge their results. So, in most cases, having our provider registered will not interfere with other extensions providing the same feature. But enabling/disabling of the feature's UI entry-point can be an issue.
For example, if C_Cpp.formatting is set to disabled, we should deregister our provider(s). Otherwise, if the user right-clicks on the document, they are still provided with options to format the document, despite those commands being effectively disabled. Unregistering the provider(s) should cause the option to not be offered.
The repro I encountered is related to the formatting provider(s), but we should check if the same scenario can arise for other providers.
Providers are currently registered once for all workspace folders (in the first client). However, we have settings that can enable/disable features separately between workspace folders. As currently implemented, we would need to unregister a provider only when all workspace folders no longer need it and enable it when any one workspace folder needs it.
We may need to open an issue against VS Code and request either:
a) a way to register providers separately for each workspace folder. (Possibly problematic, as VS Code would need to assume what workspace folder to associate with files that aren't under any workspace folder.)
or b) a way to disable entry points (such as the Formatting options on the file context menu) for certain providers, on a per file basis - perhaps giving the extension some opportunity (other than existence of a register provider) to decide if it should be shown.