mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
modules/opts: fix code generation condition to prevent false positives
Currently, we generate the lua code as soon as the value of the option is not an empty attrs. However, a case where the attrs only contains `null` values (`nord_colorscheme = null; nord_foo = null;}` would pass the `if` condition, but the generated lua table would still be empty because `toLua` filters out those values. Hence, we should directly check if the attrs would be translated to an empty lua table or not to decide whether we should generate the lua snippet or not.
This commit is contained in:
parent
929bb0cd1c
commit
ed30fd8588
1 changed files with 3 additions and 3 deletions
|
@ -67,12 +67,12 @@ in
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
varName = "nixvim_${luaVariableName}";
|
varName = "nixvim_${luaVariableName}";
|
||||||
optionDefinitions = config.${optionName};
|
optionDefinitions = helpers.toLuaObject config.${optionName};
|
||||||
in
|
in
|
||||||
lib.optionalString (optionDefinitions != { }) ''
|
lib.optionalString (optionDefinitions != "{ }") ''
|
||||||
-- Set up ${prettyName} {{{
|
-- Set up ${prettyName} {{{
|
||||||
do
|
do
|
||||||
local ${varName} = ${helpers.toLuaObject optionDefinitions}
|
local ${varName} = ${optionDefinitions}
|
||||||
|
|
||||||
for k,v in pairs(${varName}) do
|
for k,v in pairs(${varName}) do
|
||||||
vim.${luaApi}[k] = v
|
vim.${luaApi}[k] = v
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue