tzachar / compe-tabnine

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

Other sources are not shown when tabnine is enabled and requesting completion for 0 length #20

Closed Gelio closed 3 years ago

Gelio commented 3 years ago

Hey! Thanks for the great plugin

I have been using it for some time and I have noticed something that is not ideal in my view. When requesting completion when I did not type any input yet (to get the list of possible values from LSP, meaning I did not type any letters for the word yet), I am only getting TN completions, and the completions from LSP are not shown.

image

It works fine after I type a letter: image

I have tried changing the priority of the tabnine source to be lower than lsp:

  source = {
    path = true;
    buffer = true;
    calc = true;
    nvim_lsp = { priority = 1000 };
    nvim_lua = true;
    vsnip = false;
    tabnine = { priority = 999 };
  };

but that does not help. I have also tried changing compe's min_length to 0:

  min_length = 0;

That did not help either.

The only thing that helps get completions when I haven't typed any letter yet is disabling the tabnine source

    tabnine = false;

Then I get LSP completions without changing min_length or any priorities. image

How do I get tabnine completions for 0-letter inputs to not overwrite the LSP completions?

Relevant parts of my config: https://github.com/Gelio/ubuntu-dotfiles/blob/72b863b1a1e91336e51f998f1abc95660da91525/configs/neovim.lua#L67-L90 https://github.com/Gelio/ubuntu-dotfiles/blob/72b863b1a1e91336e51f998f1abc95660da91525/configs/neovim.vim#L196-L205

tzachar commented 3 years ago

I believe this is a bug with compe. It has nothing to do with compe-tabnine. You can see from your example that the only source used when tabnine is disabled is lsp. Why no buffer sugestions? You can set LSP to false, and see another source poping up to be the only source of completion. I suggest you open a bug in compe, and give an example of this behaviour using only the builtin sources.

Gelio commented 3 years ago

You can see from your example that the only source used when tabnine is disabled is lsp. Why no buffer sugestions?

There were so many LSP suggestions that the buffer ones did not make it into the screenshot. They are there, though.

In all screenshots below I am requesting completions not having typed any letters of the word.

With tabnine disabled: image

With tabnine enabled: image

The weird thing is that the suggestions are correct (LSP-ones are on top) when the code is slightly different, and I'm requesting completions for an empty line inside of the {} (tabnine is enabled in both screenshots): image image


Anyway, since you're saying this is likely a bug in compe, I'll open an issue there (EDIT: https://github.com/hrsh7th/nvim-compe/issues/346), thanks for the time 👍