tzachar / compe-tabnine

TabNine source for hrsh7th/nvim-compe
BSD 3-Clause "New" or "Revised" License
52 stars 3 forks source link

Remove repeated suffix from TN suggestion #21

Closed JoseConseco closed 3 years ago

JoseConseco commented 3 years ago

Hi. When I'm making corrections in code I'm often getting TN suggestions that have same ending as rest of line eg:: image

In above case first suggestion is ok [there is no suggested ): suffix] but often I get only suggestions that ends same as the rest of line - so after autocomplete I have to remove the repeated ending. I contacted TN support, but they said the repeated suffix should be automatically gone when accepting the auto-suggestion, which is does not do.
I wonder is this something that compe-tabnine can handle - by removing those suggestions from suggestion list, or by removing repeated part after pressing ?

tzachar commented 3 years ago

This is a tricky issue. In general, nvim-compe does not support this (there are plans to add this in future releases: hrsh7th/nvim-compe#297 However, as TabNine has some support for this behaviour, it sometimes works.

See this line: https://github.com/tzachar/compe-tabnine/blob/f6ace45ef5cbd8b274d7163a2931c11083d34d44/lua/compe_tabnine/init.lua#L169

So, if TabNine supplies the relevant info, this plugin uses it. Otherwise, no luck.