Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugins/project-nvim: take ownership of telescope integration #1236

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
plugins/utils/project-nvim: take ownership of telescope integration
  • Loading branch information
khaneliman committed Mar 13, 2024
commit 697bf0604b25d8206f06292b251f6fa9349ee722
1 change: 0 additions & 1 deletion plugins/telescope/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ in {
./fzf-native.nix
./fzy-native.nix
./media-files.nix
./project-nvim.nix
./ui-select.nix
./undo.nix
];
Expand Down
16 changes: 0 additions & 16 deletions plugins/telescope/project-nvim.nix

This file was deleted.

19 changes: 19 additions & 0 deletions plugins/utils/project-nvim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
with lib; let
cfg = config.plugins.project-nvim;
in {
imports = [
(lib.mkRenamedOptionModule
["plugins" "telescope" "extensions" "project-nvim" "enable"]
["plugins" "project-nvim" "enableTelescope"])
];

options.plugins.project-nvim =
helpers.neovim-plugin.extraOptionsOptions
// {
Expand Down Expand Up @@ -67,9 +73,20 @@ in {
(with types; either str helpers.nixvimTypes.rawLua)
''{__raw = "vim.fn.stdpath('data')";}''
"Path where project.nvim will store the project history for use in telescope.";

enableTelescope = mkEnableOption ''
When set to true, enabled project-nvim telescope integration.
'';
};

config = mkIf cfg.enable {
warnings =
optional
(cfg.enableTelescope && (!config.plugins.telescope.enable))
''
Telescope support for project-nvim is enabled but the telescope plugin is not.
'';

extraPlugins = [cfg.package];

extraConfigLua = let
Expand All @@ -89,5 +106,7 @@ in {
in ''
require('project_nvim').setup(${helpers.toLuaObject setupOptions})
'';

plugins.telescope.enabledExtensions = mkIf cfg.enableTelescope ["projects"];
};
}
11 changes: 11 additions & 0 deletions tests/test-sources/plugins/utils/project-nvim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
plugins.project-nvim.enable = true;
};

telescopeEnabled = {
plugins.telescope = {
enable = true;
};

plugins.project-nvim = {
enable = true;
enableTelescope = true;
};
};

defaults = {
plugins.project-nvim = {
enable = true;
Expand Down