mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-08 19:46:06 +01:00
modules/lazyload: replace ignoredPackages with isVisible
Instead of explicitly listing all renames and removals, we can check if the plugin's lazyload option is visible and in the top-level option set. This rules out cases where `plugins.foo` is itself a rename/removal option, and cases where `plugins.foo.lazyload` is not visible.
This commit is contained in:
parent
3031d4ab61
commit
6d3798e81e
1 changed files with 9 additions and 15 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
|
options,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
@ -28,24 +29,17 @@ in
|
||||||
];
|
];
|
||||||
warnings =
|
warnings =
|
||||||
let
|
let
|
||||||
ignoredPackages = [
|
isVisible =
|
||||||
# removed
|
opt:
|
||||||
"packer"
|
let
|
||||||
"rust-tools"
|
visible = opt.visible or true;
|
||||||
"nvim-osc52"
|
in
|
||||||
"treesitter-playground"
|
if lib.isBool visible then visible else visible == "shallow";
|
||||||
# renamed
|
|
||||||
"surround"
|
|
||||||
"null-ls"
|
|
||||||
"wilder-nvim"
|
|
||||||
"presence-nvim"
|
|
||||||
"ethersync"
|
|
||||||
];
|
|
||||||
|
|
||||||
pluginsWithLazyLoad = builtins.filter (
|
pluginsWithLazyLoad = builtins.filter (
|
||||||
x:
|
x:
|
||||||
!(lib.elem x ignoredPackages)
|
lib.isOption (options.plugins.${x}.lazyload or null)
|
||||||
&& lib.hasAttr "lazyLoad" config.plugins.${x}
|
&& isVisible options.plugins.${x}.lazyload
|
||||||
&& config.plugins.${x}.lazyLoad.enable
|
&& config.plugins.${x}.lazyLoad.enable
|
||||||
) (builtins.attrNames config.plugins);
|
) (builtins.attrNames config.plugins);
|
||||||
count = builtins.length pluginsWithLazyLoad;
|
count = builtins.length pluginsWithLazyLoad;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue