Open chrisgrieser opened 1 month ago
Before I go into detail I want to highlight that a direct comparison of cmp and basics_ls is not fare as cmp is a completion engine that can perform many operation over the completions from multiple sources and basics_ls is a language server that can only provide completions and it is up to completion engine to sort/filter/hide the completions.
Initially I aimed at having a feature parity with what cmp currently offers but then found that some of it is unattainable from a language server alone. This includes both suggestions. Let me elaborate.
Let's say we are in a file where when typing on a new line f
we have completions foo/foobar/foobarbaz/foobarbazzoo.
max_item_count
- From my initial testing it looks like the builtin neovim completion is triggered from the very first character. When you continue typing to foo
neovim reuses the completions that were previously received instead of requesting new ones. Unless you remove a character and type it again. If you set a max_item_count
to 2
than for f
we can provide foo/foobar completions. But then when you get to type to foobar
there would be no more completions to show.keyword_length
I have to double check this, but if neovim asks for completion and there are less characters that the user set keyword_length
than basics_ls can respond with an empty completion list. Similar to the example above by the time a user types the wanted keyword_length
to see completions neovim reuses the same empty completion list and the user sees no completions which is confusing.PS:
cmp has two useful options, which I think are particularly useful for the buffer source, but could also of use for the other suggestion types:
keyword_length
: a minimum number of characters before that source is triggered. Setting it to3
for the buffer suggestions means that you only get buffer suggestions with a minimum of 3 characters types.max_item_count
: The maximum number of suggestions by this source. I find this useful to limit the number ofbuffer
suggestions, so it does not drown out LSP suggestions.