Skip to content

Commit

Permalink
plugins/package-info: add telescope integration
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Sep 18, 2024
1 parent d4b1827 commit b34379e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
18 changes: 17 additions & 1 deletion plugins/by-name/package-info/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
lib,
pkgs,
config,
...
}:
let
Expand Down Expand Up @@ -91,6 +92,8 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
};

extraOptions = {
enableTelescope = lib.mkEnableOption "the `package_info` telescope picker.";

packageManagerPackage =
lib.mkPackageOption pkgs
[
Expand All @@ -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" ];
};
}
11 changes: 11 additions & 0 deletions tests/test-sources/plugins/by-name/package-info/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,15 @@
};
};
};

with-telescope = {
plugins = {
telescope.enable = true;

package-info = {
enable = true;
enableTelescope = true;
};
};
};
}

0 comments on commit b34379e

Please sign in to comment.