tzachar / cmp-tabnine

TabNine plugin for hrsh7th/nvim-cmp
MIT License
287 stars 28 forks source link

`run_on_every_keystroke` clarification #18

Closed mystilleef closed 2 years ago

mystilleef commented 2 years ago

If I set run_on_every_keystroke to false, then how often is the server queried? Is it queried on CursorHoldI? The docs don't explain this behavior. I know this makes the queries less aggressive, but how much so?

tzachar commented 2 years ago

This is related to cmp's behaviour. Lets say you input an 'a', and assume you are using the buffer source. The buffer source will then return all identifiers starting with an 'a'. When you then input the next character, cmp does not need to ask buffer for different completion items, it just needs to filter the previous results to those having 'ab' (its actually doing a fuzzy filter here). However, TabNine can generate different completion items based on the new prefix 'ab', hence the run_on_every_keystroke. If you set it to false, your experience with TabNine's completion would suffer.

Personally, I think TabNine does not lag behind the other sources and is very responsive. That is why run_on_every_keystroke is set to true by default.

Maybe we should add this to the README.