Compare commits

...

3 commits

Author SHA1 Message Date
Ching Pei Yang
434810e0a5
Merge af72dc105d into 9d0247c599 2024-05-18 12:52:46 +00:00
Ching Pei Yang
af72dc105d lib: remove unused __empty special case in toLuaObject 2024-05-18 14:52:40 +02:00
Ching Pei Yang
8aa3a23e97 lib: do not filter out empty attrs in toLuaObject 2024-05-12 03:17:04 +02:00
2 changed files with 2 additions and 12 deletions

View file

@ -65,8 +65,6 @@ in rec {
then then
if isLuaInline args if isLuaInline args
then args.expr then args.expr
else if hasAttr "__empty" args
then "{ }"
else else
"{" "{"
+ (concatStringsSep "," + (concatStringsSep ","
@ -76,10 +74,7 @@ in rec {
then toLuaObject v then toLuaObject v
else "[${toLuaObject n}] = " + (toLuaObject v)) else "[${toLuaObject n}] = " + (toLuaObject v))
(filterAttrs (filterAttrs
( (_: v: v != null)
_: v:
(v != null) && (toLuaObject v != "{}")
)
args))) args)))
+ "}" + "}"
else if isList args else if isList args

View file

@ -60,16 +60,11 @@
config = (attrs) the configuration options for this mapping (noremap, silent...) config = (attrs) the configuration options for this mapping (noremap, silent...)
} }
*/ */
normalizeAction = action: let normalizeAction = action: {
# Extract the values of the config options that have been explicitly set by the user # Extract the values of the config options that have been explicitly set by the user
config = config =
filterAttrs (_: v: v != null) filterAttrs (_: v: v != null)
(getAttrs (attrNames mapConfigOptions) action); (getAttrs (attrNames mapConfigOptions) action);
in {
config =
if config == {}
then {"__empty" = null;}
else config;
action = action =
if action.lua if action.lua
then mkLuaInline action.action then mkLuaInline action.action