mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-08 19:46:06 +01:00
Problem: Some modules are setting empty strings to extraConfig* options
with the intention to not generate any config. But empty
strings are also values, so they are still concatenated in the
final value of extraConfig* options. This results in a
multiple empty strings in extraConfigs.
Solution: Avoid using optionalString when setting values to extraConfig*
options. Use mkIf instead.
This commit also fixes mkIf condition in autocmd module.
`mkNeovimPlugin` is a special case. To avoid evaluating
caller's arguments mkMerge/optionalAttrs pattern is used
instead.
26 lines
533 B
Nix
26 lines
533 B
Nix
{
|
|
lib,
|
|
helpers,
|
|
config,
|
|
...
|
|
}:
|
|
with lib;
|
|
{
|
|
options = {
|
|
diagnostics = mkOption {
|
|
type = with types; attrsOf anything;
|
|
default = { };
|
|
description = "The configuration diagnostic options, provided to `vim.diagnostic.config`.";
|
|
example = {
|
|
virtual_text = false;
|
|
virtual_lines.only_current_line = true;
|
|
};
|
|
};
|
|
};
|
|
|
|
config = {
|
|
extraConfigLuaPre = mkIf (config.diagnostics != { }) ''
|
|
vim.diagnostic.config(${helpers.toLuaObject config.diagnostics})
|
|
'';
|
|
};
|
|
}
|