diff --git a/plugins/neotest/adapters.nix b/plugins/neotest/adapters.nix index 99ee08ed..92b53dff 100644 --- a/plugins/neotest/adapters.nix +++ b/plugins/neotest/adapters.nix @@ -33,11 +33,13 @@ with lib; let You might want to set `plugins.treesitter.enable = true` and ensure that the `${props.treesitter-parser}` parser is enabled. ''; - plugins.neotest.enabledAdapters = [ - { - inherit name; - inherit (cfg) settings; - } + plugins.neotest.settings.adapters = let + settingsString = + optionalString + (cfg.settings != {}) + "(${helpers.toLuaObject cfg.settings})"; + in [ + "require('neotest-${name}')${settingsString}" ]; }; }; diff --git a/plugins/neotest/default.nix b/plugins/neotest/default.nix index 8f1522db..33719d34 100644 --- a/plugins/neotest/default.nix +++ b/plugins/neotest/default.nix @@ -16,34 +16,18 @@ with lib; ./adapters.nix ]; - extraOptions = { - enabledAdapters = mkOption { - type = with types; - listOf - (submodule { - options = { - name = mkOption { - type = types.str; - }; - settings = mkOption { - type = with types; attrsOf anything; - }; - }; - }); - internal = true; - visible = false; - default = []; - }; - }; - settingsOptions = (import ./options.nix {inherit lib helpers;}) // { adapters = mkOption { type = with helpers.nixvimTypes; listOf strLua; default = []; - internal = true; apply = map helpers.mkRaw; + # NOTE: We hide this option from the documentation as users should use the top-level + # `adapters` option. + # They can still directly append raw lua code to this `settings.adapters` option. + # In this case, they are responsible for explicitly installing the manually added adapters. + visible = false; }; }; @@ -58,18 +42,4 @@ with lib; open = "botright split | resize 15"; }; }; - - extraConfig = cfg: { - plugins.neotest.settings.adapters = - map - ( - adapter: let - settingsString = - optionalString - (adapter.settings != {}) - "(${helpers.toLuaObject adapter.settings})"; - in "require('neotest-${adapter.name}')${settingsString}" - ) - cfg.enabledAdapters; - }; }