plugins/otter: fix highlighting warning

`highlightEnabled` can never be null, since it is the `||` of two
booleans.

Historically, `plugins.treesitter.settings.highlight.enable` was a
default-null option. Checking for null was effectively checking for the
default value.

This would now be `plugins.treesitter.settings ? highlight.enable`,
however reading the actual boolean more closely matches the intent.
This commit is contained in:
Matt Sturgeon 2025-12-28 06:35:14 +00:00
parent 56f03c4313
commit 4a6d561362
2 changed files with 25 additions and 1 deletions

View file

@ -87,7 +87,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
inherit (config.plugins) treesitter;
highlightEnabled = treesitter.highlight.enable || (treesitter.settings.highlight.enable or false);
in
config.plugins.treesitter.enable -> highlightEnabled == null;
!(treesitter.enable && highlightEnabled);
message = ''
You have enabled otter, but treesitter syntax highlighting is not enabled.

View file

@ -61,4 +61,28 @@
};
};
};
warning-no-highlight = {
test.runNvim = false;
test.warnings = expect: [
(expect "count" 1)
(expect "any" "You have enabled otter, but treesitter syntax highlighting is not enabled.")
];
plugins = {
otter.enable = true;
treesitter.enable = true;
};
};
warning-no-treesitter = {
test.runNvim = false;
test.warnings = expect: [
(expect "count" 1)
(expect "any" "You have enabled otter, but treesitter syntax highlighting is not enabled.")
];
plugins = {
otter.enable = true;
treesitter.highlight.enable = true;
};
};
}