mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
lib/lua: pad table ,
with a space
Makes toLuaObject's output a little more readable.
This commit is contained in:
parent
00ce71f51a
commit
53a9599cc4
2 changed files with 9 additions and 9 deletions
|
@ -43,7 +43,7 @@ rec {
|
||||||
"{ }"
|
"{ }"
|
||||||
else
|
else
|
||||||
"{"
|
"{"
|
||||||
+ (concatStringsSep "," (
|
+ (concatStringsSep ", " (
|
||||||
mapAttrsToList (
|
mapAttrsToList (
|
||||||
n: v:
|
n: v:
|
||||||
let
|
let
|
||||||
|
@ -63,7 +63,7 @@ rec {
|
||||||
))
|
))
|
||||||
+ "}"
|
+ "}"
|
||||||
else if builtins.isList args then
|
else if builtins.isList args then
|
||||||
"{" + concatMapStringsSep "," toLuaObject args + "}"
|
"{" + concatMapStringsSep ", " toLuaObject args + "}"
|
||||||
else if builtins.isString args then
|
else if builtins.isString args then
|
||||||
# This should be enough!
|
# This should be enough!
|
||||||
builtins.toJSON args
|
builtins.toJSON args
|
||||||
|
|
|
@ -55,7 +55,7 @@ let
|
||||||
3
|
3
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
expected = ''{foo = "bar",qux = {1,2,3}}'';
|
expected = ''{foo = "bar", qux = {1, 2, 3}}'';
|
||||||
};
|
};
|
||||||
|
|
||||||
testToLuaObjectRawLua = {
|
testToLuaObjectRawLua = {
|
||||||
|
@ -68,7 +68,7 @@ let
|
||||||
"__unkeyed...." = "foo";
|
"__unkeyed...." = "foo";
|
||||||
bar = "baz";
|
bar = "baz";
|
||||||
};
|
};
|
||||||
expected = ''{"foo",bar = "baz"}'';
|
expected = ''{"foo", bar = "baz"}'';
|
||||||
};
|
};
|
||||||
|
|
||||||
testToLuaObjectNestedAttrs = {
|
testToLuaObjectNestedAttrs = {
|
||||||
|
@ -81,7 +81,7 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
expected = ''{a = {b = 1,c = 2,d = {e = 3}}}'';
|
expected = ''{a = {b = 1, c = 2, d = {e = 3}}}'';
|
||||||
};
|
};
|
||||||
|
|
||||||
testToLuaObjectNestedList = {
|
testToLuaObjectNestedList = {
|
||||||
|
@ -98,7 +98,7 @@ let
|
||||||
]
|
]
|
||||||
7
|
7
|
||||||
];
|
];
|
||||||
expected = "{1,2,{3,4,{5,6}},7}";
|
expected = "{1, 2, {3, 4, {5, 6}}, 7}";
|
||||||
};
|
};
|
||||||
|
|
||||||
testToLuaObjectNonStringPrims = {
|
testToLuaObjectNonStringPrims = {
|
||||||
|
@ -109,7 +109,7 @@ let
|
||||||
d = false;
|
d = false;
|
||||||
e = null;
|
e = null;
|
||||||
};
|
};
|
||||||
expected = ''{a = 1.000000,b = 2,c = true,d = false}'';
|
expected = ''{a = 1.000000, b = 2, c = true, d = false}'';
|
||||||
};
|
};
|
||||||
|
|
||||||
testToLuaObjectNilPrim = {
|
testToLuaObjectNilPrim = {
|
||||||
|
@ -150,7 +150,7 @@ let
|
||||||
g = helpers.emptyTable;
|
g = helpers.emptyTable;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
expected = ''{c = { },d = {g = { }}}'';
|
expected = ''{c = { }, d = {g = { }}}'';
|
||||||
};
|
};
|
||||||
|
|
||||||
testToLuaObjectQuotedKeys = {
|
testToLuaObjectQuotedKeys = {
|
||||||
|
@ -160,7 +160,7 @@ let
|
||||||
c = "c";
|
c = "c";
|
||||||
d-d = "d";
|
d-d = "d";
|
||||||
};
|
};
|
||||||
expected = ''{["1_a"] = "a",_b = "b",c = "c",["d-d"] = "d"}'';
|
expected = ''{["1_a"] = "a", _b = "b", c = "c", ["d-d"] = "d"}'';
|
||||||
};
|
};
|
||||||
|
|
||||||
testIsLuaKeyword = {
|
testIsLuaKeyword = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue