tzachar / cmp-tabnine

TabNine plugin for hrsh7th/nvim-cmp
MIT License
286 stars 27 forks source link

Tabnine Hub: Lost Connection #74

Closed zeitchef closed 1 year ago

zeitchef commented 1 year ago

I'm fairly certain I've gotten everything configured properly and I'm logged into TabNine, but for some reason :CmpTabnineHub does not want to connect. CmpStatus also lists TabNine as "unused".

Here's my relevant config:

cmp.setup {
  experimental = {
    native_menu = false,
    ghost_text = true,
  },
  snippet = {
    expand = function(args)
      require('luasnip').lsp_expand(args.body)
    end,
  },
  mapping = cmp.mapping.preset.insert {
    ['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
    ['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
    ['<C-p'] = cmp.mapping.select_prev_item(),
    ['<C-n'] = cmp.mapping.select_next_item(),
    ['<C-e'] = cmp.mapping.close(),
    ['<Shift-Space>'] = cmp.mapping.complete(),
    ['<CR>'] = cmp.mapping.confirm { select = true },
  },
  formatting = {
    fields = { 'kind', 'abbr', 'menu' },
    format = function(_, vim_item)
      vim_item.menu = vim_item.kind
      vim_item.kind = icons[vim_item.kind]

      return vim_item
    end,
  },
  sources = {
    { name = 'nvim_lsp' },
    { name = 'luasnip' },
    { name = 'cmp_tabnine' },
    { name = 'buffer' },
    { name = 'path' },
  },
  preselect = cmp.PreselectMode.None,
}

cmp.setup.cmdline('/', {
  mapping = cmp.mapping.preset.cmdline(),
  sources = {
    { name = 'buffer' },
  },
})

tabnine.setup {
  show_prediction_strength = true,
}

Am I overlooking something?

tzachar commented 1 year ago

try this:

local tabnine = require('cmp_tabnine.config')

tabnine:setup({
  max_lines = 1000,
  max_num_results = 20,
  sort = true,
  priority = 5000,
  show_prediction_strength = true,
  run_on_every_keystroke = true,
})

and what is the output of :CmpTabnineHubUrl ? and do you have the tabnine process running?

zeitchef commented 1 year ago

Service seems to be running, but when I hit the URL in the browser, it appears some verification needs to happen - but this is not my TabNine account. ???

Screen Shot 2022-10-18 at 16 33 26
tzachar commented 1 year ago

This is not enough information to help you.

zeitchef commented 1 year ago

Output of :CmpTabnineHubUrl is:

Screen Shot 2022-10-19 at 09 26 32

But it makes me super suspicious that when opening this URL in the browser it's pointing to another account. Can you explain that please?

tzachar commented 1 year ago

How can you tell its another account? Its not apparent from the image above. Anyway, you need to use this page to login into your own account.

zeitchef commented 1 year ago

I'm already logged into Tabnine Hub:

Screen Shot 2022-10-19 at 10 06 01

The screenshot above is a completely different account (with over 1600) notifications - that is not my account.

zeitchef commented 1 year ago

This could have been an anomaly. I just tested and :CmpTabnineHub does attach the correct URL as query parameter, but nevertheless the connection fails because it assumes I'm not logged in. When I open the hub directly in the browser, I'm logged in.

tzachar commented 1 year ago

I think you are missing something. Opening the hub of you locally running tabnine process enables you to configure it, and set your account info. Did you do this?

zeitchef commented 1 year ago

Again, I just ran :CmpTabnineHubUrl and and opened the URL this returned in my browser - this is not my account.

Screen Shot 2022-10-19 at 12 59 05

I have no idea what configuration needs to be done - you mention it in the README but this links to a document header, which is not very clear. For the record, I have logged into the Tabnine Hub so I would expect this to just work, unless you can be clearer on what exact configuration needs to be done.

tzachar commented 1 year ago

once you open the hub from within nvim, you should be able to login via the top left menu. anyway, this should not stop you from getting completions. maybe you disabled the tabnine source for a specific file type? try giving a minimal working config which recreates the problem.

jellydn commented 1 year ago

Just FYI - I got into this issue on my PC with Brave. It works after it turns off the shield. Refer https://gyazo.com/67d6bdedeacbc78c30b34141744a9004.gif

tzachar commented 1 year ago

Closing this, as it seems to be related to specific browsers.