Closed andrevmatos closed 1 week ago
It seems other nil default options are properly cleaned up, so this may have to do with these overridden sections sitting inside a list?
I've played around in the repl, and I can reproduce the issue. I can't find a way to manually craft an attrset that also has the issue though.
nix-repl> :lf .
Added 25 variables.
nix-repl> helpers = outputs.lib.x86_64-linux.helpers
nix-repl> n = legacyPackages.x86_64-linux.makeNixvim {
plugins.lualine = {
enable = true;
sections.lualine_b = [
{name = "filename";}
];
};
}
nix-repl> n.config.plugins.lualine.sections
{ lualine_a = null; lualine_b = [ ... ]; lualine_c = null; lualine_x = null; lualine_y = null; lualine_z = null; }
nix-repl> builtins.head n.config.plugins.lualine.sections.lualine_b
{ color = null; extraConfig = { ... }; fmt = null; icon = null; icons_enabled = null; name = "filename"; padding = null; separator = { ... }; }
nix-repl> n.config.extraConfigLua
"require(\"lualine\").setup({ options = { icons_enabled = true }, sections = { lualine_b = { { \"filename\", color = nil, fmt = nil, icon = nil, icons_enabled = nil, padding = nil, separator = { left = nil, right = nil } } } } })\n\nvim.filetype.add({ extension = { v = \"vlang\" } })\n"
nix-repl> helpers.toLuaObject n.config.plugins.lualine.sections.lualine_b
"{ { name = \"filename\" } }"
nix-repl> helpers.toLuaObject { foo = null; }
"{ }"
nix-repl> helpers.toLuaObject { foo = null; bar = { a = null; __unkeyed = "hi"; }; }
"{ bar = { \"hi\" } }"
Ah!
nix-repl> helpers.toLuaObject { a = { b = [ { a = null; __unkeyed-1 = "hi"; c = null; } { a = null; b = "test"; c = null; } ]; c = null; }; }
"{ a = { b = { { \"hi\", a = nil, c = nil }, { a = nil, b = \"test\", c = nil } } } }"
removeEmptiesRecursive
doesn't recurse into list-entries.
It should though:
lualine
unstable
unstable
Description
lualine sections which are overridden by user end up with square separators, instead of the default;
While looking at the generated
init.lua
, it looks liketoLua
is failing to filter out thenull
attributes (as perremoveNullAttrValues
default option), and the section ends up withseparator = { left = nil, right = nil}
property, which is interpreted by lualine as overriding the plugin-wide default separators.May have been caused by #1761. lualine is just how I identified the issue, but if nixvim is failing to properly clean up nil values, this could have much wider unintended effects.
Minimal, Reproducible Example (MRE)
Generated init.lua snippet:
Expected: