treewide: use mkWarnings wherever possible

This commit is contained in:
Gaetan Lepage 2025-01-17 16:18:38 +01:00 committed by nix-infra-bot
parent 02e16b2a76
commit 2ec6218f87
7 changed files with 72 additions and 59 deletions

View file

@ -58,22 +58,29 @@ in
config = lib.mkIf (cfg.enable && cfg.autoEnableSources) (
lib.mkMerge [
{
warnings =
warnings = lib.nixvim.mkWarnings "plugins.cmp" [
# TODO: expand this warning to ft & cmd sources lists and `showDefs` the offending definitions
lib.optional (lib.types.isRawType cfg.settings.sources) ''
Nixvim (plugins.cmp): You have enabled `autoEnableSources` that tells Nixvim to automatically
enable the source plugins with respect to the list of sources provided in `settings.sources`.
However, the latter is proveded as a raw lua string which is not parseable by Nixvim.
{
when = lib.types.isRawType cfg.settings.sources;
message = ''
You have enabled `autoEnableSources` that tells Nixvim to automatically
enable the source plugins with respect to the list of sources provided in `settings.sources`.
However, the latter is proveded as a raw lua string which is not parseable by Nixvim.
If you want to keep using raw lua for defining your sources:
- Ensure you enable the relevant plugins manually in your configuration;
- Dismiss this warning by explicitly setting `autoEnableSources` to `false`;
''
If you want to keep using raw lua for defining your sources:
- Ensure you enable the relevant plugins manually in your configuration;
- Dismiss this warning by explicitly setting `autoEnableSources` to `false`;
'';
}
# TODO: Added 2024-09-22; remove after 24.11
++ lib.optional (lib.elem "otter" enabledSources) ''
Nixvim (plugins.cmp): "otter" is listed in `settings.sources`, however it is no longer a cmp source.
Instead, you should enable `plugins.otter` and use the "cmp-nvim-lsp" completion source.
'';
{
when = lib.elem "otter" enabledSources;
message = ''
"otter" is listed in `settings.sources`, however it is no longer a cmp source.
Instead, you should enable `plugins.otter` and use the "cmp-nvim-lsp" completion source.
'';
}
];
# If the user has enabled the `foo` and `bar` sources, then `plugins` will look like:
# {