From 8338cf146f72df1c04aa669c002e3bfd148bbb84 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Fri, 26 May 2023 11:18:23 +0200 Subject: [PATCH] plugins/nvim-cmp: update options --- plugins/completion/nvim-cmp/default.nix | 21 +++++++++++++------ .../plugins/completion/nvim-cmp.nix | 2 ++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/plugins/completion/nvim-cmp/default.nix b/plugins/completion/nvim-cmp/default.nix index 3dee07a3..c7c5fa06 100644 --- a/plugins/completion/nvim-cmp/default.nix +++ b/plugins/completion/nvim-cmp/default.nix @@ -21,7 +21,7 @@ in { package = helpers.mkPackageOption "nvim-cmp" pkgs.vimPlugins.nvim-cmp; - performance = helpers.mkCompositeOption "Performance options" { + performance = { debounce = helpers.defaultNullOpts.mkInt 60 '' Sets debounce time This is the interval used to group up completions from different sources @@ -37,6 +37,14 @@ in { Sets the timeout of candidate fetching process. The nvim-cmp will wait to display the most prioritized source. ''; + + asyncBudget = helpers.defaultNullOpts.mkInt 1 '' + Maximum time (in ms) an async function is allowed to run during one step of the event loop. + ''; + + maxViewEntries = helpers.defaultNullOpts.mkInt 200 '' + Maximum number of items to show in the entries list. + ''; }; preselect = helpers.defaultNullOpts.mkEnumFirstDefault ["Item" "None"] '' @@ -289,8 +297,6 @@ in { priority = helpers.mkNullOrOption types.int "The source-specific priority value."; - maxItemCount = helpers.mkNullOrOption types.int "The source-specific item count."; - groupIndex = helpers.mkNullOrOption types.int '' The source group index. @@ -470,7 +476,12 @@ in { then null else false; - inherit (cfg) performance; + performance = with cfg.performance; { + inherit debounce throttle; + fetching_timeout = fetchingTimeout; + async_budget = asyncBudget; + max_view_entries = maxViewEntries; + }; preselect = helpers.ifNonNull' cfg.preselect (helpers.mkRaw "cmp.PreselectMode.${cfg.preselect}"); @@ -596,8 +607,6 @@ in { inherit (source) priority; - max_item_count = source.maxItemCount; - group_index = source.groupIndex; entry_filter = source.entryFilter; diff --git a/tests/test-sources/plugins/completion/nvim-cmp.nix b/tests/test-sources/plugins/completion/nvim-cmp.nix index 51ff1fb3..edd80cea 100644 --- a/tests/test-sources/plugins/completion/nvim-cmp.nix +++ b/tests/test-sources/plugins/completion/nvim-cmp.nix @@ -20,6 +20,8 @@ debounce = 60; throttle = 30; fetchingTimeout = 500; + asyncBudget = 1; + maxViewEntries = 200; }; preselect = "Item";