From 5ff98645ce3e52fced5f1a9f07bb9b741993ca7c Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Fri, 20 Sep 2024 13:34:04 -0500 Subject: [PATCH] plugins/lspsaga: iconsPackage -> icons provider options --- plugins/by-name/lspsaga/default.nix | 62 ++++++++++++++----- .../plugins/by-name/lspsaga/default.nix | 6 +- 2 files changed, 49 insertions(+), 19 deletions(-) diff --git a/plugins/by-name/lspsaga/default.nix b/plugins/by-name/lspsaga/default.nix index ebc94f9b..66962836 100644 --- a/plugins/by-name/lspsaga/default.nix +++ b/plugins/by-name/lspsaga/default.nix @@ -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 = diff --git a/tests/test-sources/plugins/by-name/lspsaga/default.nix b/tests/test-sources/plugins/by-name/lspsaga/default.nix index 255e0d3f..d9508ba2 100644 --- a/tests/test-sources/plugins/by-name/lspsaga/default.nix +++ b/tests/test-sources/plugins/by-name/lspsaga/default.nix @@ -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; }; }; }