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/rest: add enableTelescope and revert by-name #2222

Merged
merged 2 commits into from
Sep 11, 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
2 changes: 2 additions & 0 deletions plugins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
./pluginmanagers/lazy.nix
./pluginmanagers/lz-n.nix

./utils/rest.nix

./deprecation.nix
];
}
11 changes: 11 additions & 0 deletions plugins/by-name/rest/default.nix → plugins/utils/rest.nix
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,8 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
Sets up the filetype association of `.http` files to trigger treesitter support to enable `rest` functionality.
'';
};

enableTelescope = lib.mkEnableOption "telescope integration";
};

extraConfig = cfg: {
Expand All @@ -425,8 +427,17 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
Nixvim (plugins.rest): Requires the `http` parser from `plugins.treesitter`, please set `plugins.treesitter.enable`.
'';
}
{
assertion = cfg.enableTelescope -> config.plugins.telescope.enable;
message = ''
Nixvim (plugins.rest): You have `plugins.rest.enableTelescope` set to true, but `plugins.telescope.enable` is false.
Either disable the telescope integration or enable telescope.
'';
}
];

extraConfigLua = lib.mkIf cfg.enableTelescope ''require("telescope").load_extension("rest")'';

extraPackages = [ cfg.curlPackage ];

filetype = lib.mkIf cfg.enableHttpFiletypeAssociation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,15 @@
};
};
};

telescope = {
plugins = {
rest = {
enable = true;
enableTelescope = true;
};
treesitter.enable = true;
telescope.enable = true;
};
};
}