From b34379e9819d171b7ab8f268bdf05dc0b699b3c6 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Tue, 17 Sep 2024 23:56:54 -0500 Subject: [PATCH] plugins/package-info: add telescope integration --- plugins/by-name/package-info/default.nix | 18 +++++++++++++++++- .../plugins/by-name/package-info/default.nix | 11 +++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/plugins/by-name/package-info/default.nix b/plugins/by-name/package-info/default.nix index 8af43cad..de18fa3d 100644 --- a/plugins/by-name/package-info/default.nix +++ b/plugins/by-name/package-info/default.nix @@ -1,6 +1,7 @@ { lib, pkgs, + config, ... }: let @@ -91,6 +92,8 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin { }; extraOptions = { + enableTelescope = lib.mkEnableOption "the `package_info` telescope picker."; + packageManagerPackage = lib.mkPackageOption pkgs [ @@ -104,5 +107,18 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin { }; }; - extraConfig = cfg: { extraPackages = [ cfg.packageManagerPackage ]; }; + extraConfig = cfg: { + assertions = [ + { + assertion = cfg.enableTelescope -> config.plugins.telescope.enable; + message = '' + Nixvim (plugins.package-info): The telescope integration needs telescope to function as intended. + ''; + } + ]; + + extraPackages = [ cfg.packageManagerPackage ]; + + plugins.telescope.enabledExtensions = lib.mkIf cfg.enableTelescope [ "package_info" ]; + }; } diff --git a/tests/test-sources/plugins/by-name/package-info/default.nix b/tests/test-sources/plugins/by-name/package-info/default.nix index afcbad9a..ffaddd89 100644 --- a/tests/test-sources/plugins/by-name/package-info/default.nix +++ b/tests/test-sources/plugins/by-name/package-info/default.nix @@ -28,4 +28,15 @@ }; }; }; + + with-telescope = { + plugins = { + telescope.enable = true; + + package-info = { + enable = true; + enableTelescope = true; + }; + }; + }; }