mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-09 22:55:58 +01:00
lib: switch to mkLuaInline
This commit is contained in:
parent
5ea6272bee
commit
77d3cd5e0c
3 changed files with 9 additions and 7 deletions
|
@ -48,11 +48,13 @@ in rec {
|
||||||
# Convert a list of lua expressions to a lua table. The difference to listToLuaTable is that the elements here are expected to be lua expressions already, whereas listToLuaTable converts from nix types to lua first
|
# Convert a list of lua expressions to a lua table. The difference to listToLuaTable is that the elements here are expected to be lua expressions already, whereas listToLuaTable converts from nix types to lua first
|
||||||
luaTable = items: ''{${concatStringsSep "," items}}'';
|
luaTable = items: ''{${concatStringsSep "," items}}'';
|
||||||
|
|
||||||
|
isLuaInline = {_type ? null, ...}: _type == "lua-inline";
|
||||||
|
|
||||||
toLuaObject = args:
|
toLuaObject = args:
|
||||||
if isAttrs args
|
if isAttrs args
|
||||||
then
|
then
|
||||||
if hasAttr "__raw" args
|
if isLuaInline args
|
||||||
then args.__raw
|
then args.expr
|
||||||
else if hasAttr "__empty" args
|
else if hasAttr "__empty" args
|
||||||
then "{ }"
|
then "{ }"
|
||||||
else
|
else
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
typesLanguage = import ./languages.nix {inherit lib;};
|
typesLanguage = import ./languages.nix {inherit lib;};
|
||||||
in {
|
in {
|
||||||
inherit (typesDag) dagOf;
|
inherit (typesDag) dagOf;
|
||||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption rawLua;
|
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline;
|
||||||
inherit (typesLanguage) diagnostics mkGrammarOption;
|
inherit (typesLanguage) diagnostics mkGrammarOption;
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,13 +145,13 @@ in {
|
||||||
type = pluginsType;
|
type = pluginsType;
|
||||||
};
|
};
|
||||||
|
|
||||||
rawLua = lib.mkOptionType {
|
luaInline = lib.mkOptionType {
|
||||||
name = "rawLua";
|
name = "luaInline";
|
||||||
check = val: isString val || val ? __raw;
|
check = x: lib.nvim.lua.isLuaInline x || builtins.isString x;
|
||||||
merge = loc: defs: let
|
merge = loc: defs: let
|
||||||
val =
|
val =
|
||||||
if isString loc
|
if isString loc
|
||||||
then {__raw = val;}
|
then lib.generators.mkLuaInline loc
|
||||||
else loc;
|
else loc;
|
||||||
in
|
in
|
||||||
lib.mergeOneOption val defs;
|
lib.mergeOneOption val defs;
|
||||||
|
|
Loading…
Reference in a new issue