neoclide / coc-tabnine

Tabnine integration of coc.nvim
468 stars 18 forks source link

Autocomplete text not inserted into the buffer #79

Closed lukepass closed 2 years ago

lukepass commented 2 years ago

Hello and thanks for the plugin! I purchased the license but I have a problem with the plugin. Why is the text not inserted into the buffer but I have to press "Enter" or "Tab" to accept it?

I expected the part ('target_path) to be inserted as well into the buffer.

Thanks.

image

chemzqm commented 2 years ago

:h coc-config-suggest-invalidInsertCharacters or confirm completion.

lukepass commented 2 years ago

I see, so I should set this variable to "" or "(" as indicated here:

https://github.com/neoclide/coc.nvim/issues/3543 https://github.com/neoclide/coc.nvim/issues/3566

Is there a way to configure invalidInsertCharacters only for the tabnine autocomplete? Something like

"tabnine": {
    "suggest.invalidInsertCharacters" : ["("]
}

Thanks.

chemzqm commented 2 years ago

No, confirm completion is recommended.

lukepass commented 2 years ago

Ok, thanks! My current Ctrl-Y is mapped to emmet and other things and so accepting with Ctrl-Y is not available. Di you know how can I remap it to accept the entry?

Thanks again!

chemzqm commented 2 years ago

Read wiki https://github.com/neoclide/coc.nvim/wiki/Completion-with-sources

lukepass commented 2 years ago

That's it! For all the people who have the same problem this is the relevant part:

inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"

If you want to complete the whole line just add this to the coc.nvim config:

"suggest.invalidInsertCharacters" : ["("]

@chemzqm I already read the wiki but many days before having this problem :)

Thanks.