lib/options: remove with helpers

This commit is contained in:
Matt Sturgeon 2024-08-01 17:55:03 +01:00
parent 820f8d58ea
commit bc84fda2b8
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299

View file

@ -1,6 +1,5 @@
{ lib, helpers }: { lib, helpers }:
with lib; with lib;
with helpers;
let let
# Render a plugin default string # Render a plugin default string
pluginDefaultText = pluginDefaultText =
@ -90,7 +89,7 @@ rec {
args args
// { // {
type = helpers.nixvimTypes.strLua; type = helpers.nixvimTypes.strLua;
apply = mkRaw; apply = helpers.mkRaw;
} }
); );
mkNullOrLua = description: mkNullOrLua' { inherit description; }; mkNullOrLua = description: mkNullOrLua' { inherit description; };
@ -101,7 +100,7 @@ rec {
args args
// { // {
type = helpers.nixvimTypes.strLuaFn; type = helpers.nixvimTypes.strLuaFn;
apply = mkRaw; apply = helpers.mkRaw;
} }
); );
mkNullOrLuaFn = description: mkNullOrLua' { inherit description; }; mkNullOrLuaFn = description: mkNullOrLua' { inherit description; };
@ -112,7 +111,7 @@ rec {
args args
// { // {
type = with helpers.nixvimTypes; either strLua type; type = with helpers.nixvimTypes; either strLua type;
apply = v: if isString v then mkRaw v else v; apply = v: if isString v then helpers.mkRaw v else v;
} }
); );
mkNullOrStrLuaOr = type: description: mkNullOrStrLuaOr' { inherit type description; }; mkNullOrStrLuaOr = type: description: mkNullOrStrLuaOr' { inherit type description; };
@ -123,7 +122,7 @@ rec {
args args
// { // {
type = with helpers.nixvimTypes; either strLuaFn type; type = with helpers.nixvimTypes; either strLuaFn type;
apply = v: if isString v then mkRaw v else v; apply = v: if isString v then helpers.mkRaw v else v;
} }
); );
mkNullOrStrLuaFnOr = type: description: mkNullOrStrLuaFnOr' { inherit type description; }; mkNullOrStrLuaFnOr = type: description: mkNullOrStrLuaFnOr' { inherit type description; };
@ -268,7 +267,8 @@ rec {
"hint" "hint"
]); ]);
apply = mapNullable ( apply = mapNullable (
value: if isInt value then value else mkRaw "vim.diagnostic.severity.${strings.toUpper value}" value:
if isInt value then value else helpers.mkRaw "vim.diagnostic.severity.${strings.toUpper value}"
); );
} }
); );
@ -281,7 +281,7 @@ rec {
// { // {
type = with helpers.nixvimTypes; either ints.unsigned logLevel; type = with helpers.nixvimTypes; either ints.unsigned logLevel;
apply = mapNullable ( apply = mapNullable (
value: if isInt value then value else mkRaw "vim.log.levels.${strings.toUpper value}" value: if isInt value then value else helpers.mkRaw "vim.log.levels.${strings.toUpper value}"
); );
} }
); );