[vim/vim] a completion function cannot tell why it was called (PR #21143)

10 views
Skip to first unread message

h_east

unread,
Aug 24, 2026, 2:50:45 PM (yesterday) Aug 24
to vim/vim, Subscribed
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.

related: h-east/lsp.vim#2


Why this is wanted:

With 'autocomplete', Vim asks the sources in 'complete' after every printable
character and when Insert mode is entered. A language server asks for less
than that: automatically where an identifier is being typed and after the
characters it lists in completionProvider.triggerCharacters, "." for
instance, and nowhere else. What the user asks for by hand is a case of its
own, and may be answered wherever the cursor stands.

The function is called the same way in all of them, so a client has to pick
one behavior: ask the server on every key, which puts a menu up after a
bracket or a space, or turn down the request the user typed CTRL-X CTRL-O for.

The way around that today is a second function, which the user has to put in
'complete' by hand while 'complete' documents "o" as the way an LSP client's
'omnifunc' is used. With "auto" one function covers both cases. A source that
is slow to gather matches can use it as well, to take a cheaper path when
nobody asked.

complete_info() by itself is unchanged: "auto" comes back only when it is in
{what}.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/21143

Commit Summary

  • c25b436 a completion function cannot tell why it was called

File Changes

(5 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/21143@github.com>

Christian Brabandt

unread,
3:31 PM (6 hours ago) 3:31 PM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#21143)

thanks


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/21143/c5415639575@github.com>

Reply all
Reply to author
Forward
0 new messages