vim-patch:9.1.1672: completion: cannot add timeouts for 'cpt' sources (#35447)

Problem:  completion: cannot add timeouts for 'cpt' sources
          (Evgeni Chasnovski)
Solution: Add the 'autocompletetimeout' and 'completetimeout' options
          (Girish Palya)

fixes: vim/vim#17908
closes: vim/vim#17967

69a337edc1

Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
zeertzjq
2025-08-24 13:16:55 +08:00
committed by GitHub
parent c1fa3c7c37
commit 810a234978
9 changed files with 190 additions and 23 deletions

View File

@@ -255,6 +255,27 @@ local options = {
type = 'number',
varname = 'p_acl',
},
{
abbreviation = 'act',
defaults = 80,
desc = [=[
Initial timeout (in milliseconds) for the decaying time-sliced
completion algorithm. Starts at this value, halves for each slower
source until a minimum is reached. All sources run, but slower ones
are quickly de-prioritized. The default is tuned so the popup menu
opens within ~200ms even with multiple slow sources on a slow system.
Changing this value is rarely needed. Only 80 or higher is valid.
Special case: when 'complete' contains "F" or "o" (function sources),
a longer timeout is used, allowing up to ~1s for sources such as LSP
servers that may sometimes take longer (e.g., while loading modules).
See |ins-autocompletion|.
]=],
full_name = 'autocompletetimeout',
scope = { 'global' },
short_desc = N_('initial decay timeout for autocompletion algorithm'),
type = 'number',
varname = 'p_act',
},
{
abbreviation = 'ai',
defaults = true,
@@ -1722,6 +1743,19 @@ local options = {
type = 'string',
varname = 'p_csl',
},
{
abbreviation = 'cto',
defaults = 0,
desc = [=[
Like 'autocompletetimeout', but applies to |i_CTRL-N| and |i_CTRL-P|
completion. Value of 0 disables the timeout; positive values allowed.
]=],
full_name = 'completetimeout',
scope = { 'global' },
short_desc = N_('initial decay timeout for CTRL-N and CTRL-P'),
type = 'number',
varname = 'p_cto',
},
{
abbreviation = 'cocu',
cb = 'did_set_concealcursor',