-
-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support optional plugins #3193
Support optional plugins #3193
Conversation
c5a605c
to
6cee21e
Compare
This feels a little special-case-y. Doesn't the |
The |
In that we have to add a new special field to plugin descriptors just to control the default value of one of the generic plugin options. What if we want to, say, have a plugin for which code lenses are off by default? Add another field? Then again, it's not the end of the world to generalize later... |
457c99a
to
99251fd
Compare
That's a good point, I have generalised the scheme to cover all the generic options. |
baf4b5e
to
c240036
Compare
ec0bb1b
to
1ea6e98
Compare
Third attempt, let's see if this is the winner. |
It would be good to get this landed while I still remember the details... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for taking so long to look at this. LGTM, mostly just some documentation nits.
Thanks for the review, I'll get to your comments in a couple of weeks |
This enables opt-in plugins, i.e. plugins that are not enabled by default
This enables opt-in plugins, i.e. plugins that are not enabled by default
53d3194
to
a586121
Compare
…cConfig I can't remember why this was optional in the first place, which probably means no good reason for it to be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
genericDefaultConfig = case configInitialGenericConfig of | ||
config -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
genericDefaultConfig = case configInitialGenericConfig of | |
config -> | |
genericDefaultConfig = |
Read plugin defaults from plugin descriptor instead of copying into initial config This is less fragile as now the initial generic config specified in the plugin descriptor is enforced by construction. The downside is that now the descriptor is needed to parse the config, which means a few places where a plugin id was enough now require a plugin descriptor, which is much harder to get. We paper over this by moving these call sites to the Action monad.
I found a problem with this scheme: if the user specifies config for any plugin, HLS will forget all the initial defaults. This would happen as follows:
I added some tests to track this issue. To make the tests pass, I first considered merging the parsed plugin config map with the previous config map. I ended up implementing a slightly different solution:
I like this solution better because it no longer required initialising the config with the plugin defaults. The downside is that to read the current plugin config, we now need the plugin descriptor, not just the plugin id. This required a bunch of additional changes in plugin code. |
Adds support for plugins that are not enabled by default