diff --git a/plugins/by-name/cmp-tabby/default.nix b/plugins/by-name/cmp-tabby/default.nix new file mode 100644 index 00000000..215d7fe6 --- /dev/null +++ b/plugins/by-name/cmp-tabby/default.nix @@ -0,0 +1,50 @@ +{ lib, ... }: +let + inherit (lib) types; + inherit (lib.nixvim) defaultNullOpts; +in +lib.nixvim.neovim-plugin.mkNeovimPlugin { + name = "cmp-tabby"; + + maintainers = [ lib.maintainers.GaetanLepage ]; + + imports = [ + { cmpSourcePlugins.cmp_tabby = "cmp-tabby"; } + ]; + + deprecateExtraOptions = true; + optionsRenamedToSettings = [ + "host" + "maxLines" + "runOnEveryKeyStroke" + "stop" + ]; + + moduleName = "cmp_tabby.config"; + setup = ":setup"; + + settingsOptions = { + host = defaultNullOpts.mkStr "http://localhost:5000" '' + The address of the tabby host server. + ''; + + max_lines = defaultNullOpts.mkUnsignedInt 100 '' + The max number of lines to complete. + ''; + + run_on_every_keystroke = defaultNullOpts.mkBool true '' + Whether to run the completion on every keystroke. + ''; + + stop = defaultNullOpts.mkListOf types.str [ "\n" ] '' + Stop character. + ''; + }; + + settingsExample = { + host = "http://localhost:5000"; + max_lines = 100; + run_on_every_keystroke = true; + stop = [ "\n" ]; + }; +} diff --git a/plugins/cmp/sources/cmp-tabby.nix b/plugins/cmp/sources/cmp-tabby.nix deleted file mode 100644 index d780aa65..00000000 --- a/plugins/cmp/sources/cmp-tabby.nix +++ /dev/null @@ -1,70 +0,0 @@ -{ - lib, - config, - ... -}: -let - inherit (lib) mkRenamedOptionModule types; - inherit (lib.nixvim) defaultNullOpts; - - cfg = config.plugins.cmp-tabby; -in -{ - meta.maintainers = [ lib.maintainers.GaetanLepage ]; - - # TODO: introduced 24-06-18, remove after 24.11 - imports = - let - basePluginPath = [ - "plugins" - "cmp-tabby" - ]; - settingsPath = basePluginPath ++ [ "settings" ]; - in - [ - (mkRenamedOptionModule (basePluginPath ++ [ "extraOptions" ]) settingsPath) - (mkRenamedOptionModule (basePluginPath ++ [ "host" ]) (settingsPath ++ [ "host" ])) - (mkRenamedOptionModule (basePluginPath ++ [ "maxLines" ]) (settingsPath ++ [ "max_lines" ])) - (mkRenamedOptionModule (basePluginPath ++ [ "runOnEveryKeyStroke" ]) ( - settingsPath ++ [ "run_on_every_keystroke" ] - )) - (mkRenamedOptionModule (basePluginPath ++ [ "stop" ]) (settingsPath ++ [ "stop" ])) - ]; - - options.plugins.cmp-tabby = { - settings = lib.nixvim.mkSettingsOption { - description = "Options provided to the `require('cmp_ai.config'):setup` function."; - - options = { - host = defaultNullOpts.mkStr "http://localhost:5000" '' - The address of the tabby host server. - ''; - - max_lines = defaultNullOpts.mkUnsignedInt 100 '' - The max number of lines to complete. - ''; - - run_on_every_keystroke = defaultNullOpts.mkBool true '' - Whether to run the completion on every keystroke. - ''; - - stop = defaultNullOpts.mkListOf types.str [ "\n" ] '' - Stop character. - ''; - }; - - example = { - host = "http://localhost:5000"; - max_lines = 100; - run_on_every_keystroke = true; - stop = [ "\n" ]; - }; - }; - }; - - config = lib.mkIf cfg.enable { - extraConfigLua = '' - require('cmp_tabby.config'):setup(${lib.nixvim.toLuaObject cfg.settings}) - ''; - }; -} diff --git a/plugins/cmp/sources/default.nix b/plugins/cmp/sources/default.nix index 43f8cfe7..5f6654a5 100644 --- a/plugins/cmp/sources/default.nix +++ b/plugins/cmp/sources/default.nix @@ -5,6 +5,7 @@ ... }@args: let + # A list of most cmp source plugins, passed to mkCmpSourcePlugin. # More complex cmp sources can instead be defined as their own plugin # and register their source-name association using the `cmpSourcePlugins` option. @@ -145,10 +146,6 @@ let pluginName = "cmp-spell"; sourceName = "spell"; } - { - pluginName = "cmp-tabby"; - sourceName = "cmp_tabby"; - } { pluginName = "cmp-tabnine"; sourceName = "cmp_tabnine"; @@ -205,7 +202,6 @@ in ./cmp-ai.nix ./cmp-fish.nix ./cmp-git.nix - ./cmp-tabby.nix ./cmp-tabnine.nix ./crates-nvim.nix ] ++ pluginModules; diff --git a/tests/test-sources/plugins/cmp/cmp-tabby.nix b/tests/test-sources/plugins/by-name/cmp-tabby/default.nix similarity index 100% rename from tests/test-sources/plugins/cmp/cmp-tabby.nix rename to tests/test-sources/plugins/by-name/cmp-tabby/default.nix