mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
treewide: use mkWarnings wherever possible
This commit is contained in:
parent
2ec6218f87
commit
60adb6c56b
17 changed files with 158 additions and 122 deletions
|
@ -153,11 +153,13 @@ in
|
|||
lib.mkIf cfg.enable {
|
||||
|
||||
# TODO: added 2024-09-20 remove after 24.11
|
||||
warnings = lib.optionals opt.iconsEnabled.isDefined [
|
||||
''
|
||||
warnings = lib.nixvim.mkWarnings "plugins.alpha" {
|
||||
when = opt.iconsEnabled.isDefined;
|
||||
message = ''
|
||||
The option definition `plugins.alpha.iconsEnabled' in ${lib.showFiles opt.iconsEnabled.files} has been deprecated; please remove it.
|
||||
''
|
||||
];
|
||||
'';
|
||||
};
|
||||
|
||||
plugins.web-devicons =
|
||||
lib.mkIf
|
||||
(
|
||||
|
|
|
@ -122,10 +122,14 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings = lib.optionals (!config.plugins.lsp.enable) ''
|
||||
Nixvim (plugins.clangd-extensions): You have enabled `clangd-extensions` but not the lsp (`plugins.lsp`).
|
||||
You should set `plugins.lsp.enable = true` to make use of the clangd-extensions' features.
|
||||
'';
|
||||
warnings = lib.nixvim.mkWarnings "plugins.clangd-extensions" {
|
||||
when = !config.plugins.lsp.enable;
|
||||
|
||||
message = ''
|
||||
You have enabled `clangd-extensions` but not the lsp (`plugins.lsp`).
|
||||
You should set `plugins.lsp.enable = true` to make use of the clangd-extensions' features.
|
||||
'';
|
||||
};
|
||||
|
||||
plugins.lsp = {
|
||||
servers.clangd = {
|
||||
|
|
|
@ -145,10 +145,14 @@ in
|
|||
extraPlugins = [ cfg.package ];
|
||||
|
||||
# TODO: print the location of the offending options
|
||||
warnings = lib.optional (nixvimPkgs.wrong != [ ]) ''
|
||||
Nixvim (plugins.efmls-configs): Following tools are not handled by nixvim, please add them to `externallyManagedPackages` to silence this:
|
||||
${lib.concatMapStringsSep "\n" (tool: " - ${tool}") nixvimPkgs.wrong}
|
||||
'';
|
||||
warnings = lib.nixvim.mkWarnings "plugins.efmls-configs" {
|
||||
when = nixvimPkgs.wrong != [ ];
|
||||
|
||||
message = ''
|
||||
Following tools are not handled by nixvim, please add them to `externallyManagedPackages` to silence this:
|
||||
${lib.concatMapStringsSep "\n" (tool: " - ${tool}") nixvimPkgs.wrong}
|
||||
'';
|
||||
};
|
||||
|
||||
plugins.lsp.servers.efm = {
|
||||
enable = true;
|
||||
|
|
|
@ -73,16 +73,16 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
|
||||
callSetup = false;
|
||||
extraConfig = cfg: opts: {
|
||||
warnings =
|
||||
lib.optional
|
||||
(
|
||||
config.performance.combinePlugins.enable
|
||||
&& !(lib.elem "firenvim" config.performance.combinePlugins.standalonePlugins)
|
||||
)
|
||||
''
|
||||
Nixvim (plugins.firenvim): Using `performance.combinePlugins` breaks `firenvim`.
|
||||
Add this plugin to `performance.combinePlugins.standalonePlugins` to prevent any issue.
|
||||
'';
|
||||
warnings = lib.nixvim.mkWarnings "plugins.firenvim" {
|
||||
when =
|
||||
config.performance.combinePlugins.enable
|
||||
&& !(lib.elem "firenvim" config.performance.combinePlugins.standalonePlugins);
|
||||
message = ''
|
||||
Using `performance.combinePlugins` breaks `firenvim`.
|
||||
Add this plugin to `performance.combinePlugins.standalonePlugins` to prevent any issue.
|
||||
'';
|
||||
};
|
||||
|
||||
globals.firenvim_config = lib.modules.mkAliasAndWrapDefsWithPriority lib.id opts.settings;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -19,17 +19,17 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
extraConfig = cfg: {
|
||||
extraPackages = [ cfg.flutterPackage ];
|
||||
|
||||
warnings =
|
||||
lib.optional
|
||||
(
|
||||
(cfg.settings ? debugger.enable)
|
||||
&& (lib.isBool cfg.settings.debugger.enable)
|
||||
&& cfg.settings.debugger.enable
|
||||
&& (!config.plugins.dap.enable)
|
||||
)
|
||||
''
|
||||
Nixvim (plugins.flutter-tools): You have enabled the dap integration (`settings.debugger.enable`) but `plugins.dap` is disabled.
|
||||
'';
|
||||
warnings = lib.nixvim.mkWarnings "plugins.flutter-tools" {
|
||||
when =
|
||||
(cfg.settings ? debugger.enable)
|
||||
&& (lib.isBool cfg.settings.debugger.enable)
|
||||
&& cfg.settings.debugger.enable
|
||||
&& (!config.plugins.dap.enable);
|
||||
|
||||
message = ''
|
||||
You have enabled the dap integration (`settings.debugger.enable`) but `plugins.dap` is disabled.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settingsOptions = import ./settings-options.nix lib;
|
||||
|
|
|
@ -101,13 +101,15 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings =
|
||||
optional ((isBool cfg.settings.trouble && cfg.settings.trouble) && !config.plugins.trouble.enable)
|
||||
''
|
||||
Nixvim (plugins.gitsigns): You have enabled `plugins.gitsigns.settings.trouble` but
|
||||
`plugins.trouble.enable` is `false`.
|
||||
You should maybe enable the `trouble` plugin.
|
||||
'';
|
||||
warnings = lib.nixvim.mkWarnings "plugins.gitsigns" {
|
||||
when = (isBool cfg.settings.trouble && cfg.settings.trouble) && !config.plugins.trouble.enable;
|
||||
|
||||
message = ''
|
||||
You have enabled `plugins.gitsigns.settings.trouble` but `plugins.trouble.enable` is `false`.
|
||||
You should maybe enable the `trouble` plugin.
|
||||
'';
|
||||
};
|
||||
|
||||
extraPackages = [ cfg.gitPackage ];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -16,14 +16,16 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings =
|
||||
lib.optional
|
||||
(
|
||||
cfg.settings ? use_trouble_qf
|
||||
&& builtins.isBool cfg.settings.use_trouble_qf
|
||||
&& cfg.settings.use_trouble_qf
|
||||
&& !config.plugins.trouble.enable
|
||||
)
|
||||
"Nixvim (plugins.glance): The `trouble` plugin is not enabled, so the `glance` plugin's `use_trouble_qf` setting has no effect.";
|
||||
warnings = lib.nixvim.mkWarnings "plugins.glance" {
|
||||
when =
|
||||
cfg.settings ? use_trouble_qf
|
||||
&& builtins.isBool cfg.settings.use_trouble_qf
|
||||
&& cfg.settings.use_trouble_qf
|
||||
&& !config.plugins.trouble.enable;
|
||||
|
||||
message = ''
|
||||
The `trouble` plugin is not enabled, so the `glance` plugin's `use_trouble_qf` setting has no effect.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -22,8 +22,12 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = {
|
||||
warnings = optional (!config.plugins.treesitter.enable) ''
|
||||
Nixvim (plugins.headlines): headlines requires `plugins.treesitter` to be enabled with the relevant grammars installed.
|
||||
'';
|
||||
warnings = lib.nixvim.mkWarnings "plugins.headlines" {
|
||||
when = !config.plugins.treesitter.enable;
|
||||
|
||||
message = ''
|
||||
headlines requires `plugins.treesitter` to be enabled with the relevant grammars installed.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -19,17 +19,17 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings =
|
||||
lib.optional
|
||||
(
|
||||
(cfg.settings ? devicons.enable)
|
||||
&& (lib.isBool cfg.settings.devicons.enable)
|
||||
&& cfg.settings.devicons.enable
|
||||
&& (!config.plugins.web-devicons.enable)
|
||||
)
|
||||
''
|
||||
Nixvim (plugins.lir): You have enabled `settings.devicons.enable` but `plugins.web-devicons.enable` is `false`.
|
||||
Consider enabling the plugin for proper devicons support.
|
||||
'';
|
||||
warnings = lib.nixvim.mkWarnings "plugins.lir" {
|
||||
when =
|
||||
(cfg.settings ? devicons.enable)
|
||||
&& (lib.isBool cfg.settings.devicons.enable)
|
||||
&& cfg.settings.devicons.enable
|
||||
&& (!config.plugins.web-devicons.enable);
|
||||
|
||||
message = ''
|
||||
You have enabled `settings.devicons.enable` but `plugins.web-devicons.enable` is `false`.
|
||||
Consider enabling the plugin for proper devicons support.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -241,10 +241,12 @@ mkVimPlugin {
|
|||
extraConfig = cfg: {
|
||||
extraPython3Packages = cfg.python3Dependencies;
|
||||
|
||||
warnings =
|
||||
lib.optional (cfg.settings.image_provider == "wezterm" && !config.plugins.wezterm.enable)
|
||||
''
|
||||
Nixvim (plugins.molten): The `wezterm` plugin is not enabled, so the `molten` plugin's `image_provider` setting will have no effect.
|
||||
'';
|
||||
warnings = lib.nixvim.mkWarnings "plugins.molten" {
|
||||
when = cfg.settings.image_provider == "wezterm" && !config.plugins.wezterm.enable;
|
||||
|
||||
message = ''
|
||||
The `wezterm` plugin is not enabled, so the `molten` plugin's `image_provider` setting will have no effect.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -238,17 +238,16 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
extraConfig = cfg: {
|
||||
# TODO: added 2024-09-14 remove after 24.11
|
||||
plugins.sqlite-lua.enable = mkOverride 1490 true;
|
||||
warnings =
|
||||
optional
|
||||
(
|
||||
isBool cfg.settings.enable_persistent_history
|
||||
&& cfg.settings.enable_persistent_history
|
||||
&& options.plugins.sqlite-lua.enable.highestPrio == 1490
|
||||
)
|
||||
''
|
||||
Nixvim (plugins.neoclip) `sqlite-lua` automatic installation is deprecated.
|
||||
Please use `plugins.sqlite-lua.enable`.
|
||||
'';
|
||||
warnings = lib.nixvim.mkWarnings "plugins.neoclip" {
|
||||
when =
|
||||
isBool cfg.settings.enable_persistent_history
|
||||
&& cfg.settings.enable_persistent_history
|
||||
&& options.plugins.sqlite-lua.enable.highestPrio == 1490;
|
||||
|
||||
message = ''
|
||||
`sqlite-lua` automatic installation is deprecated. Please use `plugins.sqlite-lua.enable`.
|
||||
'';
|
||||
};
|
||||
|
||||
assertions = [
|
||||
{
|
||||
|
|
|
@ -44,10 +44,14 @@ let
|
|||
}
|
||||
];
|
||||
|
||||
warnings = optional (!config.plugins.treesitter.enable) ''
|
||||
Nixvim (plugins.neotest.adapters.${name}): This adapter requires `treesitter` to be enabled.
|
||||
You might want to set `plugins.treesitter.enable = true` and ensure that the `${treesitter-parser}` parser is enabled.
|
||||
'';
|
||||
warnings = lib.nixvim.mkWarnings "plugins.neotest.adapters.${name}" {
|
||||
when = !config.plugins.treesitter.enable;
|
||||
|
||||
message = ''
|
||||
This adapter requires `treesitter` to be enabled.
|
||||
You might want to set `plugins.treesitter.enable = true` and ensure that the `${treesitter-parser}` parser is enabled.
|
||||
'';
|
||||
};
|
||||
|
||||
plugins.neotest.settings.adapters =
|
||||
let
|
||||
|
|
|
@ -103,20 +103,25 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings =
|
||||
(lib.optional ((cfg.settings.activate_hydra_keys != null) && (!config.plugins.hydra.enable)) ''
|
||||
Nixvim (plugins.notebook-navigator): `plugins.notebook-navigator.settings.activate_hydra_keys` has been set to a non-`null`
|
||||
value but `plugins.hydra.enable` is `false`.
|
||||
'')
|
||||
++
|
||||
(lib.optional ((cfg.settings.repl_provider == "toggleterm") && (!config.plugins.toggleterm.enable)))
|
||||
''
|
||||
Nixvim (plugins.notebook-navigator): `plugins.notebook-navigator.settings.repl_provider` has been set to "toggleterm"
|
||||
but `plugins.hydra.toggleterm.enable` is `false`.
|
||||
''
|
||||
++ (lib.optional ((cfg.settings.repl_provider == "molten") && (!config.plugins.molten.enable))) ''
|
||||
Nixvim (plugins.notebook-navigator): `plugins.notebook-navigator.settings.repl_provider` has been set to "molten"
|
||||
but `plugins.molten.enable` is `false`.
|
||||
'';
|
||||
warnings = lib.nixvim.mkWarnings "plugins.notebook-navigator" [
|
||||
{
|
||||
when = (cfg.settings.activate_hydra_keys != null) && (!config.plugins.hydra.enable);
|
||||
message = ''
|
||||
`settings.activate_hydra_keys` has been set to a non-`null` value but `plugins.hydra.enable` is `false`.
|
||||
'';
|
||||
}
|
||||
{
|
||||
when = (cfg.settings.repl_provider == "toggleterm") && (!config.plugins.toggleterm.enable);
|
||||
message = ''
|
||||
`settings.repl_provider` has been set to "toggleterm" but `plugins.hydra.toggleterm.enable` is `false`.
|
||||
'';
|
||||
}
|
||||
{
|
||||
when = (cfg.settings.repl_provider == "molten") && (!config.plugins.molten.enable);
|
||||
message = ''
|
||||
`settings.repl_provider` has been set to "molten" but `plugins.molten.enable` is `false`.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -287,10 +287,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
]
|
||||
];
|
||||
in
|
||||
lib.optional (definedOpts != [ ]) ''
|
||||
Nixvim(plugins.rest): The following v2 settings options are no longer supported in v3:
|
||||
${lib.concatMapStringsSep "\n" (opt: " - ${lib.showOption (lib.toList opt)}") definedOpts}
|
||||
'';
|
||||
lib.nixvim.mkWarnings "plugins.rest" {
|
||||
when = definedOpts != [ ];
|
||||
message = ''
|
||||
The following v2 settings options are no longer supported in v3:
|
||||
${lib.concatMapStringsSep "\n" (opt: " - ${lib.showOption (lib.toList opt)}") definedOpts}
|
||||
'';
|
||||
};
|
||||
|
||||
# TODO: There may be some interactions between this & telescope, maybe requiring #2292
|
||||
plugins.rest.luaConfig.post = lib.mkIf cfg.enableTelescope ''require("telescope").load_extension("rest")'';
|
||||
|
|
|
@ -84,11 +84,14 @@ lib.nixvim.plugins.mkVimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings = lib.optional (cfg.treesitter.enable && (!config.plugins.treesitter.enable)) ''
|
||||
Nixvim (plugins.vim-matchup): `plugins.vim-matchup.treesitter.enable` is `true`, but the
|
||||
treesitter plugin itself is not.
|
||||
-> Set `plugins.treesitter.enable` to `true`.
|
||||
'';
|
||||
warnings = lib.nixvim.mkWarnings "plugins.vim-matchup" {
|
||||
when = cfg.treesitter.enable && (!config.plugins.treesitter.enable);
|
||||
|
||||
message = ''
|
||||
`plugins.vim-matchup.treesitter.enable` is `true`, but the treesitter plugin itself is not.
|
||||
-> Set `plugins.treesitter.enable` to `true`.
|
||||
'';
|
||||
};
|
||||
|
||||
plugins.treesitter.settings.matchup = cfg.treesitter;
|
||||
};
|
||||
|
|
|
@ -349,13 +349,15 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
extraConfig = cfg: {
|
||||
# TODO: Added 2024-09-14 remove after 24.11
|
||||
plugins.sqlite-lua.enable = mkOverride 1490 true;
|
||||
warnings =
|
||||
optional
|
||||
(cfg.settings.ring.storage == "sqlite" && options.plugins.sqlite-lua.enable.highestPrio == 1490)
|
||||
''
|
||||
Nixvim (plugins.yanky) `sqlite-lua` automatic installation is deprecated.
|
||||
Please use `plugins.sqlite-lua.enable`.
|
||||
'';
|
||||
warnings = lib.nixvim.mkWarnings "plugins.yanky" {
|
||||
when =
|
||||
cfg.settings.ring.storage == "sqlite" && options.plugins.sqlite-lua.enable.highestPrio == 1490;
|
||||
|
||||
message = ''
|
||||
`sqlite-lua` automatic installation is deprecated.
|
||||
Please use `plugins.sqlite-lua.enable`.
|
||||
'';
|
||||
};
|
||||
|
||||
assertions = [
|
||||
{
|
||||
|
|
|
@ -115,14 +115,14 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
extraConfig = cfg: {
|
||||
extraPackages = [ cfg.zkPackage ];
|
||||
|
||||
warnings = flatten (
|
||||
warnings = lib.nixvim.mkWarnings "plugins.zk" (
|
||||
mapAttrsToList
|
||||
(
|
||||
picker: pluginName:
|
||||
optional ((cfg.settings.picker == picker) && !config.plugins.${pluginName}.enable) ''
|
||||
Nixvim (plugins.zk): You have set `plugins.zk.settings.picker = "${picker}"` but `plugins.${pluginName}` is not enabled in your config.
|
||||
''
|
||||
)
|
||||
(picker: pluginName: {
|
||||
when = (cfg.settings.picker == picker) && !config.plugins.${pluginName}.enable;
|
||||
message = ''
|
||||
You have set `plugins.zk.settings.picker = "${picker}"` but `plugins.${pluginName}` is not enabled in your config.
|
||||
'';
|
||||
})
|
||||
{
|
||||
fzf_lua = "fzf-lua";
|
||||
telescope = "telescope";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue