plugins/cmp: remove helpers

This commit is contained in:
Austin Horstman 2024-10-06 10:05:31 -05:00
parent 62b87e5b56
commit 08cac4a5c0
No known key found for this signature in database
12 changed files with 113 additions and 112 deletions

View file

@ -6,6 +6,7 @@
}: }:
let let
inherit (lib.nixvim) defaultNullOpts; inherit (lib.nixvim) defaultNullOpts;
telescopeHelpers = import ./_helpers.nix { inherit lib config pkgs; }; telescopeHelpers = import ./_helpers.nix { inherit lib config pkgs; };
in in
telescopeHelpers.mkExtension { telescopeHelpers.mkExtension {

View file

@ -1,12 +1,13 @@
{ {
lib, lib,
helpers,
... ...
}: }:
let let
cmpOptions = import ./options { inherit lib helpers; }; inherit (lib.nixvim) toLuaObject;
cmpOptions = import ./options { inherit lib; };
in in
helpers.neovim-plugin.mkNeovimPlugin { lib.nixvim.neovim-plugin.mkNeovimPlugin {
name = "cmp"; name = "cmp";
originalName = "nvim-cmp"; originalName = "nvim-cmp";
package = "nvim-cmp"; package = "nvim-cmp";
@ -72,17 +73,17 @@ helpers.neovim-plugin.mkNeovimPlugin {
plugins.cmp.luaConfig.content = plugins.cmp.luaConfig.content =
'' ''
local cmp = require('cmp') local cmp = require('cmp')
cmp.setup(${helpers.toLuaObject cfg.settings}) cmp.setup(${toLuaObject cfg.settings})
'' ''
+ (lib.concatStringsSep "\n" ( + (lib.concatStringsSep "\n" (
lib.mapAttrsToList ( lib.mapAttrsToList (
filetype: settings: "cmp.setup.filetype('${filetype}', ${helpers.toLuaObject settings})\n" filetype: settings: "cmp.setup.filetype('${filetype}', ${toLuaObject settings})\n"
) cfg.filetype ) cfg.filetype
)) ))
+ (lib.concatStringsSep "\n" ( + (lib.concatStringsSep "\n" (
lib.mapAttrsToList ( lib.mapAttrsToList (
cmdtype: settings: "cmp.setup.cmdline('${cmdtype}', ${helpers.toLuaObject settings})\n" cmdtype: settings: "cmp.setup.cmdline('${cmdtype}', ${toLuaObject settings})\n"
) cfg.cmdline ) cfg.cmdline
)); ));
}; };

View file

@ -1,6 +1,6 @@
{ lib, helpers }: { lib }:
rec { rec {
settingsOptions = import ./settings-options.nix { inherit lib helpers; }; settingsOptions = import ./settings-options.nix { inherit lib; };
settingsExample = { settingsExample = {
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end"; snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";

View file

@ -1,39 +1,40 @@
{ lib, helpers }: { lib }:
let let
inherit (lib) mkOption types; inherit (lib) mkOption types;
inherit (lib.nixvim) defaultNullOpts;
in in
{ {
performance = { performance = {
debounce = helpers.defaultNullOpts.mkUnsignedInt 60 '' debounce = defaultNullOpts.mkUnsignedInt 60 ''
Sets debounce time. Sets debounce time.
This is the interval used to group up completions from different sources for filtering and This is the interval used to group up completions from different sources for filtering and
displaying. displaying.
''; '';
throttle = helpers.defaultNullOpts.mkUnsignedInt 30 '' throttle = defaultNullOpts.mkUnsignedInt 30 ''
Sets throttle time. Sets throttle time.
This is used to delay filtering and displaying completions. This is used to delay filtering and displaying completions.
''; '';
fetching_timeout = helpers.defaultNullOpts.mkUnsignedInt 500 '' fetching_timeout = defaultNullOpts.mkUnsignedInt 500 ''
Sets the timeout of candidate fetching process. Sets the timeout of candidate fetching process.
The nvim-cmp will wait to display the most prioritized source. The nvim-cmp will wait to display the most prioritized source.
''; '';
confirm_resolve_timeout = helpers.defaultNullOpts.mkUnsignedInt 80 '' confirm_resolve_timeout = defaultNullOpts.mkUnsignedInt 80 ''
Sets the timeout for resolving item before confirmation. Sets the timeout for resolving item before confirmation.
''; '';
async_budget = helpers.defaultNullOpts.mkUnsignedInt 1 '' async_budget = defaultNullOpts.mkUnsignedInt 1 ''
Maximum time (in ms) an async function is allowed to run during one step of the event loop. Maximum time (in ms) an async function is allowed to run during one step of the event loop.
''; '';
max_view_entries = helpers.defaultNullOpts.mkUnsignedInt 200 '' max_view_entries = defaultNullOpts.mkUnsignedInt 200 ''
Maximum number of items to show in the entries list. Maximum number of items to show in the entries list.
''; '';
}; };
preselect = helpers.defaultNullOpts.mkLua "cmp.PreselectMode.Item" '' preselect = defaultNullOpts.mkLua "cmp.PreselectMode.Item" ''
- "cmp.PreselectMode.Item": nvim-cmp will preselect the item that the source specified. - "cmp.PreselectMode.Item": nvim-cmp will preselect the item that the source specified.
- "cmp.PreselectMode.None": nvim-cmp will not preselect any items. - "cmp.PreselectMode.None": nvim-cmp will not preselect any items.
''; '';
@ -101,21 +102,21 @@ in
}; };
completion = { completion = {
keyword_length = helpers.defaultNullOpts.mkUnsignedInt 1 '' keyword_length = defaultNullOpts.mkUnsignedInt 1 ''
The number of characters needed to trigger auto-completion. The number of characters needed to trigger auto-completion.
''; '';
keyword_pattern = helpers.defaultNullOpts.mkLua ''[[\%(-\?\d\+\%(\.\d\+\)\?\|\h\w*\%(-\w*\)*\)]]'' "The default keyword pattern."; keyword_pattern = defaultNullOpts.mkLua ''[[\%(-\?\d\+\%(\.\d\+\)\?\|\h\w*\%(-\w*\)*\)]]'' "The default keyword pattern.";
autocomplete = autocomplete =
helpers.defaultNullOpts.mkNullable (with lib.types; either (enum [ false ]) (listOf strLua)) defaultNullOpts.mkNullable (with lib.types; 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`).
''; '';
completeopt = helpers.defaultNullOpts.mkStr "menu,menuone,noselect" '' completeopt = defaultNullOpts.mkStr "menu,menuone,noselect" ''
Like vim's completeopt setting. Like vim's completeopt setting.
In general, you don't need to change this. In general, you don't need to change this.
''; '';
@ -123,7 +124,7 @@ in
confirmation = { confirmation = {
get_commit_characters = get_commit_characters =
helpers.defaultNullOpts.mkLuaFn defaultNullOpts.mkLuaFn
'' ''
function(commit_characters) function(commit_characters)
return commit_characters return commit_characters
@ -136,12 +137,12 @@ in
}; };
formatting = { formatting = {
expandable_indicator = helpers.defaultNullOpts.mkBool true '' expandable_indicator = defaultNullOpts.mkBool true ''
Boolean to show the `~` expandable indicator in cmp's floating window. Boolean to show the `~` expandable indicator in cmp's floating window.
''; '';
fields = fields =
helpers.defaultNullOpts.mkListOf types.str defaultNullOpts.mkListOf types.str
[ [
"abbr" "abbr"
"kind" "kind"
@ -152,7 +153,7 @@ in
''; '';
format = format =
helpers.defaultNullOpts.mkLuaFn defaultNullOpts.mkLuaFn
'' ''
function(_, vim_item) function(_, vim_item)
return vim_item return vim_item
@ -171,29 +172,29 @@ in
}; };
matching = { matching = {
disallow_fuzzy_matching = helpers.defaultNullOpts.mkBool false '' disallow_fuzzy_matching = defaultNullOpts.mkBool false ''
Whether to allow fuzzy matching. Whether to allow fuzzy matching.
''; '';
disallow_fullfuzzy_matching = helpers.defaultNullOpts.mkBool false '' disallow_fullfuzzy_matching = defaultNullOpts.mkBool false ''
Whether to allow full-fuzzy matching. Whether to allow full-fuzzy matching.
''; '';
disallow_partial_fuzzy_matching = helpers.defaultNullOpts.mkBool true '' disallow_partial_fuzzy_matching = defaultNullOpts.mkBool true ''
Whether to allow fuzzy matching without prefix matching. Whether to allow fuzzy matching without prefix matching.
''; '';
disallow_partial_matching = helpers.defaultNullOpts.mkBool false '' disallow_partial_matching = defaultNullOpts.mkBool false ''
Whether to allow partial matching. Whether to allow partial matching.
''; '';
disallow_prefix_unmatching = helpers.defaultNullOpts.mkBool false '' disallow_prefix_unmatching = defaultNullOpts.mkBool false ''
Whether to allow prefix unmatching. Whether to allow prefix unmatching.
''; '';
}; };
sorting = { sorting = {
priority_weight = helpers.defaultNullOpts.mkUnsignedInt 2 '' priority_weight = defaultNullOpts.mkUnsignedInt 2 ''
Each item's original priority (given by its corresponding source) will be increased by Each item's original priority (given by its corresponding source) will be increased by
`#sources - (source_index - 1)` and multiplied by `priority_weight`. `#sources - (source_index - 1)` and multiplied by `priority_weight`.
@ -227,11 +228,11 @@ in
}; };
}; };
sources = import ./sources-option.nix { inherit lib helpers; }; sources = import ./sources-option.nix { inherit lib; };
view = { view = {
entries = entries =
helpers.defaultNullOpts.mkNullable (with types; either str (attrsOf anything)) defaultNullOpts.mkNullable (with types; either str (attrsOf anything))
{ {
name = "custom"; name = "custom";
selection_order = "top_down"; selection_order = "top_down";
@ -241,7 +242,7 @@ in
''; '';
docs = { docs = {
auto_open = helpers.defaultNullOpts.mkBool true '' auto_open = defaultNullOpts.mkBool true ''
Specify whether to show the docs_view when selecting an item. Specify whether to show the docs_view when selecting an item.
''; '';
}; };
@ -251,60 +252,56 @@ in
let let
mkWinhighlightOption = mkWinhighlightOption =
default: default:
helpers.defaultNullOpts.mkStr default '' defaultNullOpts.mkStr default ''
Specify the window's winhighlight option. Specify the window's winhighlight option.
See `|nvim_open_win|`. See `|nvim_open_win|`.
''; '';
zindex = helpers.mkNullOrOption types.ints.unsigned '' zindex = lib.nixvim.mkNullOrOption types.ints.unsigned ''
The window's zindex. The window's zindex.
See `|nvim_open_win|`. See `|nvim_open_win|`.
''; '';
in in
{ {
completion = { completion = {
border = helpers.defaultNullOpts.mkBorder (lib.genList ( border = defaultNullOpts.mkBorder (lib.genList (_: "") 8) "nvim-cmp completion popup menu" "";
_: ""
) 8) "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";
inherit zindex; inherit zindex;
scrolloff = helpers.defaultNullOpts.mkUnsignedInt 0 '' scrolloff = defaultNullOpts.mkUnsignedInt 0 ''
Specify the window's scrolloff option. Specify the window's scrolloff option.
See |'scrolloff'|. See |'scrolloff'|.
''; '';
col_offset = helpers.defaultNullOpts.mkInt 0 '' col_offset = defaultNullOpts.mkInt 0 ''
Offsets the completion window relative to the cursor. Offsets the completion window relative to the cursor.
''; '';
side_padding = helpers.defaultNullOpts.mkUnsignedInt 1 '' side_padding = defaultNullOpts.mkUnsignedInt 1 ''
The amount of padding to add on the completion window's sides. The amount of padding to add on the completion window's sides.
''; '';
scrollbar = helpers.defaultNullOpts.mkBool true '' scrollbar = defaultNullOpts.mkBool true ''
Whether the scrollbar should be enabled if there are more items that fit. Whether the scrollbar should be enabled if there are more items that fit.
''; '';
}; };
documentation = { documentation = {
border = helpers.defaultNullOpts.mkBorder (lib.genList ( border = defaultNullOpts.mkBorder (lib.genList (_: "") 8) "nvim-cmp documentation popup menu" "";
_: ""
) 8) "nvim-cmp documentation popup menu" "";
winhighlight = mkWinhighlightOption "FloatBorder:NormalFloat"; winhighlight = mkWinhighlightOption "FloatBorder:NormalFloat";
inherit zindex; inherit zindex;
max_width = helpers.mkNullOrStrLuaOr types.ints.unsigned '' max_width = lib.nixvim.mkNullOrStrLuaOr types.ints.unsigned ''
The documentation window's max width. The documentation window's max width.
Default: "math.floor((40 * 2) * (vim.o.columns / (40 * 2 * 16 / 9)))" Default: "math.floor((40 * 2) * (vim.o.columns / (40 * 2 * 16 / 9)))"
''; '';
max_height = helpers.mkNullOrStrLuaOr types.ints.unsigned '' max_height = lib.nixvim.mkNullOrStrLuaOr types.ints.unsigned ''
The documentation window's max height. The documentation window's max height.
Default: "math.floor(40 * (40 / vim.o.lines))" Default: "math.floor(40 * (40 / vim.o.lines))"
@ -314,7 +311,7 @@ in
# This can be kept as types.attrs since experimental features are often removed or completely # This can be kept as types.attrs since experimental features are often removed or completely
# changed after a while # changed after a while
experimental = helpers.mkNullOrOption (with types; attrsOf anything) '' experimental = lib.nixvim.mkNullOrOption (with types; attrsOf anything) ''
Experimental features. Experimental features.
''; '';
} }

View file

@ -1,6 +1,7 @@
{ lib, helpers }: { lib }:
let let
inherit (lib) types; inherit (lib) types;
inherit (lib.nixvim) mkNullOrOption;
sourceType = types.submodule { sourceType = types.submodule {
freeformType = with types; attrsOf anything; freeformType = with types; attrsOf anything;
@ -11,29 +12,29 @@ let
example = "buffer"; example = "buffer";
}; };
option = helpers.mkNullOrOption (with types; attrsOf anything) '' option = mkNullOrOption (with types; attrsOf anything) ''
Any specific options defined by the source itself. Any specific options defined by the source itself.
If direct lua code is needed use `helpers.mkRaw`. If direct lua code is needed use `lib.nixvim.mkRaw`.
''; '';
keyword_length = helpers.mkNullOrOption types.ints.unsigned '' keyword_length = mkNullOrOption types.ints.unsigned ''
The source-specific keyword length to trigger auto completion. The source-specific keyword length to trigger auto completion.
''; '';
keyword_pattern = helpers.mkNullOrLua '' keyword_pattern = lib.nixvim.mkNullOrLua ''
The source-specific keyword pattern. The source-specific keyword pattern.
''; '';
trigger_characters = helpers.mkNullOrOption (with types; listOf str) '' trigger_characters = mkNullOrOption (with types; listOf str) ''
Trigger characters. Trigger characters.
''; '';
priority = helpers.mkNullOrOption types.ints.unsigned '' priority = mkNullOrOption types.ints.unsigned ''
The source-specific priority value. The source-specific priority value.
''; '';
group_index = helpers.mkNullOrOption types.ints.unsigned '' group_index = mkNullOrOption types.ints.unsigned ''
The source group index. The source group index.
For instance, you can set the `buffer`'s source `group_index` to a larger number For instance, you can set the `buffer`'s source `group_index` to a larger number
@ -53,7 +54,7 @@ let
``` ```
''; '';
entry_filter = helpers.mkNullOrLuaFn '' entry_filter = lib.nixvim.mkNullOrLuaFn ''
A source-specific entry filter, with the following function signature: A source-specific entry filter, with the following function signature:
`function(entry: cmp.Entry, ctx: cmp.Context): boolean` `function(entry: cmp.Entry, ctx: cmp.Context): boolean`

View file

@ -1,6 +1,5 @@
{ {
lib, lib,
helpers,
pkgs, pkgs,
... ...
}: }:
@ -15,7 +14,7 @@
imports ? [ ], imports ? [ ],
... ...
}@args: }@args:
helpers.vim-plugin.mkVimPlugin ( lib.nixvim.vim-plugin.mkVimPlugin (
builtins.removeAttrs args [ builtins.removeAttrs args [
"pluginName" "pluginName"
"sourceName" "sourceName"

View file

@ -1,45 +1,46 @@
{ {
lib, lib,
helpers,
config, config,
... ...
}: }:
let let
inherit (lib.nixvim) defaultNullOpts;
cfg = config.plugins.cmp-ai; cfg = config.plugins.cmp-ai;
in in
{ {
meta.maintainers = [ lib.maintainers.GaetanLepage ]; meta.maintainers = [ lib.maintainers.GaetanLepage ];
options.plugins.cmp-ai = { options.plugins.cmp-ai = {
settings = helpers.mkSettingsOption { settings = lib.nixvim.mkSettingsOption {
description = "Options provided to the `require('cmp_ai.config'):setup` function."; description = "Options provided to the `require('cmp_ai.config'):setup` function.";
options = { options = {
max_lines = helpers.defaultNullOpts.mkUnsignedInt 50 '' max_lines = defaultNullOpts.mkUnsignedInt 50 ''
How many lines of buffer context to use. How many lines of buffer context to use.
''; '';
run_on_every_keystroke = helpers.defaultNullOpts.mkBool true '' run_on_every_keystroke = defaultNullOpts.mkBool true ''
Generate new completion items on every keystroke. Generate new completion items on every keystroke.
''; '';
provider = helpers.defaultNullOpts.mkStr "HF" '' provider = defaultNullOpts.mkStr "HF" ''
Which AI provider to use. Which AI provider to use.
Check the [README](https://github.com/tzachar/cmp-ai/blob/main/README.md) to learn about Check the [README](https://github.com/tzachar/cmp-ai/blob/main/README.md) to learn about
available options. available options.
''; '';
provider_options = helpers.defaultNullOpts.mkAttrsOf lib.types.anything { } '' provider_options = defaultNullOpts.mkAttrsOf lib.types.anything { } ''
Options to forward to the provider. Options to forward to the provider.
''; '';
notify = helpers.defaultNullOpts.mkBool true '' notify = defaultNullOpts.mkBool true ''
As some completion sources can be quit slow, setting this to `true` will trigger a As some completion sources can be quit slow, setting this to `true` will trigger a
notification when a completion starts and ends using `vim.notify`. notification when a completion starts and ends using `vim.notify`.
''; '';
notify_callback = helpers.defaultNullOpts.mkLuaFn' { notify_callback = defaultNullOpts.mkLuaFn' {
description = '' description = ''
The default notify function uses `vim.notify`, but an override can be configured. The default notify function uses `vim.notify`, but an override can be configured.
''; '';
@ -58,7 +59,7 @@ in
''; '';
}; };
ignored_file_types = helpers.defaultNullOpts.mkAttrsOf' { ignored_file_types = defaultNullOpts.mkAttrsOf' {
type = lib.types.bool; type = lib.types.bool;
description = "Which filetypes to ignore."; description = "Which filetypes to ignore.";
pluginDefault = { }; pluginDefault = { };
@ -88,7 +89,7 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
extraConfigLua = '' extraConfigLua = ''
require('cmp_ai.config'):setup(${helpers.toLuaObject cfg.settings}) require('cmp_ai.config'):setup(${lib.nixvim.toLuaObject cfg.settings})
''; '';
}; };
} }

View file

@ -1,40 +1,41 @@
{ {
lib, lib,
helpers,
config, config,
... ...
}: }:
let let
inherit (lib) types; inherit (lib) types;
inherit (lib.nixvim) defaultNullOpts;
cfg = config.plugins.cmp-git; cfg = config.plugins.cmp-git;
mkAction = mkAction =
action: target: action: target:
helpers.defaultNullOpts.mkLuaFn "require('cmp_git.${action}').git.${target}" '' defaultNullOpts.mkLuaFn "require('cmp_git.${action}').git.${target}" ''
Function used to ${action} the ${lib.replaceStrings [ "_" ] [ " " ] target}. Function used to ${action} the ${lib.replaceStrings [ "_" ] [ " " ] target}.
''; '';
in in
{ {
options.plugins.cmp-git.settings = helpers.mkSettingsOption { options.plugins.cmp-git.settings = lib.nixvim.mkSettingsOption {
description = "Options provided to the `require('cmp_git').setup` function."; description = "Options provided to the `require('cmp_git').setup` function.";
options = { options = {
filetypes = helpers.defaultNullOpts.mkListOf types.str [ filetypes = defaultNullOpts.mkListOf types.str [
"gitcommit" "gitcommit"
"octo" "octo"
] "Filetypes for which to trigger."; ] "Filetypes for which to trigger.";
remotes = helpers.defaultNullOpts.mkListOf types.str [ remotes = defaultNullOpts.mkListOf types.str [
"upstream" "upstream"
"origin" "origin"
] "List of git remotes."; ] "List of git remotes.";
enableRemoteUrlRewrites = helpers.defaultNullOpts.mkBool false '' enableRemoteUrlRewrites = defaultNullOpts.mkBool false ''
Whether to enable remote URL rewrites. Whether to enable remote URL rewrites.
''; '';
git = { git = {
commits = { commits = {
limit = helpers.defaultNullOpts.mkUnsignedInt 100 '' limit = defaultNullOpts.mkUnsignedInt 100 ''
Max number of git commits to fetch. Max number of git commits to fetch.
''; '';
@ -44,12 +45,12 @@ in
}; };
github = { github = {
hosts = helpers.defaultNullOpts.mkListOf types.str [ ] '' hosts = defaultNullOpts.mkListOf types.str [ ] ''
List of private instances of github. List of private instances of github.
''; '';
issues = { issues = {
fields = helpers.defaultNullOpts.mkListOf types.str [ fields = defaultNullOpts.mkListOf types.str [
"title" "title"
"number" "number"
"body" "body"
@ -57,15 +58,15 @@ in
"state" "state"
] "The fields used for issues."; ] "The fields used for issues.";
filter = helpers.defaultNullOpts.mkStr "all" '' filter = defaultNullOpts.mkStr "all" ''
The filter to use when fetching issues. The filter to use when fetching issues.
''; '';
limit = helpers.defaultNullOpts.mkUnsignedInt 100 '' limit = defaultNullOpts.mkUnsignedInt 100 ''
Max number of issues to fetch. Max number of issues to fetch.
''; '';
state = helpers.defaultNullOpts.mkStr "open" '' state = defaultNullOpts.mkStr "open" ''
Which issues to fetch (`"open"`, `"closed"` or `"all"`). Which issues to fetch (`"open"`, `"closed"` or `"all"`).
''; '';
@ -74,7 +75,7 @@ in
}; };
mentions = { mentions = {
limit = helpers.defaultNullOpts.mkUnsignedInt 100 '' limit = defaultNullOpts.mkUnsignedInt 100 ''
Max number of mentions to fetch. Max number of mentions to fetch.
''; '';
@ -83,7 +84,7 @@ in
}; };
pull_requests = { pull_requests = {
fields = helpers.defaultNullOpts.mkListOf types.str [ fields = defaultNullOpts.mkListOf types.str [
"title" "title"
"number" "number"
"body" "body"
@ -91,11 +92,11 @@ in
"state" "state"
] "The fields used for pull requests."; ] "The fields used for pull requests.";
limit = helpers.defaultNullOpts.mkUnsignedInt 100 '' limit = defaultNullOpts.mkUnsignedInt 100 ''
Max number of pull requests to fetch. Max number of pull requests to fetch.
''; '';
state = helpers.defaultNullOpts.mkStr "open" '' state = defaultNullOpts.mkStr "open" ''
Which issues to fetch (`"open"`, `"closed"`, `"merged"` or `"all"`). Which issues to fetch (`"open"`, `"closed"`, `"merged"` or `"all"`).
''; '';
@ -105,16 +106,16 @@ in
}; };
gitlab = { gitlab = {
hosts = helpers.defaultNullOpts.mkListOf types.str [ ] '' hosts = defaultNullOpts.mkListOf types.str [ ] ''
List of private instances of gitlab. List of private instances of gitlab.
''; '';
issues = { issues = {
limit = helpers.defaultNullOpts.mkUnsignedInt 100 '' limit = defaultNullOpts.mkUnsignedInt 100 ''
Max number of issues to fetch. Max number of issues to fetch.
''; '';
state = helpers.defaultNullOpts.mkStr "open" '' state = defaultNullOpts.mkStr "open" ''
Which issues to fetch (`"open"`, `"closed"` or `"all"`). Which issues to fetch (`"open"`, `"closed"` or `"all"`).
''; '';
@ -123,7 +124,7 @@ in
}; };
mentions = { mentions = {
limit = helpers.defaultNullOpts.mkUnsignedInt 100 '' limit = defaultNullOpts.mkUnsignedInt 100 ''
Max number of mentions to fetch. Max number of mentions to fetch.
''; '';
@ -132,11 +133,11 @@ in
}; };
merge_requests = { merge_requests = {
limit = helpers.defaultNullOpts.mkUnsignedInt 100 '' limit = defaultNullOpts.mkUnsignedInt 100 ''
Max number of merge requests to fetch. Max number of merge requests to fetch.
''; '';
state = helpers.defaultNullOpts.mkStr "open" '' state = defaultNullOpts.mkStr "open" ''
Which issues to fetch (`"open"`, `"closed"`, `"locked"` or `"merged"`). Which issues to fetch (`"open"`, `"closed"`, `"locked"` or `"merged"`).
''; '';
@ -146,10 +147,10 @@ in
}; };
trigger_actions = trigger_actions =
helpers.defaultNullOpts.mkListOf defaultNullOpts.mkListOf
(types.submodule { (types.submodule {
options = { options = {
debug_name = helpers.mkNullOrStr "Debug name."; debug_name = lib.nixvim.mkNullOrStr "Debug name.";
trigger_character = lib.mkOption { trigger_character = lib.mkOption {
type = types.str; type = types.str;
@ -291,7 +292,7 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
extraConfigLua = '' extraConfigLua = ''
require('cmp_git').setup(${helpers.toLuaObject cfg.settings}) require('cmp_git').setup(${lib.nixvim.toLuaObject cfg.settings})
''; '';
}; };
} }

View file

@ -1,11 +1,12 @@
{ {
lib, lib,
helpers,
config, config,
... ...
}: }:
let let
inherit (lib) mkRenamedOptionModule types; inherit (lib) mkRenamedOptionModule types;
inherit (lib.nixvim) defaultNullOpts;
cfg = config.plugins.cmp-tabby; cfg = config.plugins.cmp-tabby;
in in
{ {
@ -31,23 +32,23 @@ in
]; ];
options.plugins.cmp-tabby = { options.plugins.cmp-tabby = {
settings = helpers.mkSettingsOption { settings = lib.nixvim.mkSettingsOption {
description = "Options provided to the `require('cmp_ai.config'):setup` function."; description = "Options provided to the `require('cmp_ai.config'):setup` function.";
options = { options = {
host = helpers.defaultNullOpts.mkStr "http://localhost:5000" '' host = defaultNullOpts.mkStr "http://localhost:5000" ''
The address of the tabby host server. The address of the tabby host server.
''; '';
max_lines = helpers.defaultNullOpts.mkUnsignedInt 100 '' max_lines = defaultNullOpts.mkUnsignedInt 100 ''
The max number of lines to complete. The max number of lines to complete.
''; '';
run_on_every_keystroke = helpers.defaultNullOpts.mkBool true '' run_on_every_keystroke = defaultNullOpts.mkBool true ''
Whether to run the completion on every keystroke. Whether to run the completion on every keystroke.
''; '';
stop = helpers.defaultNullOpts.mkListOf types.str [ "\n" ] '' stop = defaultNullOpts.mkListOf types.str [ "\n" ] ''
Stop character. Stop character.
''; '';
}; };
@ -63,7 +64,7 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
extraConfigLua = '' extraConfigLua = ''
require('cmp_tabby.config'):setup(${helpers.toLuaObject cfg.settings}) require('cmp_tabby.config'):setup(${lib.nixvim.toLuaObject cfg.settings})
''; '';
}; };
} }

View file

@ -1,6 +1,5 @@
{ {
lib, lib,
helpers,
config, config,
... ...
}: }:
@ -8,11 +7,11 @@ let
cfg = config.plugins.cmp-tabnine; cfg = config.plugins.cmp-tabnine;
in in
{ {
options.plugins.cmp-tabnine = helpers.neovim-plugin.extraOptionsOptions; options.plugins.cmp-tabnine = lib.nixvim.neovim-plugin.extraOptionsOptions;
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
extraConfigLua = '' extraConfigLua = ''
require('cmp_tabnine.config'):setup(${helpers.toLuaObject cfg.extraOptions}) require('cmp_tabnine.config'):setup(${lib.nixvim.toLuaObject cfg.extraOptions})
''; '';
}; };
} }

View file

@ -1,17 +1,18 @@
{ {
lib, lib,
helpers,
config, config,
... ...
}: }:
let let
inherit (lib.nixvim) defaultNullOpts;
copilot-lua-cfg = config.plugins.copilot-lua; copilot-lua-cfg = config.plugins.copilot-lua;
cfg = config.plugins.copilot-cmp; cfg = config.plugins.copilot-cmp;
in in
{ {
options.plugins.copilot-cmp = helpers.neovim-plugin.extraOptionsOptions // { options.plugins.copilot-cmp = lib.nixvim.neovim-plugin.extraOptionsOptions // {
event = event =
helpers.defaultNullOpts.mkListOf lib.types.str defaultNullOpts.mkListOf lib.types.str
[ [
"InsertEnter" "InsertEnter"
"LspAttach" "LspAttach"
@ -22,7 +23,7 @@ in
to touch this. to touch this.
''; '';
fixPairs = helpers.defaultNullOpts.mkBool true '' fixPairs = defaultNullOpts.mkBool true ''
Suppose you have the following code: `print('h')`. Suppose you have the following code: `print('h')`.
Copilot might try to account for the `'` and `)` and complete it with this: `print('hello`. Copilot might try to account for the `'` and `)` and complete it with this: `print('hello`.
@ -60,7 +61,7 @@ in
// cfg.extraOptions; // cfg.extraOptions;
in in
'' ''
require('copilot_cmp').setup(${helpers.toLuaObject setupOptions}) require('copilot_cmp').setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -1,6 +1,5 @@
{ {
lib, lib,
helpers,
config, config,
... ...
}: }:
@ -8,11 +7,11 @@ let
cfg = config.plugins.crates-nvim; cfg = config.plugins.crates-nvim;
in in
{ {
options.plugins.crates-nvim = helpers.neovim-plugin.extraOptionsOptions; options.plugins.crates-nvim = lib.nixvim.neovim-plugin.extraOptionsOptions;
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
extraConfigLua = '' extraConfigLua = ''
require('crates').setup(${helpers.toLuaObject cfg.extraOptions}) require('crates').setup(${lib.nixvim.toLuaObject cfg.extraOptions})
''; '';
}; };
} }