mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
lib/deprecation: expose mkSettingsRenamedOptionModules
publicly
Extracted the `optionsRenamedToSettings` implementation from`mkVimPlugin` and `mkNeovimPlugin` into a new public helper.
This commit is contained in:
parent
e3ec1c4a46
commit
db4c4e5b17
4 changed files with 20 additions and 19 deletions
|
@ -46,6 +46,18 @@ rec {
|
|||
'';
|
||||
};
|
||||
|
||||
mkSettingsRenamedOptionModules =
|
||||
oldPrefix: newPrefix:
|
||||
map (
|
||||
option':
|
||||
let
|
||||
option = toList option';
|
||||
oldPath = oldPrefix ++ option;
|
||||
newPath = newPrefix ++ map nixvim.toSnakeCase option;
|
||||
in
|
||||
mkRenamedOptionModule oldPath newPath
|
||||
);
|
||||
|
||||
# A clone of types.coercedTo, but it prints a warning when oldType is used.
|
||||
transitionType =
|
||||
oldType: coerceFn: newType:
|
||||
|
|
|
@ -38,7 +38,12 @@ let
|
|||
byteCompileLuaDrv
|
||||
;
|
||||
|
||||
inherit (helpers.deprecation) getOptionRecursive mkDeprecatedSubOptionModule transitionType;
|
||||
inherit (helpers.deprecation)
|
||||
getOptionRecursive
|
||||
mkDeprecatedSubOptionModule
|
||||
mkSettingsRenamedOptionModules
|
||||
transitionType
|
||||
;
|
||||
|
||||
inherit (helpers.options)
|
||||
defaultNullOpts
|
||||
|
|
|
@ -71,15 +71,7 @@ with lib;
|
|||
++ (optional deprecateExtraOptions (
|
||||
mkRenamedOptionModule (basePluginPath ++ [ "extraOptions" ]) settingsPath
|
||||
))
|
||||
++ (map (
|
||||
option:
|
||||
let
|
||||
optionPath = if isString option then [ option ] else option; # option is already a path (i.e. a list)
|
||||
|
||||
optionPathSnakeCase = map helpers.toSnakeCase optionPath;
|
||||
in
|
||||
mkRenamedOptionModule (basePluginPath ++ optionPath) (settingsPath ++ optionPathSnakeCase)
|
||||
) optionsRenamedToSettings);
|
||||
++ (nixvim.mkSettingsRenamedOptionModules basePluginPath settingsPath optionsRenamedToSettings);
|
||||
|
||||
options.${namespace}.${name} =
|
||||
{
|
||||
|
|
|
@ -86,15 +86,7 @@ with lib;
|
|||
++ (optional (deprecateExtraConfig && createSettingsOption) (
|
||||
mkRenamedOptionModule (basePluginPath ++ [ "extraConfig" ]) settingsPath
|
||||
))
|
||||
++ (map (
|
||||
option:
|
||||
let
|
||||
optionPath = if isString option then [ option ] else option; # option is already a path (i.e. a list)
|
||||
|
||||
optionPathSnakeCase = map helpers.toSnakeCase optionPath;
|
||||
in
|
||||
mkRenamedOptionModule (basePluginPath ++ optionPath) (settingsPath ++ optionPathSnakeCase)
|
||||
) optionsRenamedToSettings);
|
||||
++ (nixvim.mkSettingsRenamedOptionModules basePluginPath settingsPath optionsRenamedToSettings);
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue