mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-13 10:44:34 +02:00
plugins/cmp-tabby: switch to RFC-42 style
This commit is contained in:
parent
bf109a3e59
commit
9ed3538685
2 changed files with 51 additions and 29 deletions
|
@ -11,37 +11,59 @@ in
|
||||||
{
|
{
|
||||||
meta.maintainers = [ maintainers.GaetanLepage ];
|
meta.maintainers = [ maintainers.GaetanLepage ];
|
||||||
|
|
||||||
options.plugins.cmp-tabby = helpers.neovim-plugin.extraOptionsOptions // {
|
# TODO: introduced 24-06-18, remove after 24.11
|
||||||
host = helpers.defaultNullOpts.mkStr "http://localhost:5000" ''
|
imports =
|
||||||
The address of the tabby host server.
|
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" ]))
|
||||||
|
];
|
||||||
|
|
||||||
maxLines = helpers.defaultNullOpts.mkUnsignedInt 100 ''
|
options.plugins.cmp-tabby = {
|
||||||
The max number of lines to complete.
|
settings = helpers.mkSettingsOption {
|
||||||
'';
|
description = "Options provided to the `require('cmp_ai.config'):setup` function.";
|
||||||
|
|
||||||
runOnEveryKeyStroke = helpers.defaultNullOpts.mkBool true ''
|
options = {
|
||||||
Whether to run the completion on every keystroke.
|
host = helpers.defaultNullOpts.mkStr "http://localhost:5000" ''
|
||||||
'';
|
The address of the tabby host server.
|
||||||
|
'';
|
||||||
|
|
||||||
stop = helpers.defaultNullOpts.mkListOf types.str ''["\n"]'' "";
|
max_lines = helpers.defaultNullOpts.mkUnsignedInt 100 ''
|
||||||
|
The max number of lines to complete.
|
||||||
|
'';
|
||||||
|
|
||||||
|
run_on_every_keystroke = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Whether to run the completion on every keystroke.
|
||||||
|
'';
|
||||||
|
|
||||||
|
stop = helpers.defaultNullOpts.mkListOf types.str [ "\n" ] ''
|
||||||
|
Stop character.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
example = {
|
||||||
|
host = "http://localhost:5000";
|
||||||
|
max_lines = 100;
|
||||||
|
run_on_every_keystroke = true;
|
||||||
|
stop = [ "\n" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
extraConfigLua =
|
extraConfigLua = ''
|
||||||
let
|
require('cmp_tabby.config'):setup(${helpers.toLuaObject cfg.settings})
|
||||||
setupOptions =
|
'';
|
||||||
with cfg;
|
|
||||||
{
|
|
||||||
inherit host;
|
|
||||||
max_lines = maxLines;
|
|
||||||
run_on_every_keystroke = runOnEveryKeyStroke;
|
|
||||||
inherit stop;
|
|
||||||
}
|
|
||||||
// cfg.extraOptions;
|
|
||||||
in
|
|
||||||
''
|
|
||||||
require('cmp_tabby.config'):setup(${helpers.toLuaObject setupOptions})
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
settings.sources = [ { name = "cmp_tabby"; } ];
|
settings.sources = [ { name = "cmp_tabby"; } ];
|
||||||
};
|
};
|
||||||
cmp-tabby = {
|
cmp-tabby.settings = {
|
||||||
host = "http://localhost:5000";
|
host = "http://localhost:5000";
|
||||||
maxLines = 100;
|
max_lines = 100;
|
||||||
runOnEveryKeyStroke = true;
|
run_on_every_keystroke = true;
|
||||||
stop = [ "\n" ];
|
stop = [ "\n" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue