Compare commits

..

1 commit

Author SHA1 Message Date
Ching Pei Yang
28e536182a
Merge 7d9f1e0481 into 9074b6e5e7 2024-05-21 06:05:41 -04:00
3 changed files with 12 additions and 9 deletions

View file

@ -19,8 +19,6 @@ Release notes for release 0.7
[horriblename](https://github.com/horriblename):
- Fix broken treesitter-context keybinds in visual mode
- Depcrecate use of `__empty` to define empty tables in lua. Empty attrset are
no longer filtered and thus should be used instead.
[NotAShelf](https://github.com/notashelf)

View file

@ -3,7 +3,7 @@
inherit (builtins) hasAttr head throw typeOf isList isAttrs isBool isInt isString isPath isFloat toJSON;
inherit (lib.attrsets) mapAttrsToList filterAttrs;
inherit (lib.strings) concatStringsSep concatMapStringsSep stringToCharacters;
inherit (lib.trivial) boolToString warn;
inherit (lib.trivial) boolToString;
in rec {
wrapLuaConfig = {
luaBefore ? "",
@ -66,10 +66,7 @@ in rec {
if isLuaInline args
then args.expr
else if hasAttr "__empty" args
then
warn ''
Using `__empty` to define an empty lua table is deprecated. Use an empty attrset instead.
'' "{ }"
then "{ }"
else
"{"
+ (concatStringsSep ","
@ -79,7 +76,10 @@ in rec {
then toLuaObject v
else "[${toLuaObject n}] = " + (toLuaObject v))
(filterAttrs
(_: v: v != null)
(
_: v:
(v != null) && (toLuaObject v != "{}")
)
args)))
+ "}"
else if isList args

View file

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