-
-
Notifications
You must be signed in to change notification settings - Fork 295
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
plugins/lsp: migrate to mkNeovimPlugin #2700
base: main
Are you sure you want to change the base?
Conversation
9225cec
to
f07663d
Compare
|
||
inherit (lib) mkOption types; |
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.
inherit (lib) mkOption types; | |
inherit (lib.nixvim) defaultNullOpts mkNullOrOption; | |
inherit (lib) mkOption types; |
Just at a glance, this will allow you to get rid of lib.nixvim.
in this file.
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.
It looks like there is more than that
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.
I'm in favour of inheriting anything that is used a lot. I'm not against being explicit, but defaultNullOpts
for example gets used a ton.
preConfig = mkOption { | ||
type = types.lines; | ||
description = "Code to be run before loading the LSP. Useful for requiring plugins"; | ||
default = ""; |
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.
I wonder if preConfig
and postConfig
can be rename-alias modules pointing to lubConfig.pre
and luaConfig.post
respectively?
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.
I think it could, but it would need a little refactor
]; | ||
default = [ ]; | ||
lspBuf = mkOption { | ||
type = with types; attrsOf (either str (attrsOf anything)); |
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.
I'm thinking we can a) use type coercion to reduce the post-processing and b) use our standard lib.nixvim.keymaps.mapOptionSubmodule
for increased consistency.
We may need to extend mapOptionSubmodule
to support key
defaulting to the attr-name though.
I'm thinking something like
type = coercedTo str (action: {inherit action;}) mapOptionSubmodule;
(Although we'd actually need to use the map-option submodule factory to produce a slightly customised type)
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.
I like the idea, but I don't know if it would be possible to make it backwards-compatible. But if it is not a problem, then I think this is better.
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.
When migrating plugins to mkNeovimPlugin it's acceptable to introduce some breaking changes. You can mark the old option as removed with instructions on how to migrate
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.
You can mark the old option as removed with instructions on how to migrate
This only really applies when the new option has a different name/location.
If the old "removed" option has the same name as the new option that doesn't work.
In this case, I think we can do a migration without breaking changes. But since the option isn't being renamed, it can wait until after this PR.
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.
Yeah I meant for options that we move from the top-level to settings
, but if this option does not move then there's not much we can do
fd103de
to
73d5833
Compare
73d5833
to
923bdc1
Compare
It should probably be fine, since I didn't change anything besides support for mode