treewide: use mkWarnings where possible

This commit is contained in:
Gaetan Lepage 2025-01-29 14:16:00 +01:00
parent abba4af10b
commit 12e658eca8
34 changed files with 309 additions and 225 deletions

View file

@ -45,14 +45,16 @@ in
) (builtins.attrNames config.plugins); ) (builtins.attrNames config.plugins);
count = builtins.length pluginsWithLazyLoad; count = builtins.length pluginsWithLazyLoad;
in in
lib.optionals (count > 0 && !config.plugins.lz-n.enable) [ lib.nixvim.mkWarnings "lazy loading" {
'' when = count > 0 && !config.plugins.lz-n.enable;
message = ''
You have enabled lazy loading support for the following plugins but have not enabled a lazy loading provider. You have enabled lazy loading support for the following plugins but have not enabled a lazy loading provider.
${lib.concatImapStringsSep "\n" (i: x: "${toString i}. plugins.${x}") pluginsWithLazyLoad} ${lib.concatImapStringsSep "\n" (i: x: "${toString i}. plugins.${x}") pluginsWithLazyLoad}
Currently supported lazy providers: Currently supported lazy providers:
- lz-n - lz-n
'' '';
]; };
}; };
} }

View file

@ -166,10 +166,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
] ]
]; ];
in in
lib.optional (definedOpts != [ ]) '' lib.nixvim.mkWarnings "plugins.auto-save" {
Nixvim(plugins.auto-save): The following settings options are no longer supported. when = definedOpts != [ ];
message = ''
The following settings options are no longer supported.
Check the plugin documentation for more details.: Check the plugin documentation for more details.:
${lib.concatMapStringsSep "\n" (opt: " - ${lib.showOption (lib.toList opt)}") definedOpts} ${lib.concatMapStringsSep "\n" (opt: " - ${lib.showOption (lib.toList opt)}") definedOpts}
''; '';
}; };
};
} }

View file

@ -50,18 +50,23 @@ lib.nixvim.plugins.mkNeovimPlugin {
copilot-lua-cfg = config.plugins.copilot-lua.settings; copilot-lua-cfg = config.plugins.copilot-lua.settings;
isEnabled = b: builtins.isBool b && b; isEnabled = b: builtins.isBool b && b;
in in
lib.optionals (isEnabled copilot-lua-cfg.suggestion.enabled) [ lib.nixvim.mkWarnings "plugins.blink-cmp-copilot" [
'' {
when = isEnabled copilot-lua-cfg.suggestion.enabled;
message = ''
It is recommended to disable copilot's `suggestion` module, as it can interfere with It is recommended to disable copilot's `suggestion` module, as it can interfere with
completions properly appearing in blink-cmp-copilot. completions properly appearing in blink-cmp-copilot.
'' '';
] }
++ lib.optionals (isEnabled copilot-lua-cfg.panel.enabled) [ {
'' when = isEnabled copilot-lua-cfg.panel.enabled;
message = ''
It is recommended to disable copilot's `panel` module, as it can interfere with completions It is recommended to disable copilot's `panel` module, as it can interfere with completions
properly appearing in blink-cmp-copilot. properly appearing in blink-cmp-copilot.
'' '';
}
]; ];
plugins.copilot-lua.enable = lib.mkDefault true; plugins.copilot-lua.enable = lib.mkDefault true;
}; };
} }

View file

@ -44,8 +44,11 @@ lib.nixvim.plugins.mkNeovimPlugin {
}; };
extraConfig = cfg: { extraConfig = cfg: {
warnings = lib.optional (cfg.settings ? documentation) '' warnings = lib.nixvim.mkWarnings "plugins.blink" {
Nixvim(plugins.blink): `settings.documentation` does not correspond to a known setting, use `settings.windows.documentation` instead. when = cfg.settings ? documentation;
message = ''
`settings.documentation` does not correspond to a known setting, use `settings.windows.documentation` instead.
''; '';
}; };
};
} }

View file

@ -60,14 +60,22 @@ lib.nixvim.plugins.mkNeovimPlugin {
copilot-lua-cfg = config.plugins.copilot-lua.settings; copilot-lua-cfg = config.plugins.copilot-lua.settings;
isEnabled = b: (lib.isBool b && b); isEnabled = b: (lib.isBool b && b);
in in
lib.optional (isEnabled copilot-lua-cfg.suggestion.enabled) '' lib.nixvim.mkWarnings "plugins.copilot-cmp" [
{
when = isEnabled copilot-lua-cfg.suggestion.enabled;
message = ''
It is recommended to disable copilot's `suggestion` module, as it can interfere with It is recommended to disable copilot's `suggestion` module, as it can interfere with
completions properly appearing in copilot-cmp. completions properly appearing in copilot-cmp.
'' '';
++ lib.optional (isEnabled copilot-lua-cfg.panel.enabled) '' }
{
when = isEnabled copilot-lua-cfg.panel.enabled;
message = ''
It is recommended to disable copilot's `panel` module, as it can interfere with completions It is recommended to disable copilot's `panel` module, as it can interfere with completions
properly appearing in copilot-cmp. properly appearing in copilot-cmp.
''; '';
}
];
plugins.copilot-lua.enable = lib.mkDefault true; plugins.copilot-lua.enable = lib.mkDefault true;
}; };

View file

@ -470,16 +470,16 @@ lib.nixvim.plugins.mkNeovimPlugin {
}; };
extraConfig = cfg: { extraConfig = cfg: {
warnings = warnings = lib.nixvim.mkWarnings "plugins.fidget" {
lib.optionals when =
(
(builtins.isBool cfg.settings.integration.nvim-tree.enable) (builtins.isBool cfg.settings.integration.nvim-tree.enable)
&& cfg.settings.integration.nvim-tree.enable && cfg.settings.integration.nvim-tree.enable
&& !config.plugins.nvim-tree.enable && !config.plugins.nvim-tree.enable;
)
[ message = ''
"Nixvim(plugins.fidget): You have set `plugins.fidget.settings.integrations.nvim-tree.enable` to true but have not enabled `plugins.nvim-tree`." You have set `plugins.fidget.settings.integrations.nvim-tree.enable` to true but have not enabled `plugins.nvim-tree`.
]; '';
};
}; };
inherit (import ./deprecations.nix { inherit lib; }) imports optionsRenamedToSettings; inherit (import ./deprecations.nix { inherit lib; }) imports optionsRenamedToSettings;

View file

@ -105,11 +105,14 @@ lib.nixvim.plugins.mkNeovimPlugin {
extraConfig = cfg: opts: { extraConfig = cfg: opts: {
# TODO: deprecated 2024-08-29 remove after 24.11 # TODO: deprecated 2024-08-29 remove after 24.11
warnings = lib.optionals opts.iconsEnabled.isDefined [ warnings = lib.nixvim.mkWarnings "plugins.fzf-lua" {
'' when = opts.iconsEnabled.isDefined;
message = ''
The option definition `plugins.fzf-lua.iconsEnabled' in ${lib.showFiles opts.iconsEnabled.files} has been deprecated; please remove it. The option definition `plugins.fzf-lua.iconsEnabled' in ${lib.showFiles opts.iconsEnabled.files} has been deprecated; please remove it.
'' '';
]; };
# TODO: added 2024-09-20 remove after 24.11 # TODO: added 2024-09-20 remove after 24.11
plugins.web-devicons = plugins.web-devicons =
lib.mkIf lib.mkIf

View file

@ -14,8 +14,9 @@ lib.nixvim.plugins.mkNeovimPlugin {
hasSettings = false; hasSettings = false;
hasLuaConfig = false; hasLuaConfig = false;
extraConfig = { extraConfig = {
warnings = lib.optional ( warnings = lib.nixvim.mkWarnings "plugins.hmts" {
!config.plugins.treesitter.enable when = !config.plugins.treesitter.enable;
) "Nixvim: hmts needs treesitter to function as intended"; message = "hmts needs treesitter to function as intended";
};
}; };
} }

View file

@ -135,33 +135,28 @@ lib.nixvim.plugins.mkNeovimPlugin {
}; };
extraConfig = cfg: { extraConfig = cfg: {
warnings = warnings = lib.nixvim.mkWarnings "plugins.lazydev" [
lib.optionals {
( when =
builtins.isBool cfg.settings.integrations.cmp builtins.isBool cfg.settings.integrations.cmp
&& !config.plugins.cmp.enable && !config.plugins.cmp.enable
&& cfg.settings.integrations.cmp && cfg.settings.integrations.cmp;
) message = "You have enabled nvim-cmp integration but plugins.cmp is not enabled.";
[ "Nixvim(plugins.lazydev): you have enabled nvim-cmp integration but plugins.cmp is not enabled." ] }
++ {
lib.optionals when =
(
builtins.isBool cfg.settings.integrations.lspconfig builtins.isBool cfg.settings.integrations.lspconfig
&& !config.plugins.lsp.enable && !config.plugins.lsp.enable
&& cfg.settings.integrations.lspconfig && cfg.settings.integrations.lspconfig;
) message = "You have enabled lspconfig integration but plugins.lsp is not enabled.";
[ }
"Nixvim(plugins.lazydev): you have enabled lspconfig integration but plugins.lsp is not enabled." {
] when =
++
lib.optionals
(
builtins.isBool cfg.settings.integrations.coq builtins.isBool cfg.settings.integrations.coq
&& !config.plugins.coq-nvim.enable && !config.plugins.coq-nvim.enable
&& cfg.settings.integrations.coq && cfg.settings.integrations.coq;
) message = "You have enabled coq integration but plugins.coq-nvim is not enabled.";
[ }
"Nixvim(plugins.lazydev): you have enabled coq integration but plugins.coq-nvim is not enabled."
]; ];
}; };
} }

View file

@ -90,9 +90,12 @@ lib.nixvim.plugins.mkNeovimPlugin {
}; };
extraConfig = cfg: { extraConfig = cfg: {
warnings = lib.mkIf (!config.plugins.lsp.enable) [ warnings = lib.nixvim.mkWarnings "plugins.lsp-format" {
"You have enabled `plugins.lsp-format` but have `plugins.lsp` disabled." when = !config.plugins.lsp.enable;
]; message = ''
This plugin requires `plugins.lsp` to be enabled.
'';
};
plugins.lsp = { plugins.lsp = {
onAttach = onAttach =

View file

@ -467,11 +467,16 @@ in
{ {
enable = mkOverride 1490 true; enable = mkOverride 1490 true;
}; };
warnings = lib.optional ( warnings = lib.nixvim.mkWarnings "plugins.ltex-extra" {
# https://nvimdev.github.io/lspsaga/implement/#default-options # https://nvimdev.github.io/lspsaga/implement/#default-options
when =
(isBool cfg.implement.enable && cfg.implement.enable) (isBool cfg.implement.enable && cfg.implement.enable)
&& (isBool cfg.symbolInWinbar.enable && !cfg.symbolInWinbar.enable) && (isBool cfg.symbolInWinbar.enable && !cfg.symbolInWinbar.enable);
) "You have enabled the `implement` module but it requires `symbolInWinbar` to be enabled.";
message = ''
You have enabled the `implement` module but it requires `symbolInWinbar` to be enabled.
'';
};
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];
extraConfigLua = extraConfigLua =

View file

@ -44,10 +44,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
}; };
extraConfig = cfg: { extraConfig = cfg: {
warnings = optional (!config.plugins.lsp.enable) '' warnings = lib.nixvim.mkWarnings "plugins.ltex-extra" {
when = !config.plugins.lsp.enable;
message = ''
You have enabled `ltex-extra` but not the lsp (`plugins.lsp`). You have enabled `ltex-extra` but not the lsp (`plugins.lsp`).
You should set `plugins.lsp.enable = true` to make use of the LTeX_extra plugin's features. You should set `plugins.lsp.enable = true` to make use of the LTeX_extra plugin's features.
''; '';
};
plugins.lsp = { plugins.lsp = {
servers.ltex = { servers.ltex = {

View file

@ -211,16 +211,27 @@ lib.nixvim.plugins.mkNeovimPlugin {
modules = cfg.settings.load or { }; modules = cfg.settings.load or { };
telescopeModuleEnabled = (modules."core.integrations.telescope" or null) != null; telescopeModuleEnabled = (modules."core.integrations.telescope" or null) != null;
in in
(lib.optional (telescopeModuleEnabled && (!cfg.telescopeIntegration.enable)) '' lib.nixvim.mkWarnings "plugins.neorg" [
{
when = telescopeModuleEnabled && (!cfg.telescopeIntegration.enable);
message = ''
You have enabled the telescope neorg module (`core.integrations.telescope`) but have not enabled `plugins.neorg.telescopeIntegration.enable`. You have enabled the telescope neorg module (`core.integrations.telescope`) but have not enabled `plugins.neorg.telescopeIntegration.enable`.
The latter will install the `neorg-telescope` plugin necessary for this integration to work. The latter will install the `neorg-telescope` plugin necessary for this integration to work.
'') '';
++ (lib.optional (cfg.telescopeIntegration.enable && (!config.plugins.telescope.enable)) '' }
{
when = cfg.telescopeIntegration.enable && (!config.plugins.telescope.enable);
message = ''
Telescope support for neorg is enabled but the telescope plugin is not. Telescope support for neorg is enabled but the telescope plugin is not.
'') '';
++ (lib.optional ((modules ? "core.defaults") && (!config.plugins.treesitter.enable)) '' }
{
when = (modules ? "core.defaults") && (!config.plugins.treesitter.enable);
message = ''
Neorg's `core.defaults` module is enabled but `plugins.treesitter` is not. Neorg's `core.defaults` module is enabled but `plugins.treesitter` is not.
Treesitter is required when using the `core.defaults`. Treesitter is required when using the `core.defaults`.
''); '';
}
];
}; };
} }

View file

@ -126,13 +126,16 @@ lib.nixvim.plugins.mkNeovimPlugin {
}; };
in in
{ {
warnings = lib.optional (cfg.enableLspFormat && cfg.settings.on_attach != null) '' warnings = lib.nixvim.mkWarnings "plugins.none-ls" {
when = cfg.enableLspFormat && cfg.settings.on_attach != null;
message = ''
You have enabled the lsp-format integration with none-ls. You have enabled the lsp-format integration with none-ls.
However, you have provided a custom value to `plugins.none-ls.settings.on_attach`. However, you have provided a custom value to `plugins.none-ls.settings.on_attach`.
This means the `enableLspFormat` option will have no effect. This means the `enableLspFormat` option will have no effect.
Final value is: Final value is:
${lib.generators.toPretty { } cfg.settings.on_attach} ${lib.generators.toPretty { } cfg.settings.on_attach}
''; '';
};
assertions = [ assertions = [
{ {

View file

@ -23,9 +23,10 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
warnings = warnings = lib.nixvim.mkWarnings "plugins.none-ls.sources.formatting.prettier" {
lib.optional (opt.disableTsServerFormatter.highestPrio == defaultPrio && ts-ls-cfg.enable) when = opt.disableTsServerFormatter.highestPrio == defaultPrio && ts-ls-cfg.enable;
''
message = ''
You have enabled the `prettier` formatter in none-ls. You have enabled the `prettier` formatter in none-ls.
You have also enabled the `ts_ls` language server which also brings a formatting feature. You have also enabled the `ts_ls` language server which also brings a formatting feature.
@ -33,6 +34,7 @@ in
`plugins.none-ls.sources.formatting.prettier.disableTsServerFormatter` to `true`. `plugins.none-ls.sources.formatting.prettier.disableTsServerFormatter` to `true`.
- Else, to silence this warning, explicitly set the option to `false`. - Else, to silence this warning, explicitly set the option to `false`.
''; '';
};
plugins.lsp.servers.ts_ls = plugins.lsp.servers.ts_ls =
lib.mkIf (cfg.enable && ts-ls-cfg.enable && cfg.disableTsServerFormatter) lib.mkIf (cfg.enable && ts-ls-cfg.enable && cfg.disableTsServerFormatter)

View file

@ -23,9 +23,10 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
warnings = warnings = lib.nixvim.mkWarnings "plugins.none-ls.sources.formatting.prettierd" {
lib.optional (opt.disableTsServerFormatter.highestPrio == defaultPrio && ts-ls-cfg.enable) when = opt.disableTsServerFormatter.highestPrio == defaultPrio && ts-ls-cfg.enable;
''
message = ''
You have enabled the `prettierd` formatter in none-ls. You have enabled the `prettierd` formatter in none-ls.
You have also enabled the `ts_ls` language server which also brings a formatting feature. You have also enabled the `ts_ls` language server which also brings a formatting feature.
@ -33,6 +34,7 @@ in
`plugins.none-ls.sources.formatting.prettierd.disableTsServerFormatter` to `true`. `plugins.none-ls.sources.formatting.prettierd.disableTsServerFormatter` to `true`.
- Else, to silence this warning, explicitly set the option to `false`. - Else, to silence this warning, explicitly set the option to `false`.
''; '';
};
plugins.lsp.servers.ts_ls = plugins.lsp.servers.ts_ls =
lib.mkIf (cfg.enable && ts-ls-cfg.enable && cfg.disableTsServerFormatter) lib.mkIf (cfg.enable && ts-ls-cfg.enable && cfg.disableTsServerFormatter)

View file

@ -76,14 +76,12 @@ with lib;
}; };
in in
mkIf cfg.enable { mkIf cfg.enable {
warnings = [ warnings = lib.nixvim.mkWarnings "plugins.nvim-osc52" ''
'' This plugin is obsolete and will be removed after 24.11.
Nixvim(plugins.nvim-osc52): this plugin is obsolete and will be removed after 24.11.
As of Neovim 0.10, native support for OSC52 has been added. As of Neovim 0.10, native support for OSC52 has been added.
See `:h clipboard-osc52` for more details: https://neovim.io/doc/user/provider.html#clipboard-osc52 See `:h clipboard-osc52` for more details: https://neovim.io/doc/user/provider.html#clipboard-osc52
Definitions: ${lib.options.showDefs options.plugins.nvim-osc52.enable.definitionsWithLocations} Definitions: ${lib.options.showDefs options.plugins.nvim-osc52.enable.definitionsWithLocations}
'' '';
];
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];

View file

@ -100,14 +100,15 @@ lib.nixvim.plugins.mkNeovimPlugin {
}; };
extraConfig = cfg: { extraConfig = cfg: {
warnings = warnings = lib.nixvim.mkWarnings "plugins.otter" {
lib.optional when =
(config.plugins.treesitter.enable -> config.plugins.treesitter.settings.highlight.enable == null) config.plugins.treesitter.enable -> config.plugins.treesitter.settings.highlight.enable == null;
'' message = ''
NixVim(plugins.otter): you have enabled otter, but treesitter syntax highlighting is not enabled. You have enabled otter, but treesitter syntax highlighting is not enabled.
Otter functionality might not work as expected without it. Make sure `plugins.treesitter.settings.highlight.enable` and `plugins.treesitter.enable` are enabled. Otter functionality might not work as expected without it. Make sure `plugins.treesitter.settings.highlight.enable` and `plugins.treesitter.enable` are enabled.
''; '';
};
plugins.lsp.onAttach = lib.mkIf cfg.autoActivate '' plugins.lsp.onAttach = lib.mkIf cfg.autoActivate ''
require('otter').activate() require('otter').activate()

View file

@ -19,9 +19,12 @@ lib.nixvim.plugins.mkNeovimPlugin {
}; };
extraConfig = cfg: { extraConfig = cfg: {
warnings = lib.optional (cfg.enableTelescope && (!config.plugins.telescope.enable)) '' warnings = lib.nixvim.mkWarnings "plugins.persisted" {
Telescope support for `plugins.persisted` is enabled but the telescope plugin is not. when = cfg.enableTelescope && (!config.plugins.telescope.enable);
message = ''
Telescope support (enableTelescope) is enabled but the telescope plugin is not.
''; '';
};
plugins.telescope.enabledExtensions = lib.mkIf cfg.enableTelescope [ "persisted" ]; plugins.telescope.enabledExtensions = lib.mkIf cfg.enableTelescope [ "persisted" ];
}; };

View file

@ -120,9 +120,12 @@ lib.nixvim.plugins.mkNeovimPlugin {
}; };
extraConfig = cfg: { extraConfig = cfg: {
warnings = lib.optional (cfg.enableTelescope && (!config.plugins.telescope.enable)) '' warnings = lib.nixvim.mkWarnings "plugins.project-nvim" {
Telescope support for project-nvim is enabled but the telescope plugin is not. when = cfg.enableTelescope && (!config.plugins.telescope.enable);
message = ''
Telescope support (enableTelescope) is enabled but the telescope plugin is not.
''; '';
};
plugins.telescope.enabledExtensions = lib.mkIf cfg.enableTelescope [ "projects" ]; plugins.telescope.enabledExtensions = lib.mkIf cfg.enableTelescope [ "projects" ];
}; };

View file

@ -115,9 +115,10 @@ with lib;
cfg = config.plugins.rainbow-delimiters; cfg = config.plugins.rainbow-delimiters;
in in
mkIf cfg.enable { mkIf cfg.enable {
warnings = optional ( warnings = lib.nixvim.mkWarnings "plugins.rainbow-delimiters" {
!config.plugins.treesitter.enable when = !config.plugins.treesitter.enable;
) "Nixvim: treesitter-rainbow needs treesitter to function as intended"; message = "This plugin needs treesitter to function as intended.";
};
assertions = [ assertions = [
{ {
assertion = (cfg.whitelist == null) || (cfg.blacklist == null); assertion = (cfg.whitelist == null) || (cfg.blacklist == null);

View file

@ -122,16 +122,20 @@ lib.nixvim.plugins.mkVimPlugin {
}; };
extraConfig = cfg: { extraConfig = cfg: {
warnings = warnings = lib.nixvim.mkWarnings "plugins.schemastore" [
(optional (!(cfg.json.enable || cfg.yaml.enable)) '' {
NixVim(plugins.schemastore): you have enabled the plugin, but neither `json` or `yaml` schemas are enabled. when = !(cfg.json.enable || cfg.yaml.enable);
'') message = "You have enabled the plugin, but neither `json` or `yaml` schemas are enabled.";
++ (optional (!(cfg.json.enable -> config.plugins.lsp.servers.jsonls.enable)) '' }
NixVim(plugins.schemastore): you have enabled `json` schemas, but `plugins.lsp.servers.jsonls` is not enabled. {
'') when = !(cfg.json.enable -> config.plugins.lsp.servers.jsonls.enable);
++ (optional (!(cfg.yaml.enable -> config.plugins.lsp.servers.yamlls.enable)) '' message = "You have enabled `json` schemas, but `plugins.lsp.servers.jsonls` is not enabled.";
NixVim(plugins.schemastore): you have enabled `yaml` schemas, but `plugins.lsp.servers.yamlls` is not enabled. }
''); {
when = !(cfg.yaml.enable -> config.plugins.lsp.servers.yamlls.enable);
message = "You have enabled `yaml` schemas, but `plugins.lsp.servers.yamlls` is not enabled.";
}
];
plugins.lsp.servers = { plugins.lsp.servers = {
jsonls.settings = mkIf cfg.json.enable { jsonls.settings = mkIf cfg.json.enable {

View file

@ -97,8 +97,9 @@ lib.nixvim.plugins.mkNeovimPlugin {
}; };
extraConfig = { extraConfig = {
warnings = mkIf (!config.plugins.treesitter.enable) [ warnings = lib.nixvim.mkWarnings "plugins.treesitter-context" {
"Nixvim: treesitter-context needs treesitter to function as intended" when = !config.plugins.treesitter.enable;
]; message = "This plugin needs treesitter to function as intended.";
};
}; };
} }

View file

@ -143,9 +143,10 @@ with lib;
cfg = config.plugins.treesitter-refactor; cfg = config.plugins.treesitter-refactor;
in in
mkIf cfg.enable { mkIf cfg.enable {
warnings = mkIf (!config.plugins.treesitter.enable) [ warnings = lib.nixvim.mkWarnings "plugins.treesitter-refactor" {
"Nixvim: treesitter-refactor needs treesitter to function as intended" when = !config.plugins.treesitter.enable;
]; message = "This plugin needs treesitter to function as intended.";
};
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];

View file

@ -192,9 +192,10 @@ with lib;
cfg = config.plugins.treesitter-textobjects; cfg = config.plugins.treesitter-textobjects;
in in
mkIf cfg.enable { mkIf cfg.enable {
warnings = mkIf (!config.plugins.treesitter.enable) [ warnings = lib.nixvim.mkWarnings "plugins.treesitter-textobjects" {
"Nixvim: treesitter-textobjects needs treesitter to function as intended" when = !config.plugins.treesitter.enable;
]; message = "This plugin needs treesitter to function as intended.";
};
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];

View file

@ -371,10 +371,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
"use_diagnostic_signs" "use_diagnostic_signs"
]; ];
in in
lib.optional (definedOpts != [ ]) '' lib.nixvim.mkWarnings "plugins.trouble" {
Nixvim(plugins.trouble): The following v2 settings options are no longer supported in v3: when = definedOpts != [ ];
message = ''
The following v2 settings options are no longer supported in v3:
${lib.concatMapStringsSep "\n" (opt: " - ${lib.showOption (lib.toList opt)}") definedOpts} ${lib.concatMapStringsSep "\n" (opt: " - ${lib.showOption (lib.toList opt)}") definedOpts}
''; '';
};
# TODO: added 2024-09-20 remove after 24.11 # TODO: added 2024-09-20 remove after 24.11
plugins.web-devicons = lib.mkIf ( plugins.web-devicons = lib.mkIf (

View file

@ -37,9 +37,10 @@ lib.nixvim.plugins.mkNeovimPlugin {
]; ];
extraConfig = { extraConfig = {
warnings = mkIf (!config.plugins.treesitter.enable) [ warnings = lib.nixvim.mkWarnings "plugins.ts-autotag" {
"Nixvim: ts-autotag needs treesitter to function as intended" when = !config.plugins.treesitter.enable;
]; message = "This plugin needs treesitter to function as intended.";
};
}; };
settingsOptions = settingsOptions =

View file

@ -42,9 +42,10 @@ with lib;
cfg = config.plugins.ts-context-commentstring; cfg = config.plugins.ts-context-commentstring;
in in
mkIf cfg.enable { mkIf cfg.enable {
warnings = mkIf (!config.plugins.treesitter.enable) [ warnings = lib.nixvim.mkWarnings "plugins.ts-context-commentstring" {
"Nixvim: ts-context-commentstring needs treesitter to function as intended" when = !config.plugins.treesitter.enable;
]; message = "This plugin needs treesitter to function as intended.";
};
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];

View file

@ -265,9 +265,12 @@ lib.nixvim.plugins.mkNeovimPlugin {
# TODO:: introduced 10-22-2024: remove after 24.11 # TODO:: introduced 10-22-2024: remove after 24.11
# Nested settings can't have normal mkRenamedOptionModule functionality so we can only # Nested settings can't have normal mkRenamedOptionModule functionality so we can only
# alert the user that they are using the old values # alert the user that they are using the old values
warnings = lib.optional (definedOpts != [ ]) '' warnings = lib.nixvim.mkWarnings "plugins.typescript-tools" {
Nixvim(plugins.typescript-tools): The following settings have moved under `plugins.typescript-tools.settings.settings` with snake_case: when = definedOpts != [ ];
message = ''
The following settings have moved under `plugins.typescript-tools.settings.settings` with snake_case:
${lib.concatMapStringsSep "\n" (opt: " - ${lib.showOption (lib.toList opt)}") definedOpts} ${lib.concatMapStringsSep "\n" (opt: " - ${lib.showOption (lib.toList opt)}") definedOpts}
''; '';
}; };
};
} }

View file

@ -451,16 +451,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
extraConfig = extraConfig =
cfg: opts: cfg: opts:
lib.mkIf opts.registrations.isDefined { lib.mkIf opts.registrations.isDefined {
warnings = [ warnings = lib.nixvim.mkWarnings "plugins.which-key" ''
''
nixvim (plugins.which-key):
The option definition `plugins.which-key.registrations' in ${showFiles opts.registrations.files} has been deprecated in which-key v3; please remove it. The option definition `plugins.which-key.registrations' in ${showFiles opts.registrations.files} has been deprecated in which-key v3; please remove it.
You should use `plugins.which-key.settings.spec' instead. You should use `plugins.which-key.settings.spec' instead.
Note: the spec format has changed in which-key v3 Note: the spec format has changed in which-key v3
See: https://github.com/folke/which-key.nvim?tab=readme-ov-file#%EF%B8%8F-mappings See: https://github.com/folke/which-key.nvim?tab=readme-ov-file#%EF%B8%8F-mappings
'' '';
];
plugins.which-key.luaConfig.content = lib.optionalString opts.registrations.isDefined '' plugins.which-key.luaConfig.content = lib.optionalString opts.registrations.isDefined ''
require("which-key").register(${toLuaObject cfg.registrations}) require("which-key").register(${toLuaObject cfg.registrations})

View file

@ -62,23 +62,28 @@ in
{ {
config = { config = {
warnings = warnings =
lib.optionals (options.plugins.web-devicons.enable.highestPrio == 1490) [ (lib.nixvim.mkWarnings "plugins.web-devicons" {
'' when = options.plugins.web-devicons.enable.highestPrio == 1490;
Nixvim: `plugins.web-devicons` was enabled automatically because the following plugins are enabled.
message = ''
This plugin was enabled automatically because the following plugins are enabled.
This behaviour is deprecated. Please explicitly define `plugins.web-devicons.enable` or alternatively This behaviour is deprecated. Please explicitly define `plugins.web-devicons.enable` or alternatively
enable `plugins.mini.enable` with `plugins.mini.modules.icons` and `plugins.mini.mockDevIcons`. enable `plugins.mini.enable` with `plugins.mini.modules.icons` and `plugins.mini.mockDevIcons`.
${lib.concatMapStringsSep "\n" (name: "plugins.${name}") ( ${lib.concatMapStringsSep "\n" (name: "plugins.${name}") (
builtins.filter (name: config.plugins.${name}.enable) iconsPackagePlugins builtins.filter (name: config.plugins.${name}.enable) iconsPackagePlugins
)} )}
'' '';
] })
++ lib.foldlAttrs ( ++ lib.foldlAttrs (
warnings: plugin: msg: warnings: plugin: msg:
warnings warnings
++ lib.optional config.plugins.${plugin}.enable '' ++ (lib.nixvim.mkWarnings "plugins.${plugin}" {
Nixvim Warning: The `${plugin}` plugin has been deprecated. when = config.plugins.${plugin}.enable;
message = ''
This plugin has been deprecated.
${msg} ${msg}
'' '';
})
) [ ] deprecated; ) [ ] deprecated;
}; };
} }

View file

@ -21,13 +21,16 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
warnings = lib.optional (cfg.installGhc == null) '' warnings = lib.nixvim.mkWarnings "plugins.lsp.servers.hls" {
when = cfg.installGhc == null;
message = ''
`hls` relies on `ghc` (the Glasgow Haskell Compiler). `hls` relies on `ghc` (the Glasgow Haskell Compiler).
- Set `plugins.lsp.servers.hls.installGhc = true` to install it automatically with Nixvim. - Set `plugins.lsp.servers.hls.installGhc = true` to install it automatically with Nixvim.
You can customize which package to install by changing `plugins.lsp.servers.hls.ghcPackage`. You can customize which package to install by changing `plugins.lsp.servers.hls.ghcPackage`.
- Set `plugins.lsp.servers.hls.installGhc = false` to not have it install through Nixvim. - Set `plugins.lsp.servers.hls.installGhc = false` to not have it install through Nixvim.
By doing so, you will dismiss this warning. By doing so, you will dismiss this warning.
''; '';
};
extraPackages = lib.optional ((lib.isBool cfg.installGhc) && cfg.installGhc) cfg.ghcPackage; extraPackages = lib.optional ((lib.isBool cfg.installGhc) && cfg.installGhc) cfg.ghcPackage;
}; };

View file

@ -41,8 +41,11 @@ in
rustfmtPackage = mkPackageOption pkgs "rustfmt" { }; rustfmtPackage = mkPackageOption pkgs "rustfmt" { };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
warnings = warnings = lib.nixvim.mkWarnings "plugins.lsp.servers.rust_analyzer" [
(lib.optional (cfg.installCargo == null) '' {
when = cfg.installCargo == null;
message = ''
`rust_analyzer` relies on `cargo`. `rust_analyzer` relies on `cargo`.
- Set `plugins.lsp.servers.rust_analyzer.installCargo = true` to install it automatically - Set `plugins.lsp.servers.rust_analyzer.installCargo = true` to install it automatically
with Nixvim. with Nixvim.
@ -51,8 +54,12 @@ in
- Set `plugins.lsp.servers.rust_analyzer.installCargo = false` to not have it install - Set `plugins.lsp.servers.rust_analyzer.installCargo = false` to not have it install
through Nixvim. through Nixvim.
By doing so, you will dismiss this warning. By doing so, you will dismiss this warning.
'') '';
++ (lib.optional (cfg.installRustc == null) '' }
{
when = cfg.installRustc == null;
message = ''
`rust_analyzer` relies on `rustc`. `rust_analyzer` relies on `rustc`.
- Set `plugins.lsp.servers.rust_analyzer.installRustc = true` to install it automatically - Set `plugins.lsp.servers.rust_analyzer.installRustc = true` to install it automatically
with Nixvim. with Nixvim.
@ -61,7 +68,9 @@ in
- Set `plugins.lsp.servers.rust_analyzer.installRustc = false` to not have it install - Set `plugins.lsp.servers.rust_analyzer.installRustc = false` to not have it install
through Nixvim. through Nixvim.
By doing so, you will dismiss this warning. By doing so, you will dismiss this warning.
''); '';
}
];
extraPackages = extraPackages =
let let

View file

@ -2,7 +2,7 @@ let
# This plugin is deprecated # This plugin is deprecated
warnings = expect: [ warnings = expect: [
(expect "count" 1) (expect "count" 1)
(expect "any" "this plugin is obsolete and will be removed after 24.11.") (expect "any" "This plugin is obsolete and will be removed after 24.11.")
]; ];
in in
{ {