From db0fa29513adca685a1557ed41c52f3fb20add28 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Sun, 28 Dec 2025 06:47:24 +0000 Subject: [PATCH] plugins/otter: use option interpolation in warning Stringifying actual options via `"${option}"` interpolation ensures the full option path (with prefix) is used. --- plugins/by-name/otter/default.nix | 13 +++++++++---- .../test-sources/plugins/by-name/otter/default.nix | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/plugins/by-name/otter/default.nix b/plugins/by-name/otter/default.nix index b9a6aa9c..ca778db2 100644 --- a/plugins/by-name/otter/default.nix +++ b/plugins/by-name/otter/default.nix @@ -1,6 +1,7 @@ { lib, config, + options, ... }: lib.nixvim.plugins.mkNeovimPlugin { @@ -89,10 +90,14 @@ lib.nixvim.plugins.mkNeovimPlugin { in !(treesitter.enable && highlightEnabled); - message = '' - You have enabled otter, but treesitter syntax highlighting is not enabled. - Otter functionality might not work as expected without it. Make sure `plugins.treesitter.highlight.enable` and `plugins.treesitter.enable` are enabled. - ''; + message = + let + inherit (options.plugins) treesitter; + in + '' + You have enabled otter, but treesitter syntax highlighting is not enabled. + Otter functionality might not work as expected without it. Make sure `${treesitter.highlight.enable}` and `${treesitter.enable}` are enabled. + ''; }; lsp.onAttach = lib.mkIf cfg.autoActivate '' diff --git a/tests/test-sources/plugins/by-name/otter/default.nix b/tests/test-sources/plugins/by-name/otter/default.nix index 040ee57a..e4eb4a98 100644 --- a/tests/test-sources/plugins/by-name/otter/default.nix +++ b/tests/test-sources/plugins/by-name/otter/default.nix @@ -67,6 +67,7 @@ test.warnings = expect: [ (expect "count" 1) (expect "any" "You have enabled otter, but treesitter syntax highlighting is not enabled.") + (expect "any" "Make sure `plugins.treesitter.highlight.enable` and `plugins.treesitter.enable` are enabled.") ]; plugins = { otter.enable = true; @@ -79,6 +80,7 @@ test.warnings = expect: [ (expect "count" 1) (expect "any" "You have enabled otter, but treesitter syntax highlighting is not enabled.") + (expect "any" "Make sure `plugins.treesitter.highlight.enable` and `plugins.treesitter.enable` are enabled.") ]; plugins = { otter.enable = true;