mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +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.
|
# A clone of types.coercedTo, but it prints a warning when oldType is used.
|
||||||
transitionType =
|
transitionType =
|
||||||
oldType: coerceFn: newType:
|
oldType: coerceFn: newType:
|
||||||
|
|
|
@ -38,7 +38,12 @@ let
|
||||||
byteCompileLuaDrv
|
byteCompileLuaDrv
|
||||||
;
|
;
|
||||||
|
|
||||||
inherit (helpers.deprecation) getOptionRecursive mkDeprecatedSubOptionModule transitionType;
|
inherit (helpers.deprecation)
|
||||||
|
getOptionRecursive
|
||||||
|
mkDeprecatedSubOptionModule
|
||||||
|
mkSettingsRenamedOptionModules
|
||||||
|
transitionType
|
||||||
|
;
|
||||||
|
|
||||||
inherit (helpers.options)
|
inherit (helpers.options)
|
||||||
defaultNullOpts
|
defaultNullOpts
|
||||||
|
|
|
@ -71,15 +71,7 @@ with lib;
|
||||||
++ (optional deprecateExtraOptions (
|
++ (optional deprecateExtraOptions (
|
||||||
mkRenamedOptionModule (basePluginPath ++ [ "extraOptions" ]) settingsPath
|
mkRenamedOptionModule (basePluginPath ++ [ "extraOptions" ]) settingsPath
|
||||||
))
|
))
|
||||||
++ (map (
|
++ (nixvim.mkSettingsRenamedOptionModules basePluginPath settingsPath optionsRenamedToSettings);
|
||||||
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);
|
|
||||||
|
|
||||||
options.${namespace}.${name} =
|
options.${namespace}.${name} =
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,15 +86,7 @@ with lib;
|
||||||
++ (optional (deprecateExtraConfig && createSettingsOption) (
|
++ (optional (deprecateExtraConfig && createSettingsOption) (
|
||||||
mkRenamedOptionModule (basePluginPath ++ [ "extraConfig" ]) settingsPath
|
mkRenamedOptionModule (basePluginPath ++ [ "extraConfig" ]) settingsPath
|
||||||
))
|
))
|
||||||
++ (map (
|
++ (nixvim.mkSettingsRenamedOptionModules basePluginPath settingsPath optionsRenamedToSettings);
|
||||||
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);
|
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue