lsp icon indicating copy to clipboard operation
lsp copied to clipboard

omnifunc/LspOmniFunc does not filter completion options

Open dunric opened this issue 2 years ago • 1 comments

When autoComplete is set to false, manual invocation of a completion uses omnifunc buffer setting which defaults to LspOmniFunc. However it completely ignores already typed chars and offers full list of completion options from the server.

For example, in a rust filetype buffer using rust-analyzer as a lsp server, invoking omnifunc completion for a string literal followed with .to

"hello".to

offers unfiltered and unsorted list of completions:

replace
replacen
to_lowercase
to_uppercase
repeat
to_ascii_lowercase
…

instead of only words starting with to

to_lowercase
to_uppercase
to_ascii_lowercase
to_ascii_upperrcase
to_string
to_owned

When autoComplete is on it does not happen, because there is no existing prefix by which options are filtered.

Expected behavior: already typed chars are used for narrowing down list of completion options.

Completion matcher is "case" for case sensitive search.

dunric avatar Jul 26 '23 19:07 dunric

This is because the results are not sorted correctly from rust-analyzer. You can try this plugin https://github.com/girishji/vimcomplete and see if it solves your problem.

girishji avatar Aug 01 '23 09:08 girishji