mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-22 08:53:28 +02:00
plugins/completion: normalize plugin defaults
This commit is contained in:
parent
48f1e30bf7
commit
d61ecb3f73
5 changed files with 73 additions and 68 deletions
|
@ -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,7 +148,14 @@ with lib;
|
|||
Boolean to show the `~` expandable indicator in cmp's floating window.
|
||||
'';
|
||||
|
||||
fields = helpers.defaultNullOpts.mkListOf types.str ''["abbr" "kind" "menu"]'' ''
|
||||
fields =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
[
|
||||
"abbr"
|
||||
"kind"
|
||||
"menu"
|
||||
]
|
||||
''
|
||||
An array of completion fields to specify their order.
|
||||
'';
|
||||
|
||||
|
@ -234,12 +241,10 @@ with lib;
|
|||
view = {
|
||||
entries =
|
||||
helpers.defaultNullOpts.mkNullable (with types; either str (attrsOf anything))
|
||||
''
|
||||
{
|
||||
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";
|
||||
|
||||
|
|
|
@ -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" ''
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -65,14 +65,12 @@ helpers.vim-plugin.mkVimPlugin config {
|
|||
|
||||
filetypes =
|
||||
helpers.defaultNullOpts.mkAttrsOf types.bool
|
||||
''
|
||||
{
|
||||
help = false;
|
||||
gitcommit = false;
|
||||
gitrebase = false;
|
||||
"." = false;
|
||||
}
|
||||
''
|
||||
''
|
||||
A dictionary mapping whether codeium should be enabled or disabled in certain filetypes.
|
||||
This can be used to opt out of completions for certain filetypes.
|
||||
|
|
|
@ -40,19 +40,18 @@ in
|
|||
|
||||
layout = {
|
||||
position =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||
[
|
||||
"bottom"
|
||||
"top"
|
||||
"left"
|
||||
"right"
|
||||
]
|
||||
"bottom"
|
||||
''
|
||||
The panel position.
|
||||
'';
|
||||
|
||||
ratio = helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0 1.0) "0.4" ''
|
||||
ratio = helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0 1.0) 0.4 ''
|
||||
The panel ratio.
|
||||
'';
|
||||
};
|
||||
|
@ -68,9 +67,9 @@ in
|
|||
keymap = {
|
||||
accept = keymapOption "<M-l>" "Keymap for accepting the suggestion.";
|
||||
|
||||
acceptWord = keymapOption "false" "Keymap for accepting a word suggestion.";
|
||||
acceptWord = keymapOption false "Keymap for accepting a word suggestion.";
|
||||
|
||||
acceptLine = keymapOption "false" "Keymap for accepting a line suggestion.";
|
||||
acceptLine = keymapOption false "Keymap for accepting a line suggestion.";
|
||||
|
||||
next = keymapOption "<M-]>" "Keymap for accepting the next suggestion.";
|
||||
|
||||
|
@ -81,8 +80,7 @@ in
|
|||
};
|
||||
|
||||
filetypes =
|
||||
helpers.defaultNullOpts.mkNullable (with types; attrsOf (either bool helpers.nixvimTypes.rawLua))
|
||||
''
|
||||
helpers.defaultNullOpts.mkAttrsOf types.bool
|
||||
{
|
||||
yaml = false;
|
||||
markdown = false;
|
||||
|
@ -94,7 +92,6 @@ in
|
|||
cvs = false;
|
||||
"." = false;
|
||||
}
|
||||
''
|
||||
''
|
||||
Specify filetypes for attaching copilot.
|
||||
Each value can be either a boolean or a lua function that returns a boolean.
|
||||
|
@ -137,7 +134,10 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
serverOptsOverrides = helpers.defaultNullOpts.mkNullable types.attrs "{}" ''
|
||||
serverOptsOverrides = helpers.defaultNullOpts.mkAttrsOf' {
|
||||
type = types.anything;
|
||||
pluginDefault = { };
|
||||
description = ''
|
||||
Override copilot lsp client `settings`.
|
||||
The settings field is where you can set the values of the options defined in
|
||||
https://github.com/zbirenbaum/copilot.lua/blob/master/SettingsOpts.md.
|
||||
|
@ -147,10 +147,8 @@ in
|
|||
numerous checks to verify copilot is actually running.
|
||||
|
||||
See `:h vim.lsp.start_client` for list of options.
|
||||
|
||||
Example:
|
||||
```nix
|
||||
{
|
||||
'';
|
||||
example = {
|
||||
trace = "verbose";
|
||||
settings = {
|
||||
advanced = {
|
||||
|
@ -158,9 +156,8 @@ in
|
|||
inlineSuggestCount = 3; # number of completions for getCompletions
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue