From 4a6d561362a02ec516135a9bb2b805e5af3c1e3f Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Sun, 28 Dec 2025 06:35:14 +0000 Subject: [PATCH] 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. --- plugins/by-name/otter/default.nix | 2 +- .../plugins/by-name/otter/default.nix | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/plugins/by-name/otter/default.nix b/plugins/by-name/otter/default.nix index a27f7dd0..b9a6aa9c 100644 --- a/plugins/by-name/otter/default.nix +++ b/plugins/by-name/otter/default.nix @@ -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. diff --git a/tests/test-sources/plugins/by-name/otter/default.nix b/tests/test-sources/plugins/by-name/otter/default.nix index 8ba902df..040ee57a 100644 --- a/tests/test-sources/plugins/by-name/otter/default.nix +++ b/tests/test-sources/plugins/by-name/otter/default.nix @@ -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; + }; + }; }