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 =
|
autocomplete =
|
||||||
helpers.defaultNullOpts.mkNullable
|
helpers.defaultNullOpts.mkNullable
|
||||||
(with helpers.nixvimTypes; either (enum [ false ]) (listOf strLua))
|
(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.
|
The event to trigger autocompletion.
|
||||||
If set to `false`, then completion is only invoked manually (e.g. by calling `cmp.complete`).
|
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.
|
Boolean to show the `~` expandable indicator in cmp's floating window.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
fields = helpers.defaultNullOpts.mkListOf types.str ''["abbr" "kind" "menu"]'' ''
|
fields =
|
||||||
An array of completion fields to specify their order.
|
helpers.defaultNullOpts.mkListOf types.str
|
||||||
'';
|
[
|
||||||
|
"abbr"
|
||||||
|
"kind"
|
||||||
|
"menu"
|
||||||
|
]
|
||||||
|
''
|
||||||
|
An array of completion fields to specify their order.
|
||||||
|
'';
|
||||||
|
|
||||||
format =
|
format =
|
||||||
helpers.defaultNullOpts.mkLuaFn
|
helpers.defaultNullOpts.mkLuaFn
|
||||||
|
@ -234,12 +241,10 @@ with lib;
|
||||||
view = {
|
view = {
|
||||||
entries =
|
entries =
|
||||||
helpers.defaultNullOpts.mkNullable (with types; either str (attrsOf anything))
|
helpers.defaultNullOpts.mkNullable (with types; either str (attrsOf anything))
|
||||||
''
|
{
|
||||||
{
|
name = "custom";
|
||||||
name = "custom";
|
selection_order = "top_down";
|
||||||
selection_order = "top_down";
|
}
|
||||||
}
|
|
||||||
''
|
|
||||||
''
|
''
|
||||||
The view class used to customize nvim-cmp's appearance.
|
The view class used to customize nvim-cmp's appearance.
|
||||||
'';
|
'';
|
||||||
|
@ -267,9 +272,7 @@ with lib;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
completion = {
|
completion = {
|
||||||
border =
|
border = helpers.defaultNullOpts.mkBorder (genList (_: "") 8) "nvim-cmp completion popup menu" "";
|
||||||
helpers.defaultNullOpts.mkBorder ''[ "" "" "" "" "" "" "" "" ]'' "nvim-cmp completion popup menu"
|
|
||||||
"";
|
|
||||||
|
|
||||||
winhighlight = mkWinhighlightOption "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None";
|
winhighlight = mkWinhighlightOption "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None";
|
||||||
|
|
||||||
|
@ -294,10 +297,9 @@ with lib;
|
||||||
};
|
};
|
||||||
|
|
||||||
documentation = {
|
documentation = {
|
||||||
border =
|
border = helpers.defaultNullOpts.mkBorder (genList (
|
||||||
helpers.defaultNullOpts.mkBorder ''[ "" "" "" " " "" "" "" " " ]''
|
_: ""
|
||||||
"nvim-cmp documentation popup menu"
|
) 8) "nvim-cmp documentation popup menu" "";
|
||||||
"";
|
|
||||||
|
|
||||||
winhighlight = mkWinhighlightOption "FloatBorder:NormalFloat";
|
winhighlight = mkWinhighlightOption "FloatBorder:NormalFloat";
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,13 @@ in
|
||||||
options.plugins.codeium-nvim = helpers.neovim-plugin.extraOptionsOptions // {
|
options.plugins.codeium-nvim = helpers.neovim-plugin.extraOptionsOptions // {
|
||||||
package = helpers.mkPluginPackageOption "codeium.nvim" pkgs.vimPlugins.codeium-nvim;
|
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 = {
|
api = {
|
||||||
host = helpers.defaultNullOpts.mkStr "server.codeium.com" ''
|
host = helpers.defaultNullOpts.mkStr "server.codeium.com" ''
|
||||||
|
|
|
@ -12,7 +12,11 @@ in
|
||||||
{
|
{
|
||||||
options.plugins.copilot-cmp = helpers.neovim-plugin.extraOptionsOptions // {
|
options.plugins.copilot-cmp = helpers.neovim-plugin.extraOptionsOptions // {
|
||||||
event =
|
event =
|
||||||
helpers.defaultNullOpts.mkNullable (with types; listOf str) ''["InsertEnter" "LspAttach"]''
|
helpers.defaultNullOpts.mkListOf types.str
|
||||||
|
[
|
||||||
|
"InsertEnter"
|
||||||
|
"LspAttach"
|
||||||
|
]
|
||||||
''
|
''
|
||||||
Configures when the source is registered.
|
Configures when the source is registered.
|
||||||
Unless you have a unique problem for your particular configuration you probably don't want
|
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 =
|
filetypes =
|
||||||
helpers.defaultNullOpts.mkAttrsOf types.bool
|
helpers.defaultNullOpts.mkAttrsOf types.bool
|
||||||
''
|
{
|
||||||
{
|
help = false;
|
||||||
help = false;
|
gitcommit = false;
|
||||||
gitcommit = false;
|
gitrebase = false;
|
||||||
gitrebase = false;
|
"." = false;
|
||||||
"." = false;
|
}
|
||||||
}
|
|
||||||
''
|
|
||||||
''
|
''
|
||||||
A dictionary mapping whether codeium should be enabled or disabled in certain filetypes.
|
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.
|
This can be used to opt out of completions for certain filetypes.
|
||||||
|
|
|
@ -40,19 +40,18 @@ in
|
||||||
|
|
||||||
layout = {
|
layout = {
|
||||||
position =
|
position =
|
||||||
helpers.defaultNullOpts.mkEnum
|
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||||
[
|
[
|
||||||
"bottom"
|
"bottom"
|
||||||
"top"
|
"top"
|
||||||
"left"
|
"left"
|
||||||
"right"
|
"right"
|
||||||
]
|
]
|
||||||
"bottom"
|
|
||||||
''
|
''
|
||||||
The panel position.
|
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.
|
The panel ratio.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
@ -68,9 +67,9 @@ in
|
||||||
keymap = {
|
keymap = {
|
||||||
accept = keymapOption "<M-l>" "Keymap for accepting the suggestion.";
|
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.";
|
next = keymapOption "<M-]>" "Keymap for accepting the next suggestion.";
|
||||||
|
|
||||||
|
@ -81,20 +80,18 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
filetypes =
|
filetypes =
|
||||||
helpers.defaultNullOpts.mkNullable (with types; attrsOf (either bool helpers.nixvimTypes.rawLua))
|
helpers.defaultNullOpts.mkAttrsOf types.bool
|
||||||
''
|
{
|
||||||
{
|
yaml = false;
|
||||||
yaml = false;
|
markdown = false;
|
||||||
markdown = false;
|
help = false;
|
||||||
help = false;
|
gitcommit = false;
|
||||||
gitcommit = false;
|
gitrebase = false;
|
||||||
gitrebase = false;
|
hgcommit = false;
|
||||||
hgcommit = false;
|
svn = false;
|
||||||
svn = false;
|
cvs = false;
|
||||||
cvs = false;
|
"." = false;
|
||||||
"." = false;
|
}
|
||||||
}
|
|
||||||
''
|
|
||||||
''
|
''
|
||||||
Specify filetypes for attaching copilot.
|
Specify filetypes for attaching copilot.
|
||||||
Each value can be either a boolean or a lua function that returns a boolean.
|
Each value can be either a boolean or a lua function that returns a boolean.
|
||||||
|
@ -137,30 +134,30 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
serverOptsOverrides = helpers.defaultNullOpts.mkNullable types.attrs "{}" ''
|
serverOptsOverrides = helpers.defaultNullOpts.mkAttrsOf' {
|
||||||
Override copilot lsp client `settings`.
|
type = types.anything;
|
||||||
The settings field is where you can set the values of the options defined in
|
pluginDefault = { };
|
||||||
https://github.com/zbirenbaum/copilot.lua/blob/master/SettingsOpts.md.
|
description = ''
|
||||||
These options are specific to the copilot lsp and can be used to customize its behavior.
|
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.
|
||||||
|
These options are specific to the copilot lsp and can be used to customize its behavior.
|
||||||
|
|
||||||
Ensure that the `name` field is not overridden as is is used for efficiency reasons in
|
Ensure that the `name` field is not overridden as is is used for efficiency reasons in
|
||||||
numerous checks to verify copilot is actually running.
|
numerous checks to verify copilot is actually running.
|
||||||
|
|
||||||
See `:h vim.lsp.start_client` for list of options.
|
See `:h vim.lsp.start_client` for list of options.
|
||||||
|
'';
|
||||||
Example:
|
example = {
|
||||||
```nix
|
trace = "verbose";
|
||||||
{
|
settings = {
|
||||||
trace = "verbose";
|
advanced = {
|
||||||
settings = {
|
listCount = 10; # number of completions for panel
|
||||||
advanced = {
|
inlineSuggestCount = 3; # number of completions for getCompletions
|
||||||
listCount = 10; # number of completions for panel
|
|
||||||
inlineSuggestCount = 3; # number of completions for getCompletions
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
```
|
};
|
||||||
'';
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue