2024-01-22 14:00:24 +01:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}:
|
2024-05-05 19:39:35 +02:00
|
|
|
let
|
2024-10-06 09:57:31 -05:00
|
|
|
inherit (lib) mkRenamedOptionModule types;
|
2024-10-06 10:05:31 -05:00
|
|
|
inherit (lib.nixvim) defaultNullOpts;
|
|
|
|
|
2024-01-22 14:00:24 +01:00
|
|
|
cfg = config.plugins.cmp-tabby;
|
2024-05-05 19:39:35 +02:00
|
|
|
in
|
|
|
|
{
|
2024-10-06 09:57:31 -05:00
|
|
|
meta.maintainers = [ lib.maintainers.GaetanLepage ];
|
2024-01-22 14:00:24 +01:00
|
|
|
|
2024-06-18 16:40:46 +02:00
|
|
|
# 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" ]))
|
|
|
|
];
|
2024-01-22 14:00:24 +01:00
|
|
|
|
2024-06-18 16:40:46 +02:00
|
|
|
options.plugins.cmp-tabby = {
|
2024-10-06 10:05:31 -05:00
|
|
|
settings = lib.nixvim.mkSettingsOption {
|
2024-06-18 16:40:46 +02:00
|
|
|
description = "Options provided to the `require('cmp_ai.config'):setup` function.";
|
2024-01-22 14:00:24 +01:00
|
|
|
|
2024-06-18 16:40:46 +02:00
|
|
|
options = {
|
2024-10-06 10:05:31 -05:00
|
|
|
host = defaultNullOpts.mkStr "http://localhost:5000" ''
|
2024-06-18 16:40:46 +02:00
|
|
|
The address of the tabby host server.
|
|
|
|
'';
|
|
|
|
|
2024-10-06 10:05:31 -05:00
|
|
|
max_lines = defaultNullOpts.mkUnsignedInt 100 ''
|
2024-06-18 16:40:46 +02:00
|
|
|
The max number of lines to complete.
|
|
|
|
'';
|
2024-01-22 14:00:24 +01:00
|
|
|
|
2024-10-06 10:05:31 -05:00
|
|
|
run_on_every_keystroke = defaultNullOpts.mkBool true ''
|
2024-06-18 16:40:46 +02:00
|
|
|
Whether to run the completion on every keystroke.
|
|
|
|
'';
|
|
|
|
|
2024-10-06 10:05:31 -05:00
|
|
|
stop = defaultNullOpts.mkListOf types.str [ "\n" ] ''
|
2024-06-18 16:40:46 +02:00
|
|
|
Stop character.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
example = {
|
|
|
|
host = "http://localhost:5000";
|
|
|
|
max_lines = 100;
|
|
|
|
run_on_every_keystroke = true;
|
|
|
|
stop = [ "\n" ];
|
|
|
|
};
|
|
|
|
};
|
2024-05-05 19:39:35 +02:00
|
|
|
};
|
2024-01-22 14:00:24 +01:00
|
|
|
|
2024-10-06 09:57:31 -05:00
|
|
|
config = lib.mkIf cfg.enable {
|
2024-06-18 16:40:46 +02:00
|
|
|
extraConfigLua = ''
|
2024-10-06 10:05:31 -05:00
|
|
|
require('cmp_tabby.config'):setup(${lib.nixvim.toLuaObject cfg.settings})
|
2024-06-18 16:40:46 +02:00
|
|
|
'';
|
2024-01-22 14:00:24 +01:00
|
|
|
};
|
|
|
|
}
|