misc: remove deprecated/renamed options warnings

This commit is contained in:
Gaetan Lepage 2023-05-19 12:38:24 +02:00 committed by Gaétan Lepage
parent a10b6f02cd
commit 2da04fa4ad
8 changed files with 5 additions and 327 deletions

View file

@ -7,7 +7,6 @@
with lib; let with lib; let
cfg = config.plugins.barbar; cfg = config.plugins.barbar;
helpers = import ../helpers.nix {inherit lib;}; helpers = import ../helpers.nix {inherit lib;};
basePluginPath = ["plugins" "barbar"];
bufferOptions = { bufferOptions = {
bufferIndex = helpers.mkNullOrOption types.bool '' bufferIndex = helpers.mkNullOrOption types.bool ''
@ -82,53 +81,6 @@ with lib; let
orderByWindowNumber = "OrderByWindowNumber"; orderByWindowNumber = "OrderByWindowNumber";
}; };
in { in {
# All the following renames/removes are from 2023-04-05.
# TODO: Remove them in 1-2 months.
imports = [
(mkRemovedOptionModule (basePluginPath ++ ["closable"]) "")
(
mkRenamedOptionModule
(basePluginPath ++ ["animations"])
(basePluginPath ++ ["animation"])
)
(
mkRenamedOptionModule
(basePluginPath ++ ["diagnostics"])
(basePluginPath ++ ["icons" "diagnostics"])
)
(mkRemovedOptionModule (basePluginPath ++ ["icons" "enable"]) "")
(
mkRenamedOptionModule
(basePluginPath ++ ["icons" "customColors"])
(basePluginPath ++ ["icons" "filetype" "customColors"])
)
(
mkRenamedOptionModule
(basePluginPath ++ ["icons" "separatorActive"])
(basePluginPath ++ ["icons" "separator" "left"])
)
(
mkRenamedOptionModule
(basePluginPath ++ ["icons" "separatorInactive"])
(basePluginPath ++ ["icons" "inactive" "separator" "left"])
)
(
mkRenamedOptionModule
(basePluginPath ++ ["icons" "separatorVisible"])
(basePluginPath ++ ["icons" "visible" "separator" "left"])
)
(
mkRenamedOptionModule
(basePluginPath ++ ["icons" "closeTab"])
(basePluginPath ++ ["icons" "button"])
)
(
mkRenamedOptionModule
(basePluginPath ++ ["icons" "closeTabModified"])
(basePluginPath ++ ["icons" "modified" "button"])
)
];
options.plugins.barbar = options.plugins.barbar =
helpers.extraOptionsOptions helpers.extraOptionsOptions
// { // {

View file

@ -8,8 +8,6 @@ with lib; let
cfg = config.plugins.bufferline; cfg = config.plugins.bufferline;
helpers = import ../helpers.nix args; helpers = import ../helpers.nix args;
basePluginPath = ["plugins" "bufferline"];
highlightOption = { highlightOption = {
fg = helpers.mkNullOrOption types.str "foreground color"; fg = helpers.mkNullOrOption types.str "foreground color";
@ -83,38 +81,6 @@ with lib; let
pick_selected = "pickSelected"; pick_selected = "pickSelected";
}; };
in { in {
# Those renamed are from 2023-04-04.
# TODO: remove them in 1-2 months
imports =
[
(
mkRenamedOptionModule
(basePluginPath ++ ["indicatorIcon"])
(basePluginPath ++ ["indicator" "icon"])
)
]
++ (
lists.flatten (
map (
highlightOptionName: let
prefix = basePluginPath ++ ["highlights" highlightOptionName];
in [
(
mkRenamedOptionModule
(prefix ++ ["guifg"])
(prefix ++ ["fg"])
)
(
mkRenamedOptionModule
(prefix ++ ["guibg"])
(prefix ++ ["bg"])
)
]
)
(attrValues highlightOptions)
)
);
options = { options = {
plugins.bufferline = plugins.bufferline =
helpers.extraOptionsOptions helpers.extraOptionsOptions

View file

@ -8,8 +8,6 @@ with lib; let
cfg = config.plugins.nvim-tree; cfg = config.plugins.nvim-tree;
helpers = import ../helpers.nix {inherit lib;}; helpers = import ../helpers.nix {inherit lib;};
ifNonNull' = helpers.ifNonNull'; ifNonNull' = helpers.ifNonNull';
optionWarnings = import ../../lib/option-warnings.nix args;
basePluginPath = ["plugins" "nvim-tree"];
openWinConfigOption = openWinConfigOption =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
@ -32,39 +30,6 @@ with lib; let
They will be overridden to fit the file_popup content. They will be overridden to fit the file_popup content.
''; '';
in { in {
imports = [
(optionWarnings.mkRenamedOption {
option = basePluginPath ++ ["updateCwd"];
newOption = basePluginPath ++ ["syncRootWithCwd"];
})
(optionWarnings.mkRenamedOption {
option = basePluginPath ++ ["openOnTab"];
newOption = basePluginPath ++ ["tab" "sync" "open"];
})
(optionWarnings.mkRenamedOption {
option = basePluginPath ++ ["updateToBufDir"];
newOption = basePluginPath ++ ["hijackDirectories"];
})
(optionWarnings.mkDeprecatedOption {
option = basePluginPath ++ ["removeKeymaps"];
alternative = basePluginPath ++ ["onAttach"];
message = ''
Mappings can now be customized from the `onAttach` function.
Learn more at `:help nvim-tree-mappings-legacy`.
'';
})
# Deprecate warning added 2023-04-24
# TODO Remove both this warning and the one above (removeKeymaps) in ~1 month (June).
(optionWarnings.mkDeprecatedOption {
option = basePluginPath ++ ["view" "mappings"];
alternative = basePluginPath ++ ["onAttach"];
message = ''
Mappings can now be customized from the `onAttach` function.
Learn more at `:help nvim-tree-mappings-legacy`.
'';
})
];
options.plugins.nvim-tree = options.plugins.nvim-tree =
helpers.extraOptionsOptions helpers.extraOptionsOptions
// { // {
@ -380,16 +345,6 @@ in {
} }
''; '';
removeKeymaps = helpers.defaultNullOpts.mkNullable (types.either types.bool (types.listOf types.str)) "false" ''
This can be used to remove the default mappings in the tree.
- Remove specific keys by passing a `string` table of keys
eg. {"<C-o>", "<CR>", "o", "<Tab>"}
- Remove all default mappings by passing `true`
- Ignore by passing `false`
Deprecated: See https://github.com/nvim-tree/nvim-tree.lua/wiki/Migrating-To-on_attach
'';
selectPrompts = helpers.defaultNullOpts.mkBool false '' selectPrompts = helpers.defaultNullOpts.mkBool false ''
Use |vim.ui.select| style prompts. Use |vim.ui.select| style prompts.
Necessary when using a UI prompt decorator such as dressing.nvim or telescope-ui-select.nvim. Necessary when using a UI prompt decorator such as dressing.nvim or telescope-ui-select.nvim.
@ -463,73 +418,6 @@ in {
Show diagnostic sign column. Value can be `"yes"`, `"auto"`, `"no"`. Show diagnostic sign column. Value can be `"yes"`, `"auto"`, `"no"`.
''; '';
mappings = helpers.mkCompositeOption "Deprecated: please see |nvim-tree-mappings-legacy|." {
customOnly = helpers.defaultNullOpts.mkBool false ''
Will use only the provided user mappings and not the default otherwise,
extends the default mappings with the provided user mappings.
'';
list = let
mappingOption = types.submodule {
options = {
key = mkOption {
type = with types; either str (listOf str);
description = "Left hand side of the mapping";
};
action = mkOption {
type = types.str;
description = ''
`""` to remove an action with {key}. The case of {key} must exactly match the
action you are removing e.g. `"<Tab>"` to remove the default preview action.
An arbitrary description when using `action_cb`.
'';
};
action_cb = helpers.mkNullOrOption types.str ''
optional custom function that will be called.
Receives the node as a parameter.
Non-empty description for `action` is required.
'';
mode = helpers.defaultNullOpts.mkStr "n" ''
optional mode as per |nvim_set_keymap|.
'';
};
};
in
helpers.defaultNullOpts.mkNullable (types.listOf mappingOption) "{}" ''
A list of keymaps that will extend or override the default keymaps.
Example:
view.mappings = {
list = [
# remove a default mapping for cd
{
key = "<2-RightMouse>";
action = "";
}
# add multiple normal mode mappings for edit
{
key = [ "<CR>" "o" ];
action = "edit";
mode = "n";
}
# custom action
{
key = "p";
action = "print_the_node_path";
action_cb = \'\'
function(node)
print(node.absolute_path)
end
\'\';
};
];
};
'';
};
float = helpers.mkCompositeOption "Configuration options for floating window." { float = helpers.mkCompositeOption "Configuration options for floating window." {
enable = helpers.defaultNullOpts.mkBool false '' enable = helpers.defaultNullOpts.mkBool false ''
Tree window will be floating. Tree window will be floating.
@ -1056,7 +944,6 @@ in {
ignore_dirs = ignoreDirs; ignore_dirs = ignoreDirs;
}; };
on_attach = onAttach; on_attach = onAttach;
remove_keymaps = removeKeymaps;
select_prompts = selectPrompts; select_prompts = selectPrompts;
view = with view; { view = with view; {
centralize_selection = centralizeSelection; centralize_selection = centralizeSelection;
@ -1069,24 +956,6 @@ in {
inherit number; inherit number;
inherit relativenumber; inherit relativenumber;
inherit signcolumn; inherit signcolumn;
mappings = with mappings;
ifNonNull' cfg.view.mappings {
custom_only = customOnly;
list =
if list == null
then null
else
map (
mapping: {
inherit (mapping) key action mode;
action_cb =
if (mapping.action_cb == null)
then null
else helpers.mkRaw mapping.action_cb;
}
)
list;
};
float = with float; float = with float;
ifNonNull' cfg.view.float { ifNonNull' cfg.view.float {
inherit enable; inherit enable;

View file

@ -1,6 +1,5 @@
{ {
pkgs, pkgs,
config,
lib, lib,
... ...
} @ args: } @ args:
@ -8,9 +7,6 @@ with lib; let
lspHelpers = import ../helpers.nix args; lspHelpers = import ../helpers.nix args;
helpers = import ../../helpers.nix {inherit lib;}; helpers = import ../../helpers.nix {inherit lib;};
optionWarnings = import ../../../lib/option-warnings.nix args;
basePluginPath = ["plugins" "lsp" "servers"];
servers = [ servers = [
{ {
name = "astro"; name = "astro";
@ -355,11 +351,5 @@ with lib; let
in { in {
imports = imports =
lib.lists.map (lspHelpers.mkLsp) servers lib.lists.map (lspHelpers.mkLsp) servers
++ [./pylsp.nix] ++ [./pylsp.nix];
++ [
(optionWarnings.mkRenamedOption {
option = basePluginPath ++ ["sumneko-lua"];
newOption = basePluginPath ++ ["lua-ls"];
})
];
} }

View file

@ -3,12 +3,10 @@
config, config,
lib, lib,
... ...
} @ args: }:
with lib; let with lib; let
cfg = config.plugins.floaterm; cfg = config.plugins.floaterm;
helpers = import ../helpers.nix {inherit lib;}; helpers = import ../helpers.nix {inherit lib;};
optionWarnings = import ../../lib/option-warnings.nix args;
basePluginPath = ["plugins" "floaterm"];
settings = { settings = {
shell = { shell = {
@ -150,25 +148,6 @@ with lib; let
}; };
}; };
in { in {
imports = [
(optionWarnings.mkRenamedOption {
option = basePluginPath ++ ["winType"];
newOption = basePluginPath ++ ["wintype"];
})
(optionWarnings.mkRenamedOption {
option = basePluginPath ++ ["winWidth"];
newOption = basePluginPath ++ ["width"];
})
(optionWarnings.mkRenamedOption {
option = basePluginPath ++ ["winHeight"];
newOption = basePluginPath ++ ["height"];
})
(optionWarnings.mkRenamedOption {
option = basePluginPath ++ ["borderChars"];
newOption = basePluginPath ++ ["borderchars"];
})
];
options.plugins.floaterm = let options.plugins.floaterm = let
# Misc options # Misc options
# `OPTION = VALUE` # `OPTION = VALUE`

View file

@ -4,54 +4,8 @@
... ...
} @ args: } @ args:
with lib; with lib;
with import ../helpers.nix {inherit lib;}; let with import ../helpers.nix {inherit lib;};
optionWarnings = import ../../lib/option-warnings.nix args; mkPlugin args {
basePluginPath = ["plugins" "magma-nvim"];
in
{
# Those renames happended on 03-24-2023 (TODO remove in 1-2 months)
imports =
map (
{
oldName,
newName,
}:
optionWarnings.mkRenamedOption {
option = basePluginPath ++ [oldName];
newOption = basePluginPath ++ [newName];
}
) [
{
oldName = "image_provider";
newName = "imageProvider";
}
{
oldName = "automatically_open_output";
newName = "automaticallyOpenOutput";
}
{
oldName = "wrap_output";
newName = "wrapOutput";
}
{
oldName = "output_window_borders";
newName = "outputWindowBorders";
}
{
oldName = "cell_highlight_group";
newName = "cellHighlightGroup";
}
{
oldName = "save_path";
newName = "savePath";
}
{
oldName = "show_mimetype_debug";
newName = "showMimetypeDebug";
}
];
}
// mkPlugin args {
name = "magma-nvim"; name = "magma-nvim";
description = "magma-nvim"; description = "magma-nvim";
package = pkgs.vimPlugins.magma-nvim-goose; package = pkgs.vimPlugins.magma-nvim-goose;

View file

@ -3,33 +3,11 @@
config, config,
lib, lib,
... ...
} @ args: }:
with lib; let with lib; let
cfg = config.plugins.mark-radar; cfg = config.plugins.mark-radar;
helpers = import ../helpers.nix {inherit lib;}; helpers = import ../helpers.nix {inherit lib;};
optionWarnings = import ../../lib/option-warnings.nix args;
basePluginPath = ["plugins" "mark-radar"];
in { in {
# Those renames were done on 03-24-2023
imports = [
(optionWarnings.mkRenamedOption {
option = basePluginPath ++ ["highlight_background"];
newOption = basePluginPath ++ ["backgroundHighlight"];
})
(optionWarnings.mkRenamedOption {
option = basePluginPath ++ ["background_highlight_group"];
newOption = basePluginPath ++ ["backgroundHighlightGroup"];
})
(optionWarnings.mkRenamedOption {
option = basePluginPath ++ ["highlight_group"];
newOption = basePluginPath ++ ["highlightGroup"];
})
(optionWarnings.mkRenamedOption {
option = basePluginPath ++ ["set_default_keybinds"];
newOption = basePluginPath ++ ["setDefaultMappings"];
})
];
options.plugins.mark-radar = options.plugins.mark-radar =
helpers.extraOptionsOptions helpers.extraOptionsOptions
// { // {

View file

@ -7,21 +7,11 @@
with lib; let with lib; let
cfg = config.plugins.notify; cfg = config.plugins.notify;
helpers = import ../helpers.nix {inherit lib;}; helpers = import ../helpers.nix {inherit lib;};
optionWarnings = import ../../lib/option-warnings.nix {inherit lib;};
basePluginPath = ["plugins" "notify"];
icon = mkOption { icon = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
}; };
in { in {
imports = [
(optionWarnings.mkRenamedOption {
# 2023-03-24
option = basePluginPath ++ ["backgroundColor"];
newOption = basePluginPath ++ ["backgroundColour"];
})
];
options.plugins.notify = { options.plugins.notify = {
enable = mkEnableOption "notify"; enable = mkEnableOption "notify";