mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
treewide: use mkAssertions where possible
This commit is contained in:
parent
12e658eca8
commit
ce82e5859d
14 changed files with 94 additions and 104 deletions
|
@ -176,15 +176,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = {
|
||||
assertions = [
|
||||
{
|
||||
assertions = lib.nixvim.mkAssertions "plugins.copilot-lua" {
|
||||
assertion = !config.plugins.copilot-vim.enable;
|
||||
message = ''
|
||||
You currently have both `copilot-vim` and `copilot-lua` enabled.
|
||||
Please disable one of them.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: introduced 2025-01-07: remove after 25.05
|
||||
|
|
|
@ -59,12 +59,12 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
extraConfig =
|
||||
cfg:
|
||||
lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertions = lib.nixvim.mkAssertions "plugins.git-worktree" {
|
||||
assertion = cfg.enableTelescope -> config.plugins.telescope.enable;
|
||||
message = ''Nixvim: The git-worktree telescope integration needs telescope to function as intended'';
|
||||
}
|
||||
];
|
||||
message = ''
|
||||
You have to enable `plugins.telescope` as `enableTelescope` is activated.
|
||||
'';
|
||||
};
|
||||
|
||||
extraPackages = [ cfg.gitPackage ];
|
||||
|
||||
|
|
|
@ -191,10 +191,10 @@ in
|
|||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
assertions = [
|
||||
assertions = lib.nixvim.mkAssertions "plugins.harpoon" [
|
||||
{
|
||||
assertion = cfg.enableTelescope -> config.plugins.telescope.enable;
|
||||
message = ''Nixvim: The harpoon telescope integration needs telescope to function as intended'';
|
||||
message = "The harpoon telescope integration needs telescope to function as intended.";
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
@ -231,8 +231,7 @@ in
|
|||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertions = lib.nixvim.mkAssertions "plugins.lean" {
|
||||
assertion =
|
||||
!(
|
||||
# leanls lsp server is disabled in nvim-lspconfig
|
||||
|
@ -252,8 +251,7 @@ in
|
|||
|
||||
https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#leanls
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
extraPackages = [ cfg.leanPackage ];
|
||||
|
||||
|
|
|
@ -94,15 +94,14 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
callSetup = false;
|
||||
hasSettings = false;
|
||||
extraConfig = cfg: {
|
||||
assertions = [
|
||||
{
|
||||
assertions = lib.nixvim.mkAssertions "pluhins.mini" {
|
||||
assertion = cfg.mockDevIcons -> cfg.modules ? icons;
|
||||
message = ''
|
||||
You have enabled `plugins.mini.mockDevIcons` but have not defined `plugins.mini.modules.icons`.
|
||||
This setting will have no effect without it.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
plugins.mini.luaConfig.content =
|
||||
lib.foldlAttrs (lines: name: config: ''
|
||||
${lines}
|
||||
|
|
|
@ -37,12 +37,12 @@ let
|
|||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertions = lib.nixvim.mkAssertions "plugins.neotest.adapters.${name}" {
|
||||
assertion = config.plugins.neotest.enable;
|
||||
message = "Nixvim: you have enabled `plugins.neotest.adapters.${name}` but `plugins.neotest.enable` is `false`.";
|
||||
}
|
||||
];
|
||||
message = ''
|
||||
You have to enable `plugins.telescope` as `enableTelescope` is activated.
|
||||
'';
|
||||
};
|
||||
|
||||
warnings = lib.nixvim.mkWarnings "plugins.neotest.adapters.${name}" {
|
||||
when = !config.plugins.treesitter.enable;
|
||||
|
|
|
@ -137,17 +137,16 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
'';
|
||||
};
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertions = lib.nixvim.mkAssertions "plugins.none-ls" {
|
||||
assertion = cfg.enableLspFormat -> config.plugins.lsp-format.enable;
|
||||
|
||||
message = ''
|
||||
Nixvim: You have enabled the lsp-format integration with none-ls.
|
||||
You have enabled the lsp-format integration with none-ls.
|
||||
However, you have not enabled `plugins.lsp-format` itself.
|
||||
Note: `plugins.none-ls.enableLspFormat` is enabled by default when `plugins.lsp-format` is enabled.
|
||||
`plugins.none-ls.enableLspFormat` definitions: ${lib.options.showDefs options.plugins.none-ls.enableLspFormat.definitionsWithLocations}
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# We only do this here because of enableLspFormat
|
||||
plugins.none-ls.luaConfig.content = ''
|
||||
|
|
|
@ -111,7 +111,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
assertions = lib.nixvim.mkAssertions "plugins.package-info" {
|
||||
assertion = cfg.enableTelescope -> config.plugins.telescope.enable;
|
||||
message = ''
|
||||
The telescope integration needs telescope to function as intended.
|
||||
You have to enable `plugins.telescope` as `enableTelescope` is activated.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
@ -119,16 +119,15 @@ with lib;
|
|||
when = !config.plugins.treesitter.enable;
|
||||
message = "This plugin needs treesitter to function as intended.";
|
||||
};
|
||||
assertions = [
|
||||
{
|
||||
assertions = lib.nixvim.mkAssertions "plugins.rainbow-delimiters" {
|
||||
assertion = (cfg.whitelist == null) || (cfg.blacklist == null);
|
||||
|
||||
message = ''
|
||||
Both `rainbow-delimiters.whitelist` and `rainbow-delimiters.blacklist` should not be
|
||||
set simultaneously.
|
||||
Please remove one of them.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
|
|
|
@ -26,15 +26,14 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
assertions = [
|
||||
{
|
||||
assertions = lib.nixvim.mkAssertions "plugins.refactoring" {
|
||||
assertion = cfg.enableTelescope -> config.plugins.telescope.enable;
|
||||
|
||||
message = ''
|
||||
Nixvim: You have enabled the `telescope` integration with refactoring-nvim.
|
||||
You have enabled the `telescope` integration with refactoring-nvim.
|
||||
However, you have not enabled the `telescope` plugin itself (`plugins.telescope.enable = true`).
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
plugins.telescope.enabledExtensions = mkIf cfg.enableTelescope [ "refactoring" ];
|
||||
};
|
||||
|
|
|
@ -27,7 +27,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
assertions = lib.nixvim.mkAssertions "plugins.telekasten" {
|
||||
assertion = config.plugins.telescope.enable;
|
||||
message = ''
|
||||
Nixvim (plugins.telekasten): The plugin needs telescope to function as intended.
|
||||
You have to enable `plugins.telescope` as `enableTelescope` is activated.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
@ -90,8 +90,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = {
|
||||
assertions = [
|
||||
{
|
||||
assertions = lib.nixvim.mkAssertions "plugins.tiny-devicons-auto-colors" {
|
||||
assertion =
|
||||
config.plugins.web-devicons.enable
|
||||
|| (
|
||||
|
@ -100,10 +99,9 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
&& config.plugins.mini.mockDevIcons
|
||||
);
|
||||
message = ''
|
||||
Nixvim: Either `plugins.web-devicons` or `plugins.mini`* must be enabled to use `tiny-devicons-auto-colors`.
|
||||
Either `plugins.web-devicons` or `plugins.mini`* must be enabled to use `tiny-devicons-auto-colors`.
|
||||
*If using `plugins.mini`, you must enable the `icons` module and the `mockDevIcons` option.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -414,18 +414,18 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
assertions = [
|
||||
assertions = lib.nixvim.mkAssertions "plugins.todo-comments" [
|
||||
{
|
||||
assertion = cfg.keymaps.todoTelescope.key or null != null -> config.plugins.telescope.enable;
|
||||
message = ''
|
||||
Nixvim(plugins.todo-comments): You have enabled todo-comment's `telescope` integration.
|
||||
You have enabled todo-comment's `telescope` integration.
|
||||
However, you have not enabled the `telescope` plugin itself (`plugins.telescope.enable = true`).
|
||||
'';
|
||||
}
|
||||
{
|
||||
assertion = cfg.keymaps.todoTrouble.key or null != null -> config.plugins.trouble.enable;
|
||||
message = ''
|
||||
Nixvim(plugins.todo-comments): You have enabled todo-comment's `trouble` integration.
|
||||
You have enabled todo-comment's `trouble` integration.
|
||||
However, you have not enabled the `trouble` plugin itself (`plugins.trouble.enable = true`).
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -363,7 +363,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
{
|
||||
assertion = cfg.enableTelescope -> config.plugins.telescope.enable;
|
||||
message = ''
|
||||
The telescope integration needs telescope to function as intended
|
||||
You have to enable `plugins.telescope` as `enableTelescope` is activated.
|
||||
'';
|
||||
}
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue