plugins/lspsaga: iconsPackage -> icons provider options

This commit is contained in:
Austin Horstman 2024-09-20 13:34:04 -05:00
parent 254b15d066
commit 5ff98645ce
No known key found for this signature in database
2 changed files with 49 additions and 19 deletions

View file

@ -3,6 +3,7 @@
helpers,
config,
pkgs,
options,
...
}:
with lib;
@ -43,7 +44,20 @@ in
"keys"
"borderStyle"
"renamePromptPrefix"
];
]
++ [
# TODO: added 2024-09-20 remove after 24.11
(lib.mkRemovedOptionModule
[
"plugins"
"lspsaga"
"iconsPackage"
]
''
Please use `plugins.web-devicons` or `plugins.mini.modules.icons` with `plugins.mini.mockDevIcons` instead.
''
)
];
options = {
plugins.lspsaga = helpers.neovim-plugin.extraOptionsOptions // {
@ -56,11 +70,6 @@ in
];
};
iconsPackage = lib.mkPackageOption pkgs [
"vimPlugins"
"nvim-web-devicons"
] { nullable = true; };
ui = {
border = helpers.defaultNullOpts.mkBorder "single" "lspsaga" "";
@ -461,18 +470,37 @@ in
};
config = mkIf cfg.enable {
extraPlugins =
[ cfg.package ]
++ optional (
cfg.iconsPackage != null && (cfg.ui.devicon == null || cfg.ui.devicon)
) cfg.iconsPackage;
warnings = mkIf (
# https://nvimdev.github.io/lspsaga/implement/#default-options
(isBool cfg.implement.enable && cfg.implement.enable)
&& (isBool cfg.symbolInWinbar.enable && !cfg.symbolInWinbar.enable)
) [ "You have enabled the `implement` module but it requires `symbolInWinbar` to be enabled." ];
# TODO: added 2024-09-20 remove after 24.11
plugins.web-devicons =
lib.mkIf
(
(cfg.ui.devicon == null || cfg.ui.devicon)
&& !(
config.plugins.mini.enable
&& config.plugins.mini.modules ? icons
&& config.plugins.mini.mockDevIcons
)
)
{
enable = mkOverride 1490 true;
};
warnings =
lib.optional
(
(cfg.ui.devicon == null || cfg.ui.devicon)
&& options.plugins.web-devicons.enable.highestPrio == 1490
)
''
Nixvim (plugins.lspsaga) `web-devicons` automatic installation is deprecated.
Please use `plugins.web-devicons` or `plugins.mini.modules.icons` with `plugins.mini.mockDevIcons` instead.
''
++ lib.optional (
# https://nvimdev.github.io/lspsaga/implement/#default-options
(isBool cfg.implement.enable && cfg.implement.enable)
&& (isBool cfg.symbolInWinbar.enable && !cfg.symbolInWinbar.enable)
) "You have enabled the `implement` module but it requires `symbolInWinbar` to be enabled.";
extraPlugins = [ cfg.package ];
extraConfigLua =
let
setupOptions =

View file

@ -1,9 +1,11 @@
{
empty = {
plugins.web-devicons.enable = true;
plugins.lspsaga.enable = true;
};
defaults = {
plugins.web-devicons.enable = true;
plugins.lspsaga = {
enable = true;
@ -171,10 +173,10 @@
};
};
no-packages = {
no-icons = {
plugins.web-devicons.enable = false;
plugins.lspsaga = {
enable = true;
iconsPackage = null;
};
};
}