Skip to content

Commit

Permalink
plugins/rest-nvim: add telescope integration
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Sep 11, 2024
1 parent 7484be8 commit 11c133e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions 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
11 changes: 11 additions & 0 deletions tests/test-sources/plugins/utils/rest.nix
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;
};
};
}

0 comments on commit 11c133e

Please sign in to comment.