mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
treewide: use mkWarnings where possible
This commit is contained in:
parent
abba4af10b
commit
12e658eca8
34 changed files with 309 additions and 225 deletions
|
@ -45,14 +45,16 @@ in
|
|||
) (builtins.attrNames config.plugins);
|
||||
count = builtins.length pluginsWithLazyLoad;
|
||||
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.
|
||||
${lib.concatImapStringsSep "\n" (i: x: "${toString i}. plugins.${x}") pluginsWithLazyLoad}
|
||||
|
||||
Currently supported lazy providers:
|
||||
- lz-n
|
||||
''
|
||||
];
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -166,10 +166,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
]
|
||||
];
|
||||
in
|
||||
lib.optional (definedOpts != [ ]) ''
|
||||
Nixvim(plugins.auto-save): The following settings options are no longer supported.
|
||||
Check the plugin documentation for more details.:
|
||||
${lib.concatMapStringsSep "\n" (opt: " - ${lib.showOption (lib.toList opt)}") definedOpts}
|
||||
'';
|
||||
lib.nixvim.mkWarnings "plugins.auto-save" {
|
||||
when = definedOpts != [ ];
|
||||
message = ''
|
||||
The following settings options are no longer supported.
|
||||
Check the plugin documentation for more details.:
|
||||
${lib.concatMapStringsSep "\n" (opt: " - ${lib.showOption (lib.toList opt)}") definedOpts}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -50,18 +50,23 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
copilot-lua-cfg = config.plugins.copilot-lua.settings;
|
||||
isEnabled = b: builtins.isBool b && b;
|
||||
in
|
||||
lib.optionals (isEnabled copilot-lua-cfg.suggestion.enabled) [
|
||||
''
|
||||
It is recommended to disable copilot's `suggestion` module, as it can interfere with
|
||||
completions properly appearing in blink-cmp-copilot.
|
||||
''
|
||||
]
|
||||
++ lib.optionals (isEnabled copilot-lua-cfg.panel.enabled) [
|
||||
''
|
||||
It is recommended to disable copilot's `panel` module, as it can interfere with completions
|
||||
properly appearing in blink-cmp-copilot.
|
||||
''
|
||||
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
|
||||
completions properly appearing in blink-cmp-copilot.
|
||||
'';
|
||||
}
|
||||
{
|
||||
when = isEnabled copilot-lua-cfg.panel.enabled;
|
||||
message = ''
|
||||
It is recommended to disable copilot's `panel` module, as it can interfere with completions
|
||||
properly appearing in blink-cmp-copilot.
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
plugins.copilot-lua.enable = lib.mkDefault true;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -44,8 +44,11 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings = lib.optional (cfg.settings ? documentation) ''
|
||||
Nixvim(plugins.blink): `settings.documentation` does not correspond to a known setting, use `settings.windows.documentation` instead.
|
||||
'';
|
||||
warnings = lib.nixvim.mkWarnings "plugins.blink" {
|
||||
when = cfg.settings ? documentation;
|
||||
message = ''
|
||||
`settings.documentation` does not correspond to a known setting, use `settings.windows.documentation` instead.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -60,14 +60,22 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
copilot-lua-cfg = config.plugins.copilot-lua.settings;
|
||||
isEnabled = b: (lib.isBool b && b);
|
||||
in
|
||||
lib.optional (isEnabled copilot-lua-cfg.suggestion.enabled) ''
|
||||
It is recommended to disable copilot's `suggestion` module, as it can interfere with
|
||||
completions properly appearing in copilot-cmp.
|
||||
''
|
||||
++ lib.optional (isEnabled copilot-lua-cfg.panel.enabled) ''
|
||||
It is recommended to disable copilot's `panel` module, as it can interfere with completions
|
||||
properly appearing in copilot-cmp.
|
||||
'';
|
||||
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
|
||||
completions properly appearing in copilot-cmp.
|
||||
'';
|
||||
}
|
||||
{
|
||||
when = isEnabled copilot-lua-cfg.panel.enabled;
|
||||
message = ''
|
||||
It is recommended to disable copilot's `panel` module, as it can interfere with completions
|
||||
properly appearing in copilot-cmp.
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
plugins.copilot-lua.enable = lib.mkDefault true;
|
||||
};
|
||||
|
|
|
@ -470,16 +470,16 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings =
|
||||
lib.optionals
|
||||
(
|
||||
(builtins.isBool cfg.settings.integration.nvim-tree.enable)
|
||||
&& cfg.settings.integration.nvim-tree.enable
|
||||
&& !config.plugins.nvim-tree.enable
|
||||
)
|
||||
[
|
||||
"Nixvim(plugins.fidget): You have set `plugins.fidget.settings.integrations.nvim-tree.enable` to true but have not enabled `plugins.nvim-tree`."
|
||||
];
|
||||
warnings = lib.nixvim.mkWarnings "plugins.fidget" {
|
||||
when =
|
||||
(builtins.isBool cfg.settings.integration.nvim-tree.enable)
|
||||
&& cfg.settings.integration.nvim-tree.enable
|
||||
&& !config.plugins.nvim-tree.enable;
|
||||
|
||||
message = ''
|
||||
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;
|
||||
|
|
|
@ -105,11 +105,14 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
|
||||
extraConfig = cfg: opts: {
|
||||
# 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.
|
||||
''
|
||||
];
|
||||
'';
|
||||
};
|
||||
|
||||
# TODO: added 2024-09-20 remove after 24.11
|
||||
plugins.web-devicons =
|
||||
lib.mkIf
|
||||
|
|
|
@ -14,8 +14,9 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
hasSettings = false;
|
||||
hasLuaConfig = false;
|
||||
extraConfig = {
|
||||
warnings = lib.optional (
|
||||
!config.plugins.treesitter.enable
|
||||
) "Nixvim: hmts needs treesitter to function as intended";
|
||||
warnings = lib.nixvim.mkWarnings "plugins.hmts" {
|
||||
when = !config.plugins.treesitter.enable;
|
||||
message = "hmts needs treesitter to function as intended";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -135,33 +135,28 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings =
|
||||
lib.optionals
|
||||
(
|
||||
warnings = lib.nixvim.mkWarnings "plugins.lazydev" [
|
||||
{
|
||||
when =
|
||||
builtins.isBool cfg.settings.integrations.cmp
|
||||
&& !config.plugins.cmp.enable
|
||||
&& cfg.settings.integrations.cmp
|
||||
)
|
||||
[ "Nixvim(plugins.lazydev): you have enabled nvim-cmp integration but plugins.cmp is not enabled." ]
|
||||
++
|
||||
lib.optionals
|
||||
(
|
||||
builtins.isBool cfg.settings.integrations.lspconfig
|
||||
&& !config.plugins.lsp.enable
|
||||
&& cfg.settings.integrations.lspconfig
|
||||
)
|
||||
[
|
||||
"Nixvim(plugins.lazydev): you have enabled lspconfig integration but plugins.lsp is not enabled."
|
||||
]
|
||||
++
|
||||
lib.optionals
|
||||
(
|
||||
builtins.isBool cfg.settings.integrations.coq
|
||||
&& !config.plugins.coq-nvim.enable
|
||||
&& cfg.settings.integrations.coq
|
||||
)
|
||||
[
|
||||
"Nixvim(plugins.lazydev): you have enabled coq integration but plugins.coq-nvim is not enabled."
|
||||
];
|
||||
&& cfg.settings.integrations.cmp;
|
||||
message = "You have enabled nvim-cmp integration but plugins.cmp is not enabled.";
|
||||
}
|
||||
{
|
||||
when =
|
||||
builtins.isBool cfg.settings.integrations.lspconfig
|
||||
&& !config.plugins.lsp.enable
|
||||
&& cfg.settings.integrations.lspconfig;
|
||||
message = "You have enabled lspconfig integration but plugins.lsp is not enabled.";
|
||||
}
|
||||
{
|
||||
when =
|
||||
builtins.isBool cfg.settings.integrations.coq
|
||||
&& !config.plugins.coq-nvim.enable
|
||||
&& cfg.settings.integrations.coq;
|
||||
message = "You have enabled coq integration but plugins.coq-nvim is not enabled.";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -90,9 +90,12 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings = lib.mkIf (!config.plugins.lsp.enable) [
|
||||
"You have enabled `plugins.lsp-format` but have `plugins.lsp` disabled."
|
||||
];
|
||||
warnings = lib.nixvim.mkWarnings "plugins.lsp-format" {
|
||||
when = !config.plugins.lsp.enable;
|
||||
message = ''
|
||||
This plugin requires `plugins.lsp` to be enabled.
|
||||
'';
|
||||
};
|
||||
|
||||
plugins.lsp = {
|
||||
onAttach =
|
||||
|
|
|
@ -467,11 +467,16 @@ in
|
|||
{
|
||||
enable = mkOverride 1490 true;
|
||||
};
|
||||
warnings = lib.optional (
|
||||
warnings = lib.nixvim.mkWarnings "plugins.ltex-extra" {
|
||||
# https://nvimdev.github.io/lspsaga/implement/#default-options
|
||||
(isBool cfg.implement.enable && cfg.implement.enable)
|
||||
&& (isBool cfg.symbolInWinbar.enable && !cfg.symbolInWinbar.enable)
|
||||
) "You have enabled the `implement` module but it requires `symbolInWinbar` to be enabled.";
|
||||
when =
|
||||
(isBool cfg.implement.enable && cfg.implement.enable)
|
||||
&& (isBool cfg.symbolInWinbar.enable && !cfg.symbolInWinbar.enable);
|
||||
|
||||
message = ''
|
||||
You have enabled the `implement` module but it requires `symbolInWinbar` to be enabled.
|
||||
'';
|
||||
};
|
||||
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraConfigLua =
|
||||
|
|
|
@ -44,10 +44,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings = optional (!config.plugins.lsp.enable) ''
|
||||
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.
|
||||
'';
|
||||
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 should set `plugins.lsp.enable = true` to make use of the LTeX_extra plugin's features.
|
||||
'';
|
||||
};
|
||||
|
||||
plugins.lsp = {
|
||||
servers.ltex = {
|
||||
|
|
|
@ -211,16 +211,27 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
modules = cfg.settings.load or { };
|
||||
telescopeModuleEnabled = (modules."core.integrations.telescope" or null) != null;
|
||||
in
|
||||
(lib.optional (telescopeModuleEnabled && (!cfg.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.
|
||||
'')
|
||||
++ (lib.optional (cfg.telescopeIntegration.enable && (!config.plugins.telescope.enable)) ''
|
||||
Telescope support for neorg is enabled but the telescope plugin is not.
|
||||
'')
|
||||
++ (lib.optional ((modules ? "core.defaults") && (!config.plugins.treesitter.enable)) ''
|
||||
Neorg's `core.defaults` module is enabled but `plugins.treesitter` is not.
|
||||
Treesitter is required when using the `core.defaults`.
|
||||
'');
|
||||
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`.
|
||||
The latter will install the `neorg-telescope` plugin necessary for this integration to work.
|
||||
'';
|
||||
}
|
||||
{
|
||||
when = cfg.telescopeIntegration.enable && (!config.plugins.telescope.enable);
|
||||
message = ''
|
||||
Telescope support for neorg is enabled but the telescope plugin is not.
|
||||
'';
|
||||
}
|
||||
{
|
||||
when = (modules ? "core.defaults") && (!config.plugins.treesitter.enable);
|
||||
message = ''
|
||||
Neorg's `core.defaults` module is enabled but `plugins.treesitter` is not.
|
||||
Treesitter is required when using the `core.defaults`.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -126,13 +126,16 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
in
|
||||
{
|
||||
warnings = lib.optional (cfg.enableLspFormat && cfg.settings.on_attach != null) ''
|
||||
You have enabled the lsp-format integration with none-ls.
|
||||
However, you have provided a custom value to `plugins.none-ls.settings.on_attach`.
|
||||
This means the `enableLspFormat` option will have no effect.
|
||||
Final value is:
|
||||
${lib.generators.toPretty { } cfg.settings.on_attach}
|
||||
'';
|
||||
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.
|
||||
However, you have provided a custom value to `plugins.none-ls.settings.on_attach`.
|
||||
This means the `enableLspFormat` option will have no effect.
|
||||
Final value is:
|
||||
${lib.generators.toPretty { } cfg.settings.on_attach}
|
||||
'';
|
||||
};
|
||||
|
||||
assertions = [
|
||||
{
|
||||
|
|
|
@ -23,16 +23,18 @@ in
|
|||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
warnings =
|
||||
lib.optional (opt.disableTsServerFormatter.highestPrio == defaultPrio && ts-ls-cfg.enable)
|
||||
''
|
||||
You have enabled the `prettier` formatter in none-ls.
|
||||
You have also enabled the `ts_ls` language server which also brings a formatting feature.
|
||||
warnings = lib.nixvim.mkWarnings "plugins.none-ls.sources.formatting.prettier" {
|
||||
when = opt.disableTsServerFormatter.highestPrio == defaultPrio && ts-ls-cfg.enable;
|
||||
|
||||
- To disable the formatter built-in the `ts_ls` language server, set
|
||||
`plugins.none-ls.sources.formatting.prettier.disableTsServerFormatter` to `true`.
|
||||
- Else, to silence this warning, explicitly set the option to `false`.
|
||||
'';
|
||||
message = ''
|
||||
You have enabled the `prettier` formatter in none-ls.
|
||||
You have also enabled the `ts_ls` language server which also brings a formatting feature.
|
||||
|
||||
- To disable the formatter built-in the `ts_ls` language server, set
|
||||
`plugins.none-ls.sources.formatting.prettier.disableTsServerFormatter` to `true`.
|
||||
- Else, to silence this warning, explicitly set the option to `false`.
|
||||
'';
|
||||
};
|
||||
|
||||
plugins.lsp.servers.ts_ls =
|
||||
lib.mkIf (cfg.enable && ts-ls-cfg.enable && cfg.disableTsServerFormatter)
|
||||
|
|
|
@ -23,16 +23,18 @@ in
|
|||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
warnings =
|
||||
lib.optional (opt.disableTsServerFormatter.highestPrio == defaultPrio && ts-ls-cfg.enable)
|
||||
''
|
||||
You have enabled the `prettierd` formatter in none-ls.
|
||||
You have also enabled the `ts_ls` language server which also brings a formatting feature.
|
||||
warnings = lib.nixvim.mkWarnings "plugins.none-ls.sources.formatting.prettierd" {
|
||||
when = opt.disableTsServerFormatter.highestPrio == defaultPrio && ts-ls-cfg.enable;
|
||||
|
||||
- To disable the formatter built-in the `ts_ls` language server, set
|
||||
`plugins.none-ls.sources.formatting.prettierd.disableTsServerFormatter` to `true`.
|
||||
- Else, to silence this warning, explicitly set the option to `false`.
|
||||
'';
|
||||
message = ''
|
||||
You have enabled the `prettierd` formatter in none-ls.
|
||||
You have also enabled the `ts_ls` language server which also brings a formatting feature.
|
||||
|
||||
- To disable the formatter built-in the `ts_ls` language server, set
|
||||
`plugins.none-ls.sources.formatting.prettierd.disableTsServerFormatter` to `true`.
|
||||
- Else, to silence this warning, explicitly set the option to `false`.
|
||||
'';
|
||||
};
|
||||
|
||||
plugins.lsp.servers.ts_ls =
|
||||
lib.mkIf (cfg.enable && ts-ls-cfg.enable && cfg.disableTsServerFormatter)
|
||||
|
|
|
@ -76,14 +76,12 @@ with lib;
|
|||
};
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
warnings = [
|
||||
''
|
||||
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.
|
||||
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}
|
||||
''
|
||||
];
|
||||
warnings = lib.nixvim.mkWarnings "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.
|
||||
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}
|
||||
'';
|
||||
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
|
|
|
@ -100,14 +100,15 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings =
|
||||
lib.optional
|
||||
(config.plugins.treesitter.enable -> config.plugins.treesitter.settings.highlight.enable == null)
|
||||
warnings = lib.nixvim.mkWarnings "plugins.otter" {
|
||||
when =
|
||||
config.plugins.treesitter.enable -> config.plugins.treesitter.settings.highlight.enable == null;
|
||||
|
||||
''
|
||||
NixVim(plugins.otter): 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.
|
||||
'';
|
||||
message = ''
|
||||
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.
|
||||
'';
|
||||
};
|
||||
|
||||
plugins.lsp.onAttach = lib.mkIf cfg.autoActivate ''
|
||||
require('otter').activate()
|
||||
|
|
|
@ -19,9 +19,12 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings = lib.optional (cfg.enableTelescope && (!config.plugins.telescope.enable)) ''
|
||||
Telescope support for `plugins.persisted` is enabled but the telescope plugin is not.
|
||||
'';
|
||||
warnings = lib.nixvim.mkWarnings "plugins.persisted" {
|
||||
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" ];
|
||||
};
|
||||
|
|
|
@ -120,9 +120,12 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings = lib.optional (cfg.enableTelescope && (!config.plugins.telescope.enable)) ''
|
||||
Telescope support for project-nvim is enabled but the telescope plugin is not.
|
||||
'';
|
||||
warnings = lib.nixvim.mkWarnings "plugins.project-nvim" {
|
||||
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" ];
|
||||
};
|
||||
|
|
|
@ -115,9 +115,10 @@ with lib;
|
|||
cfg = config.plugins.rainbow-delimiters;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
warnings = optional (
|
||||
!config.plugins.treesitter.enable
|
||||
) "Nixvim: treesitter-rainbow needs treesitter to function as intended";
|
||||
warnings = lib.nixvim.mkWarnings "plugins.rainbow-delimiters" {
|
||||
when = !config.plugins.treesitter.enable;
|
||||
message = "This plugin needs treesitter to function as intended.";
|
||||
};
|
||||
assertions = [
|
||||
{
|
||||
assertion = (cfg.whitelist == null) || (cfg.blacklist == null);
|
||||
|
|
|
@ -122,16 +122,20 @@ lib.nixvim.plugins.mkVimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
warnings =
|
||||
(optional (!(cfg.json.enable || cfg.yaml.enable)) ''
|
||||
NixVim(plugins.schemastore): 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.
|
||||
'')
|
||||
++ (optional (!(cfg.yaml.enable -> config.plugins.lsp.servers.yamlls.enable)) ''
|
||||
NixVim(plugins.schemastore): you have enabled `yaml` schemas, but `plugins.lsp.servers.yamlls` is not enabled.
|
||||
'');
|
||||
warnings = lib.nixvim.mkWarnings "plugins.schemastore" [
|
||||
{
|
||||
when = !(cfg.json.enable || cfg.yaml.enable);
|
||||
message = "You have enabled the plugin, but neither `json` or `yaml` schemas are enabled.";
|
||||
}
|
||||
{
|
||||
when = !(cfg.json.enable -> config.plugins.lsp.servers.jsonls.enable);
|
||||
message = "You have enabled `json` schemas, but `plugins.lsp.servers.jsonls` 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 = {
|
||||
jsonls.settings = mkIf cfg.json.enable {
|
||||
|
|
|
@ -97,8 +97,9 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
};
|
||||
|
||||
extraConfig = {
|
||||
warnings = mkIf (!config.plugins.treesitter.enable) [
|
||||
"Nixvim: treesitter-context needs treesitter to function as intended"
|
||||
];
|
||||
warnings = lib.nixvim.mkWarnings "plugins.treesitter-context" {
|
||||
when = !config.plugins.treesitter.enable;
|
||||
message = "This plugin needs treesitter to function as intended.";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -143,9 +143,10 @@ with lib;
|
|||
cfg = config.plugins.treesitter-refactor;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
warnings = mkIf (!config.plugins.treesitter.enable) [
|
||||
"Nixvim: treesitter-refactor needs treesitter to function as intended"
|
||||
];
|
||||
warnings = lib.nixvim.mkWarnings "plugins.treesitter-refactor" {
|
||||
when = !config.plugins.treesitter.enable;
|
||||
message = "This plugin needs treesitter to function as intended.";
|
||||
};
|
||||
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
|
|
|
@ -192,9 +192,10 @@ with lib;
|
|||
cfg = config.plugins.treesitter-textobjects;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
warnings = mkIf (!config.plugins.treesitter.enable) [
|
||||
"Nixvim: treesitter-textobjects needs treesitter to function as intended"
|
||||
];
|
||||
warnings = lib.nixvim.mkWarnings "plugins.treesitter-textobjects" {
|
||||
when = !config.plugins.treesitter.enable;
|
||||
message = "This plugin needs treesitter to function as intended.";
|
||||
};
|
||||
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
|
|
|
@ -371,10 +371,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
"use_diagnostic_signs"
|
||||
];
|
||||
in
|
||||
lib.optional (definedOpts != [ ]) ''
|
||||
Nixvim(plugins.trouble): 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.trouble" {
|
||||
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: added 2024-09-20 remove after 24.11
|
||||
plugins.web-devicons = lib.mkIf (
|
||||
|
|
|
@ -37,9 +37,10 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
];
|
||||
|
||||
extraConfig = {
|
||||
warnings = mkIf (!config.plugins.treesitter.enable) [
|
||||
"Nixvim: ts-autotag needs treesitter to function as intended"
|
||||
];
|
||||
warnings = lib.nixvim.mkWarnings "plugins.ts-autotag" {
|
||||
when = !config.plugins.treesitter.enable;
|
||||
message = "This plugin needs treesitter to function as intended.";
|
||||
};
|
||||
};
|
||||
|
||||
settingsOptions =
|
||||
|
|
|
@ -42,9 +42,10 @@ with lib;
|
|||
cfg = config.plugins.ts-context-commentstring;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
warnings = mkIf (!config.plugins.treesitter.enable) [
|
||||
"Nixvim: ts-context-commentstring needs treesitter to function as intended"
|
||||
];
|
||||
warnings = lib.nixvim.mkWarnings "plugins.ts-context-commentstring" {
|
||||
when = !config.plugins.treesitter.enable;
|
||||
message = "This plugin needs treesitter to function as intended.";
|
||||
};
|
||||
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
|
|
|
@ -265,9 +265,12 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
# TODO:: introduced 10-22-2024: remove after 24.11
|
||||
# Nested settings can't have normal mkRenamedOptionModule functionality so we can only
|
||||
# alert the user that they are using the old values
|
||||
warnings = lib.optional (definedOpts != [ ]) ''
|
||||
Nixvim(plugins.typescript-tools): The following settings have moved under `plugins.typescript-tools.settings.settings` with snake_case:
|
||||
${lib.concatMapStringsSep "\n" (opt: " - ${lib.showOption (lib.toList opt)}") definedOpts}
|
||||
'';
|
||||
warnings = lib.nixvim.mkWarnings "plugins.typescript-tools" {
|
||||
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}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -451,16 +451,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||
extraConfig =
|
||||
cfg: opts:
|
||||
lib.mkIf opts.registrations.isDefined {
|
||||
warnings = [
|
||||
''
|
||||
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.
|
||||
You should use `plugins.which-key.settings.spec' instead.
|
||||
warnings = lib.nixvim.mkWarnings "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.
|
||||
You should use `plugins.which-key.settings.spec' instead.
|
||||
|
||||
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
|
||||
''
|
||||
];
|
||||
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
|
||||
'';
|
||||
|
||||
plugins.which-key.luaConfig.content = lib.optionalString opts.registrations.isDefined ''
|
||||
require("which-key").register(${toLuaObject cfg.registrations})
|
||||
|
|
|
@ -62,23 +62,28 @@ in
|
|||
{
|
||||
config = {
|
||||
warnings =
|
||||
lib.optionals (options.plugins.web-devicons.enable.highestPrio == 1490) [
|
||||
''
|
||||
Nixvim: `plugins.web-devicons` was enabled automatically because the following plugins are enabled.
|
||||
(lib.nixvim.mkWarnings "plugins.web-devicons" {
|
||||
when = options.plugins.web-devicons.enable.highestPrio == 1490;
|
||||
|
||||
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
|
||||
enable `plugins.mini.enable` with `plugins.mini.modules.icons` and `plugins.mini.mockDevIcons`.
|
||||
${lib.concatMapStringsSep "\n" (name: "plugins.${name}") (
|
||||
builtins.filter (name: config.plugins.${name}.enable) iconsPackagePlugins
|
||||
)}
|
||||
''
|
||||
]
|
||||
'';
|
||||
})
|
||||
++ lib.foldlAttrs (
|
||||
warnings: plugin: msg:
|
||||
warnings
|
||||
++ lib.optional config.plugins.${plugin}.enable ''
|
||||
Nixvim Warning: The `${plugin}` plugin has been deprecated.
|
||||
${msg}
|
||||
''
|
||||
++ (lib.nixvim.mkWarnings "plugins.${plugin}" {
|
||||
when = config.plugins.${plugin}.enable;
|
||||
message = ''
|
||||
This plugin has been deprecated.
|
||||
${msg}
|
||||
'';
|
||||
})
|
||||
) [ ] deprecated;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -21,13 +21,16 @@ in
|
|||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
warnings = lib.optional (cfg.installGhc == null) ''
|
||||
`hls` relies on `ghc` (the Glasgow Haskell Compiler).
|
||||
- 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`.
|
||||
- Set `plugins.lsp.servers.hls.installGhc = false` to not have it install through Nixvim.
|
||||
By doing so, you will dismiss this warning.
|
||||
'';
|
||||
warnings = lib.nixvim.mkWarnings "plugins.lsp.servers.hls" {
|
||||
when = cfg.installGhc == null;
|
||||
message = ''
|
||||
`hls` relies on `ghc` (the Glasgow Haskell Compiler).
|
||||
- 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`.
|
||||
- Set `plugins.lsp.servers.hls.installGhc = false` to not have it install through Nixvim.
|
||||
By doing so, you will dismiss this warning.
|
||||
'';
|
||||
};
|
||||
|
||||
extraPackages = lib.optional ((lib.isBool cfg.installGhc) && cfg.installGhc) cfg.ghcPackage;
|
||||
};
|
||||
|
|
|
@ -41,27 +41,36 @@ in
|
|||
rustfmtPackage = mkPackageOption pkgs "rustfmt" { };
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
warnings =
|
||||
(lib.optional (cfg.installCargo == null) ''
|
||||
`rust_analyzer` relies on `cargo`.
|
||||
- Set `plugins.lsp.servers.rust_analyzer.installCargo = true` to install it automatically
|
||||
with Nixvim.
|
||||
You can customize which package to install by changing
|
||||
`plugins.lsp.servers.rust_analyzer.cargoPackage`.
|
||||
- Set `plugins.lsp.servers.rust_analyzer.installCargo = false` to not have it install
|
||||
through Nixvim.
|
||||
By doing so, you will dismiss this warning.
|
||||
'')
|
||||
++ (lib.optional (cfg.installRustc == null) ''
|
||||
`rust_analyzer` relies on `rustc`.
|
||||
- Set `plugins.lsp.servers.rust_analyzer.installRustc = true` to install it automatically
|
||||
with Nixvim.
|
||||
You can customize which package to install by changing
|
||||
`plugins.lsp.servers.rust_analyzer.rustcPackage`.
|
||||
- Set `plugins.lsp.servers.rust_analyzer.installRustc = false` to not have it install
|
||||
through Nixvim.
|
||||
By doing so, you will dismiss this warning.
|
||||
'');
|
||||
warnings = lib.nixvim.mkWarnings "plugins.lsp.servers.rust_analyzer" [
|
||||
{
|
||||
when = cfg.installCargo == null;
|
||||
|
||||
message = ''
|
||||
`rust_analyzer` relies on `cargo`.
|
||||
- Set `plugins.lsp.servers.rust_analyzer.installCargo = true` to install it automatically
|
||||
with Nixvim.
|
||||
You can customize which package to install by changing
|
||||
`plugins.lsp.servers.rust_analyzer.cargoPackage`.
|
||||
- Set `plugins.lsp.servers.rust_analyzer.installCargo = false` to not have it install
|
||||
through Nixvim.
|
||||
By doing so, you will dismiss this warning.
|
||||
'';
|
||||
}
|
||||
{
|
||||
when = cfg.installRustc == null;
|
||||
|
||||
message = ''
|
||||
`rust_analyzer` relies on `rustc`.
|
||||
- Set `plugins.lsp.servers.rust_analyzer.installRustc = true` to install it automatically
|
||||
with Nixvim.
|
||||
You can customize which package to install by changing
|
||||
`plugins.lsp.servers.rust_analyzer.rustcPackage`.
|
||||
- Set `plugins.lsp.servers.rust_analyzer.installRustc = false` to not have it install
|
||||
through Nixvim.
|
||||
By doing so, you will dismiss this warning.
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
extraPackages =
|
||||
let
|
||||
|
|
|
@ -2,7 +2,7 @@ let
|
|||
# This plugin is deprecated
|
||||
warnings = expect: [
|
||||
(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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue