plugins/completion: normalize plugin defaults

This commit is contained in:
Matt Sturgeon 2024-06-11 16:51:18 +01:00
parent 48f1e30bf7
commit d61ecb3f73
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
5 changed files with 73 additions and 68 deletions

View file

@ -117,7 +117,7 @@ with lib;
autocomplete =
helpers.defaultNullOpts.mkNullable
(with helpers.nixvimTypes; either (enum [ false ]) (listOf strLua))
''["require('cmp.types').cmp.TriggerEvent.TextChanged"]''
[ "require('cmp.types').cmp.TriggerEvent.TextChanged" ]
''
The event to trigger autocompletion.
If set to `false`, then completion is only invoked manually (e.g. by calling `cmp.complete`).
@ -148,9 +148,16 @@ with lib;
Boolean to show the `~` expandable indicator in cmp's floating window.
'';
fields = helpers.defaultNullOpts.mkListOf types.str ''["abbr" "kind" "menu"]'' ''
An array of completion fields to specify their order.
'';
fields =
helpers.defaultNullOpts.mkListOf types.str
[
"abbr"
"kind"
"menu"
]
''
An array of completion fields to specify their order.
'';
format =
helpers.defaultNullOpts.mkLuaFn
@ -234,12 +241,10 @@ with lib;
view = {
entries =
helpers.defaultNullOpts.mkNullable (with types; either str (attrsOf anything))
''
{
name = "custom";
selection_order = "top_down";
}
''
{
name = "custom";
selection_order = "top_down";
}
''
The view class used to customize nvim-cmp's appearance.
'';
@ -267,9 +272,7 @@ with lib;
in
{
completion = {
border =
helpers.defaultNullOpts.mkBorder ''[ "" "" "" "" "" "" "" "" ]'' "nvim-cmp completion popup menu"
"";
border = helpers.defaultNullOpts.mkBorder (genList (_: "") 8) "nvim-cmp completion popup menu" "";
winhighlight = mkWinhighlightOption "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None";
@ -294,10 +297,9 @@ with lib;
};
documentation = {
border =
helpers.defaultNullOpts.mkBorder ''[ "" "" "" " " "" "" "" " " ]''
"nvim-cmp documentation popup menu"
"";
border = helpers.defaultNullOpts.mkBorder (genList (
_: ""
) 8) "nvim-cmp documentation popup menu" "";
winhighlight = mkWinhighlightOption "FloatBorder:NormalFloat";

View file

@ -15,9 +15,13 @@ in
options.plugins.codeium-nvim = helpers.neovim-plugin.extraOptionsOptions // {
package = helpers.mkPluginPackageOption "codeium.nvim" pkgs.vimPlugins.codeium-nvim;
configPath = helpers.defaultNullOpts.mkStr ''{__raw = "vim.fn.stdpath('cache') .. '/codeium/config.json'";}'' "The path to the config file, used to store the API key.";
configPath = helpers.defaultNullOpts.mkStr {
__raw = "vim.fn.stdpath('cache') .. '/codeium/config.json'";
} "The path to the config file, used to store the API key.";
binPath = helpers.defaultNullOpts.mkStr ''{__raw = "vim.fn.stdpath('cache') .. '/codeium/bin'";}'' "The path to the directory where the Codeium server will be downloaded to.";
binPath = helpers.defaultNullOpts.mkStr {
__raw = "vim.fn.stdpath('cache') .. '/codeium/bin'";
} "The path to the directory where the Codeium server will be downloaded to.";
api = {
host = helpers.defaultNullOpts.mkStr "server.codeium.com" ''

View file

@ -12,7 +12,11 @@ in
{
options.plugins.copilot-cmp = helpers.neovim-plugin.extraOptionsOptions // {
event =
helpers.defaultNullOpts.mkNullable (with types; listOf str) ''["InsertEnter" "LspAttach"]''
helpers.defaultNullOpts.mkListOf types.str
[
"InsertEnter"
"LspAttach"
]
''
Configures when the source is registered.
Unless you have a unique problem for your particular configuration you probably don't want