vim-patch:9.2.1004: a completion function cannot tell why it was called (#41500)

Problem:  A function used through 'omnifunc' or 'complete' is called the
          same way whether 'autocomplete' started the completion or a
          key asked for one, so it cannot answer differently.
Solution: Report which of the two it is in complete_info() as "auto". It
          is returned only when asked for in {what}, so what
          complete_info() says by itself does not change
          (Hirohito Higashi).

closes: vim/vim#21143

1f56c351de

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
This commit is contained in:
zeertzjq
2026-08-26 15:21:22 +08:00
committed by GitHub
parent 0f0e89fd90
commit ec982dfb93
6 changed files with 90 additions and 1 deletions

View File

@@ -1135,6 +1135,12 @@ function vim.fn.complete_check() end
--- Returns a |Dictionary| with information about Insert mode
--- completion. See |ins-completion|.
--- The items are:
--- auto |TRUE| when Vim started this completion by
--- itself, which is what 'autocomplete' does,
--- and |FALSE| when a key asked for it, such as
--- |i_CTRL-X_CTRL-O|. A |complete-functions|
--- function can read this to tell the two apart.
--- Returned only when asked for in {what}.
--- completed Return a dictionary containing the entries of
--- the currently selected index item.
--- items List of all completion candidates. Each item