patch 9.1.1672: completion: cannot add timeouts for 'cpt' sources

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

fixes: #17908
closes: #17967

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Girish Palya
2025-08-23 16:20:03 +02:00
committed by Christian Brabandt
parent f66674cf42
commit 69a337edc1
14 changed files with 176 additions and 43 deletions

View File

@ -1,4 +1,4 @@
*insert.txt* For Vim version 9.1. Last change: 2025 Aug 16
*insert.txt* For Vim version 9.1. Last change: 2025 Aug 23
VIM REFERENCE MANUAL by Bram Moolenaar
@ -1138,18 +1138,20 @@ CTRL-X CTRL-Z Stop completion without changing the text.
AUTOCOMPLETION *ins-autocompletion*
Vim can display a completion menu as you type, similar to using |i_CTRL-N|,
but triggered automatically. See 'autocomplete' and 'autocompletedelay'.
The menu items are collected from the sources listed in the 'complete' option.
but triggered automatically. See 'autocomplete'. The menu items are collected
from the sources listed in the 'complete' option, in order.
Unlike manual |i_CTRL-N| completion, this mode uses a decaying timeout to keep
Vim responsive. Sources earlier in the 'complete' list are given more time
(higher priority), but every source is guaranteed a time slice, however small.
A decaying timeout keeps Vim responsive. Sources earlier in the 'complete'
list get more time (higher priority), but all sources receive at least a small
time slice.
This mode is fully compatible with other completion modes. You can invoke
any of them at any time by typing |CTRL-X|, which temporarily suspends
autocompletion. To use |i_CTRL-N| specifically, press |CTRL-E| first to
dismiss the popup menu (see |complete_CTRL-E|).
See also 'autocomplete', 'autocompletetimeout' and 'autocompletedelay'.
FUNCTIONS FOR FINDING COMPLETIONS *complete-functions*

View File

@ -1,4 +1,4 @@
*options.txt* For Vim version 9.1. Last change: 2025 Aug 21
*options.txt* For Vim version 9.1. Last change: 2025 Aug 23
VIM REFERENCE MANUAL by Bram Moolenaar
@ -925,6 +925,20 @@ A jump table for the options with a short description can be found at |Q_op|.
typing. If you prefer it not to open too quickly, set this value
slightly above your typing speed. See |ins-autocompletion|.
*'autocompletetimeout'* *'act'*
'autocompletetimeout' 'act' number (default 80)
global
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|.
*'autoindent'* *'ai'* *'noautoindent'* *'noai'*
'autoindent' 'ai' boolean (default off)
local to buffer
@ -2325,6 +2339,12 @@ A jump table for the options with a short description can be found at |Q_op|.
For Insert mode completion the buffer-local value is used. For
command line completion the global value is used.
*'completetimeout'* *'cto'*
'completetimeout' 'cto' number (default 0)
global
Like 'autocompletetimeout', but applies to |i_CTRL-N| and |i_CTRL-P|
completion. Value of 0 disables the timeout; positive values allowed.
*'concealcursor'* *'cocu'*
'concealcursor' 'cocu' string (default: "")
local to window

View File

@ -1,4 +1,4 @@
*quickref.txt* For Vim version 9.1. Last change: 2025 Aug 16
*quickref.txt* For Vim version 9.1. Last change: 2025 Aug 23
VIM REFERENCE MANUAL by Bram Moolenaar
@ -609,6 +609,7 @@ Short explanation of each option: *option-list*
'autochdir' 'acd' change directory to the file in the current window
'autocomplete' 'ac' enable automatic completion in insert mode
'autocompletedelay' 'acl' delay in msec before menu appears after typing
'autocompletetimeout' 'act' initial decay timeout for autocompletion algorithm
'autoindent' 'ai' take indent for new line from previous line
'autoread' 'ar' autom. read file when changed outside of Vim
'autoshelldir' 'asd' change directory to the shell's current directory
@ -661,6 +662,7 @@ Short explanation of each option: *option-list*
'completeopt' 'cot' options for Insert mode completion
'completepopup' 'cpp' options for the Insert mode completion info popup
'completeslash' 'csl' like 'shellslash' for completion
'completetimeout' 'cto' initial decay timeout for CTRL-N and CTRL-P
'concealcursor' 'cocu' whether concealable text is hidden in cursor line
'conceallevel' 'cole' whether concealable text is shown or hidden
'confirm' 'cf' ask what to do about unsaved/read-only files

View File

@ -44,6 +44,7 @@ $quote eval.txt /*$quote*
'ac' options.txt /*'ac'*
'acd' options.txt /*'acd'*
'acl' options.txt /*'acl'*
'act' options.txt /*'act'*
'ai' options.txt /*'ai'*
'akm' options.txt /*'akm'*
'al' options.txt /*'al'*
@ -66,6 +67,7 @@ $quote eval.txt /*$quote*
'autochdir' options.txt /*'autochdir'*
'autocomplete' options.txt /*'autocomplete'*
'autocompletedelay' options.txt /*'autocompletedelay'*
'autocompletetimeout' options.txt /*'autocompletetimeout'*
'autoindent' options.txt /*'autoindent'*
'autoprint' vi_diff.txt /*'autoprint'*
'autoread' options.txt /*'autoread'*
@ -175,6 +177,7 @@ $quote eval.txt /*$quote*
'completeopt' options.txt /*'completeopt'*
'completepopup' options.txt /*'completepopup'*
'completeslash' options.txt /*'completeslash'*
'completetimeout' options.txt /*'completetimeout'*
'concealcursor' options.txt /*'concealcursor'*
'conceallevel' options.txt /*'conceallevel'*
'confirm' options.txt /*'confirm'*
@ -205,6 +208,7 @@ $quote eval.txt /*$quote*
'cst' options.txt /*'cst'*
'csto' options.txt /*'csto'*
'csverb' options.txt /*'csverb'*
'cto' options.txt /*'cto'*
'cuc' options.txt /*'cuc'*
'cul' options.txt /*'cul'*
'culopt' options.txt /*'culopt'*

View File

@ -41833,12 +41833,14 @@ Options: ~
'autocomplete' Enable auto completion |ins-autocompletion|
'autocompletedelay' Delay in msec before menu appears after typing
'chistory' Size of the quickfix stack |quickfix-stack|.
'clipmethod' How to access the clipboard.
'autocompletetimeout' initial decay timeout for autocompletion algorithm
'chistory' Size of the quickfix stack |quickfix-stack|
'clipmethod' How to access the clipboard
'completefuzzycollect' Enable fuzzy collection of candidates for (some)
|ins-completion| modes
'completeitemalign' Order of |complete-items| in Insert mode completion
popup
'completetimeout' initial decay timeout for CTRL-N and CTRL-P
'diffanchors' list of {address} to force syncing of diffs
'eventignorewin' autocommand events that are ignored in a window
'findfunc' Vim function to obtain the results for a |:find|