Coder Social home page Coder Social logo

cmp-tabnine's People

Contributors

allan-simon avatar bilucodota avatar brunokrugel avatar cuberiser avatar dimacodota avatar equal-l2 avatar ertynea avatar github-actions[bot] avatar goolord avatar inadati avatar j-ilden avatar mayanksuman avatar nzlov avatar sazk07 avatar shoriminimoe avatar tzachar avatar vzytoi avatar xanderjakeq avatar xiantang avatar yioneko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cmp-tabnine's Issues

Doesn't work on fish shell

When I open nvim using fish shell I'm getting a message that tabnine is not executable... Where is it even stored?

`run_on_every_keystroke` clarification

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?

Module 'cmp' not found

Summary

Hello, I have encountered an error, my files followed by the error message are shown below.

Files

-- Packer
use {
  "tzachar/cmp-tabnine",
  run = "./install.sh",
  requires = "hrsh7th/nvim-cmp",
  after = "nvim-lspconfig",
  config = function()
     require("custom.plugins.cmp-tabnine.conf").setup()
  end,
}
-- config file
local ok, tabnine = pcall(require, "cmp_tabnine.config")

if not ok then
   return
end

local M = {}
M.setup = function()
   tabnine:setup {
      max_lines = 1000,
      max_num_results = 20,
      sort = true,
      run_on_every_keystroke = true,
      snippet_placeholder = "..",
   }
end

return M

Problem

The error I get opening neovim.

Error executing vim.schedule lua callback: ...vim/site/pack/packer/opt/packer.nvim/lua/packer/load.lua:165: Vim(echomsg):E114: Missing quote: "Error in packer_compiled: ...vim/site/pack/packer/opt/packer.nv
im/lua/packer/load.lua:142: Vim(source):E5113: Error while calling lua chunk: ...ite/pack/packer/opt/cmp-tabnine/lua/cmp_tabnine/init.lua:1: module 'cmp' not found:

Extra

I also tried to run the install.sh script by hand, but didn't make any difference. Hope someone can help me,

Best Regards.

TabNine Unkown Message ?

When using tabnine, I get this, any ideas ?

"TabNine: unknown message: " '{"old_prefix":"","results":[{"new_prefix":"print(\\"Total traini
ng time: {}\\".format(time.time() - start_time))\\n    print(\\"Total testing time: {}\\".form
at(time.time() - start_time))\\n    print(\\"Total classification loss: {}\\".","old_suffix":"
\\n","new_suffix":"","kind":15,"origin":"CLOUD"},{"new_prefix":"print(\\"Total training time:
{}\\".format(time.time() - start_time))\\n    print(\\"Total testing time: {}\\".format(time.t
ime() - start_time))\\n    print(\\"Total classification time: {}\\".","old_suffix":"\\n","new
_suffix":"","kind":15,"origin":"CLOUD"}],"user_message":[],"docs":[],"is_locked":false}'```

Unknow message

Hello! just installed and get this every keystroke, completion works good, however this is annoying
image
OS: Windows 10

[Not A Bug] A suggestion

Hey i was trying to install cmp-tabnine after new installation of my arch but i kept getting not installed error in my packer i didn't know what that was but i tried to do it again for 3 to 4 times and i failed then i thought maybe lets install in manually when i run your script install.sh it installed but at the end it said unzip not found and that was the problem unzip wasn't installed.
What i want to suggest is that you put the unzip in the dependencies section so anybody can see them spot on and doesn't get stuck on the error. Thanks! have a nice day.

Error using neofetch and cmp-tabnine.

Hey! I've been using cmp-tabnine for a while now and it works just fine (:
Today I tried to use neofetch and added it my config file (~/.config/fish/config.fish) so that it always shows on startup.
Unfortunately whenever I try to start nvim I have this error :

Error executing vim.schedule lua callback: Vim:E475: Invalid value for argument cmd: '/home/cyprien/.local/share/nvim/site/pack/packer/start/cmp-tabnine/binaries/4.4.8/�[?25l�[?7l�[37m�[0m�[1m       _,met$$$$$gg.
   ,g$$$$$$$$$$$$$$$P.
 ,g$$P"     """Y$$.".
,$$P'              `$$$.
',$$P       ,ggs.     `$$b:
`d$$'     ,$P"'   �[0m�[31m�[1m.�[37m�[0m�[1m    $$$
$$P      d$'     �[0m�[31m�[1m,�[37m�[0m�[1m    $$P
$$:      $$.   �[0m�[31m�[1m-�[37m�[0m�[1m    ,d$$'
$$;      Y$b._   _,d$P'
Y$$.    �[0m�[31m�[1m`.�[37m�[0m�[1m`"Y$$$$P"'
�[37m�[0m�[1m `$$b      �[0m�[31m�[1m"-.__
�[37m�[0m�[1m  `Y$$
  `Y$$.
    `$$b.
      `Y$$b.
         `"Y$b._
             `"""�[0m
�[17A�[9999999D�[30C�[0m�[1m�[31m�[1mcyprien�[0m@�[31m�[1mdebian�[0m 
�[30C�[0m--------------�[0m 
�[30C�[0m�[31m�[1mOS�[0m�[0m:�[0m Debian GNU/Linux 11 (bullseye) x86_64�[0m 
�[30C�[0m�[31m�[1mKernel�[0m�[0m:�[0m 5.10.0-12-amd64�[0m 
�[30C�[0m�[31m�[1mUptime�[0m�[0m:�[0m 1 hour, 32 mins�[0m 
�[30C�[0m�[31m�[1mPackages�[0m�[0m:�[0m 2403 (dpkg), 7 (snap)�[0m 
�[30C�[0m�[31m�[1mShell�[0
stack traceback:
   [C]: in function 'jobstart'
   ...pack/packer/start/cmp-tabnine/lua/cmp_tabnine/source.lua:234: in function '_on_exit'
   ...pack/packer/start/cmp-tabnine/lua/cmp_tabnine/source.lua:135: in function 'new'
   ...e/pack/packer/start/cmp-tabnine/lua/cmp_tabnine/init.lua:8: in function <...e/pack/packer/start/cmp-tabnine/lua/cmp_tabnine/init.lua:7>

Neovim version: NVIM v0.8.0-dev+95-g07660193a
Operating System: Debian 11

Thank you for your time and have a great day! (:

x86_64-unknown-linux-musl/TabNine is not executable

I am facing below issue with latest version of plugin.

.local/share/nvim/site/pack/packer/start/cmp-tabnine/binaries/4.4.1/x86_64-unknown-linux-musl/TabNine' is not executable
stack traceback:
        [C]: in function 'jobstart'
        ...pack/packer/start/cmp-tabnine/lua/cmp_tabnine/source.lua:234: in function '_on_exit'
        ...pack/packer/start/cmp-tabnine/lua/cmp_tabnine/source.lua:135: in function 'new'
        ...e/pack/packer/start/cmp-tabnine/lua/cmp_tabnine/init.lua:8: in function <...e/pack/packer/start/cmp-tabnine/lua/cmp_tabnine/init.lua:7>

entry.completion_item.data is nil

I'm using Packer with Tabnine. However, after I installed the plugin, run ./install.sh and added some configuration, it seems like entry.completion_item.data always returns nil. Here is a snippet of my formatting:
formatting = { format = function(entry, vim_item) vim_item.kind = lspkind.presets.default[vim_item.kind] local menu = source_mapping[entry.source.name] if entry.source.name == "cmp_tabnine" then if entry.completion_item.data ~= nil and entry.completion_item.data.detail ~= nil then menu = entry.completion_item.data.detail .. " " .. menu else menu = "nil " ..menu end vim_item.kind = "" end vim_item.menu = menu return vim_item end, },
environment:
Mac OS Monterey Version 12.3 Apple M1

Allow whitelisting languages

Currently the configuration allows settting ignored_file_types. Is it possible to allow a whitelist (could for instance be called allowed_file_types) of languages for which tabnine is only enabled for, and disabled for all other languages?

Does not work on Windows

My setting is as below. First part is copied from nvim-cmp configuration. Following part is copied from cmp-tabnine configuration. The source setting overwrites the one in the first part. I tried with a python file. It does not show tabnine results, actually it shows nothing since I overwrite the nvim-cmp source item. However, if I do not overwrite, the cmp configuration works in the same python file. I can see LSP source results. Could you help me to find where I did wrong? I have run the hook script and the folder binaries\4.0.23\x86_64-pc-windows-gnu is generated with 4 exe binaries.

set completeopt=menu,menuone,noselect

lua <<EOF
-- Setup nvim-cmp.
local cmp = require'cmp'

cmp.setup({
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.fn"vsnip#anonymous" -- For vsnip users.
-- require('luasnip').lsp_expand(args.body) -- For luasnip users.
-- vim.fn"UltiSnips#Anon" -- For ultisnips users.
-- require'snippy'.expand_snippet(args.body) -- For snippy users.
end,
},
mapping = {
[''] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
[''] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
[''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
[''] = cmp.config.disable, -- Specify cmp.config.disable if you want to remove the default <C-y> mapping.
[''] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
-- Accept currently selected item. If none selected, select first item.
-- Set select to false to only confirm explicitly selected items.
[''] = cmp.mapping.confirm({ select = true }),
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' }, -- For vsnip users.
-- { name = 'luasnip' }, -- For luasnip users.
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}, {
{ name = 'buffer' },
})
})

-- Use buffer source for / (if you enabled native_menu, this won't work anymore).
cmp.setup.cmdline('/', {
sources = {
{ name = 'buffer' }
}
})

-- Use cmdline & path source for ':' (if you enabled native_menu, this won't work anymore).
cmp.setup.cmdline(':', {
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})

-- Setup lspconfig.
-- local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
-- require('lspconfig')['<YOUR_LSP_SERVER>'].setup {
-- capabilities = capabilities
-- }

local lspkind = require('lspkind')

local source_mapping = {
buffer = "[Buffer]",
nvim_lsp = "[LSP]",
nvim_lua = "[Lua]",
cmp_tabnine = "[TN]",
path = "[Path]",
}

require'cmp'.setup {
sources = {
{ name = 'cmp_tabnine' },
},
formatting = {
format = function(entry, vim_item)
vim_item.kind = lspkind.presets.default[vim_item.kind]
local menu = source_mapping[entry.source.name]
if entry.source.name == 'cmp_tabnine' then
if entry.completion_item.data ~= nil and entry.completion_item.data.detail ~= nil then
menu = entry.completion_item.data.detail .. ' ' .. menu
end
vim_item.kind = ''
end
vim_item.menu = menu
return vim_item
end
},
}

EOF

Error on first startup

I got this error when first install cmp-tabnine

...e/pack/packer/opt/cmp-tabnine/lua/cmp_tabnine/source.lua:197: attempt to index local 'ctx' (a nil value)

I'm using

NVIM v0.6.0-dev
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by nixbld1

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/nix/store/ql7v7cs2qmbr00s6qjkwp3wz2w0bz08a-neovim-unwrapped-master/share/nvim"

Run :checkhealth for more info

attempt to index field 'message' (a nil value)

The plugin stopped working after updating, with the following error message:

_tabnine/source.lua:273: attempt to index field 'message' (a nil value)
stack traceback:
^I...pack/packer/start/cmp-tabnine/lua/cmp_tabnine/source.lua:273: in function <...pack/packer/start/cmp-tabnine/lua/cmp_tabnine/source.lua:249>

The source line pointed:

elseif (response.message or ''):gmatch('http://127.0.0.1') then
Source.hub_url = response.message:match('.*(http://127.0.0.1.*)')

[Bug] The response content cannot be parsed because the Internet Explorer engine is not available

The bug occurs is in line 1 of install.ps1:

The response content cannot be parsed because the Internet Explorer engine is not available, or Internet Explorer's first-launch configuration is not complete. Specify the UseBasicParsing parameter and try again.

It can be fixed by using the -UseBasicParsing flag in line 1:

$version = iwr https://update.tabnine.com/bundles/version -UseBasicParsing

Debug logs & pro api token?

I have been trying to get this to work for a bit and I seem unable to. Is there a nice way to debug what's happening (I am getting no tabnine completion).

Also, what is the way to use the pro api token? I have read through the source and the term token, Token, TOKEN, do not seem to exist. Not sure where to go with it :) (And its not mentioned in the config.lua source code where I thought it would be).

Module 'cmp_tabnine.config' not found on Windows

I am creating this for the possible followers of Chris@Machine's Neovim from scratch. This will definitely happen to those who follow his guide and config.

Related to #11 but this time on Windows 10 after fixing #24 #31 #30 README was not updated.

On windows, plugin cannot be loaded and lazy-loader (impatient.vim) throws the following error ()
:

E5113: Error while calling lua chunk: ...ck\packer\start\impatient.nvim\lua\impatient\profile.lua:146: ...ck\packer\start\impatient.nvim\lua\impatient\profile.lua:146: module 'cmp_tabnine.config' not found:
no field package.preload['cmp_tabnine.config']No cache entry
no file 'C:\Users\myusername\scoop\apps\lua\current'
no file 'C:\Usersmyusername\scoop\apps\lua\current'
no file 'C:\Users\myusername\scoop\apps\lua\current'
stack traceback:
[C]: in function 'error'
...ck\packer\start\impatient.nvim\lua\impatient\profile.lua:146: in function 'require'
C:\Users\myusername\AppData\Local\nvim\init.lua:22: in main chunk

Not installable under FreeBSD

i have a problem to install this Package under FreeBSD. Under normal vim i can install coc-tabnine. But i want switch to Neovim, better features :-)

x86_64-unknown-linux-musl/TabNine' is not executable

I updated neovim to 0.6.1 today, TabNine started failing after that:

Error executing vim.schedule lua callback: Vim:E475: Invalid value for argument cmd: '/home/krion/.local/share/nvim/plugged/cmp-tabnine/
binaries/4.0.60/^[[4 qx86_64-unknown-linux-musl/TabNine' is not executable
stack traceback:
        [C]: in function 'jobstart'
        ...hare/nvim/plugged/cmp-tabnine/lua/cmp_tabnine/source.lua:234: in function '_on_exit'
        ...hare/nvim/plugged/cmp-tabnine/lua/cmp_tabnine/source.lua:135: in function 'new'
        .../share/nvim/plugged/cmp-tabnine/lua/cmp_tabnine/init.lua:8: in function <.../share/nvim/plugged/cmp-tabnine/lua/cmp_tabnine/i
nit.lua:7>

I ran /home/krion/.local/share/nvim/plugged/cmp-tabnine/install.sh manually but it didnt' help.
It's configured in neovim:

Plug 'tzachar/cmp-tabnine', { 'do': './install.sh' }
sources = {
{ name = 'cmp_tabnine' },
},

How to install in NvChad?

I can't figure out how to install this on NvChad perhaps someone who has the same problem can help me? This is what I've done:

-- NvChad/lua/custom/plugins/init.lua
return {
   ["tzachar/cmp-tabnine"] = {
      after = "cmp-path",
      config = function()
         require "custom.plugins.tabnine"
      end,
   },
}

-- NvChad/lua/custom/plugins/tabnine.lua
require('cmp_tabnine.config').setup({
   max_lines = 1000;
   max_num_results = 20;
   sort = true;
   run_on_every_keystroke = true;
   snippet_placeholder = '..';
   ignored_file_types = { -- default is not to ignore
           -- uncomment to ignore in lua:
           -- lua = true
   };
   show_prediction_strength = false;
})

-- NvChad/lua/custom/chardrc.lua
M.plugins = {
   override = {
      ["hrsh7th/nvim-cmp"] = {
         sources = {
            { name = "nvim_lsp" },
            { name = "luasnip" },
            { name = "buffer" },
            { name = "nvim_lua" },
            { name = "path" },
            { name = "cmp-tabnine" },
          },
      }
   }
}

Any reason why cmp-tabnine is so slow?

Hey, I'm using cmp-tabnine since a couple of days (I really love it) and I just realised that this plugin is taking many time to load when I start nvim. I just wanted to know if this was just a problem about my configuration or it's actually slow...

nvim --startuptime start.log:

511.439  160.493  160.493: sourcing C:\Users\Cyprien\AppData\Local\nvim-data\site\pack\packer\start\cmp-tabnine\after\plugin\cmp-tabnine.lua

(it takes 160ms to load)

Thank you and have a nice day! (:

Tabnine doesn't work on windows

I'm using windows, not WSL. I'm basically trying to install tabnine through this plugin. This is what I have in my plugins.lua file:

use { 'tzachar/cmp-tabnine', run='./install.sh', requires = 'hrsh7th/nvim-cmp' }

But I get this whenever I open a file:

image

Is there any solution to this?

Cursor in wrong location after inserting `Tabnine` completion items

For some time now, I've noticed the cursor doesn't move to the end of a tabnine completion insertion. This happens especially when the completion ends with a closing bracket or parenthesis like ) or }. I've attached a video that shows my problem. At first, I thought this was a nvim-cmp bug, but I notice this only happens with tabnine sources.

Video

tabninebug.mp4

Otherwise, insertion works properly, as long as the insertion doesn't end with a bracket or parenthesis.

Tabnine completes in prompt buffers

Hello, and thank you for this plugin.

cmp disables itself in buftype=prompt buffers, but this plugin doesn't seem to respect that for some reason. I use https://github.com/nvim-telescope/telescope.nvim and cmp-tabnine offers completions in the telescope prompt buffer. Do you have any idea why this might be happening?

" Setup global configuration. More on configuration below.
lua <<EOF
  local cmp = require('cmp')

  -- For Tab, S-Tab, and C-Space bindings that came from
  -- https://github.com/quangnguyen30192/cmp-nvim-ultisnips
  local t = function(str)
    return vim.api.nvim_replace_termcodes(str, true, true, true)
  end

  cmp.setup {
    snippet = {
      expand = function(args)
        vim.fn["UltiSnips#Anon"](args.body)
      end,
    },

    -- You must set mapping if you want.
    mapping = {
      ['<C-p>'] = cmp.mapping.select_prev_item(),
      ['<C-n>'] = cmp.mapping.select_next_item(),
      ['<C-d>'] = cmp.mapping.scroll_docs(-4),
      ['<C-f>'] = cmp.mapping.scroll_docs(4),
      ['<C-Space>'] = cmp.mapping.complete(),
      ['<C-e>'] = cmp.mapping.close(),
      ['<CR>'] = cmp.mapping.confirm({
        behavior = cmp.ConfirmBehavior.Replace,
        select = false,
      }),


      ["<C-Space>"] = cmp.mapping(function(fallback)
        if vim.fn.pumvisible() == 1 then
          if vim.fn["UltiSnips#CanExpandSnippet"]() == 1 then
            return vim.fn.feedkeys(t("<C-R>=UltiSnips#ExpandSnippet()<CR>"))
          end

          vim.fn.feedkeys(t("<C-n>"), "n")
        else
          fallback()
        end
      end, {
        "i",
        "s",
      }),
      ["<Tab>"] = cmp.mapping(function(fallback)
        if vim.fn["UltiSnips#CanJumpForwards"]() == 1 then
          vim.fn.feedkeys(t("<C-R>=UltiSnips#JumpForwards()<CR>"))
        elseif vim.fn.pumvisible() == 1 then
          vim.fn.feedkeys(t("<C-n>"), "n")
        else
          fallback()
        end
      end, {
        "i",
        "s",
      }),
      ["<S-Tab>"] = cmp.mapping(function(fallback)
        if vim.fn["UltiSnips#CanJumpBackwards"]() == 1 then
          return vim.fn.feedkeys(t("<C-R>=UltiSnips#JumpBackwards()<CR>"))
        elseif vim.fn.pumvisible() == 1 then
          vim.fn.feedkeys(t("<C-p>"), "n")
        else
          fallback()
        end
      end, {
        "i",
        "s",
      }),
    },

    -- You should specify your *installed* sources.
    sources = {
      { name = 'buffer' },
      { name = 'nvim_lsp' },
      { name = 'cmp_tabnine' },
      { name = 'path' },
      { name = 'calc' },
      { name = 'ultisnips' }
    },
  }

  local tabnine = require('cmp_tabnine.config')
  tabnine:setup({
    max_lines = 1000;
    max_num_results = 20;
    sort = true;
  })
EOF

" Setup buffer configuration (nvim-lua source only enables in Lua filetype).
autocmd FileType lua lua require'cmp'.setup.buffer {
\   sources = {
\     { name = 'buffer' },
\     { name = 'nvim_lua' },
\   },
\ }

Invalid value for argument cmd: is not executable

Hello all.

I'm really interested in using this plugin, but when I ran ./install.sh, I get this error message:

++ curl -sS https://update.tabnine.com/bundles/version
curl: (6) Could not result host: update.tabnine.com
+ version=

Can someone please help me?

How to open Tabnine Hub on a headless server?

I know run the command CmpTabnineHub actually starts an app listens on port 5555, I could use ssh port forwarding to access it. However, I think the hub needs to be accessed via localhost:5555/a-random-string, so without knowing the random string, the webapp doesn't load.

Could cmp-tabnine get response from tabnine server and print the connection string after running CmpTabnineHub?

Platform identification seems off for intel macs

Intel MacBook Air 2020 running Big Sur
Neovim 0.7.0
nvim-cmp
cmp-tabnine

Attempting to run the plugin (installed with vim plug) I got the following error:

Error detected while processing /Users/jsmith/.vim/plugged/cmp-tabnine/after/plugin/cmp-tabnine.lua:
E5113: Error while calling lua chunk: Vim:E475: Invalid value for argument cmd: '/Users/jsmith/.vim/plugged/cmp-tabnine/binaries/4.4.21/-apple-darwin/TabNine' is not executable
stack traceback:
        [C]: in function 'jobstart'
        ...mith/.vim/plugged/cmp-tabnine/lua/cmp_tabnine/source.lua:175: in function '_on_exit'
        ...mith/.vim/plugged/cmp-tabnine/lua/cmp_tabnine/source.lua:98: in function 'new'
        ...jsmith/.vim/plugged/cmp-tabnine/lua/cmp_tabnine/init.lua:7: in function 'setup'
        ...th/.vim/plugged/cmp-tabnine/after/plugin/cmp-tabnine.lua:1: in main chunk

Tracing out the file path to see if maybe it was just an issue of not having the executable bit set, I realized the path to the binary was missing the platform architecture, i.e. should be $HOME/.vim/plugged/cmp-tabnine/binaries/4.4.21/x86_64-apple-darwin/TabNine but the x86_64 was missing. I was able to "fix" the problem by hardcoding it in source.lua and now everything seems to work ok but I'm afraid I don't know lua or how it interfaces with the OS well enough to submit a fix.

'uname' command is not usually available in Windows

I get the following error in my Windows 10 machine during the plugin initialization:

Error executing vim.schedule lua callback: Vim:E475: Invalid value for argument cmd: 'uname' is not executable
stack traceback:
        [C]: in function 'system'
        ...e\pack\packer\opt\cmp-tabnine/lua/cmp_tabnine/source.lua:110: in function 'binary'
        ...e\pack\packer\opt\cmp-tabnine/lua/cmp_tabnine/source.lua:229: in function '_on_exit'
        ...e\pack\packer\opt\cmp-tabnine/lua/cmp_tabnine/source.lua:135: in function 'new'
        ...ite\pack\packer\opt\cmp-tabnine/lua/cmp_tabnine/init.lua:8: in function <...ite\pack\packer\opt\cmp-tabnine/lua/cmp_tabnine/init.lua:7>

As far as I know, the 'uname' command is only available on UNIX-like OSes and does not exist on Windows machines. It is probably a good idea to check for the OS before calling this command.

it doesn't work

image

Environment

Windows10 wsl(Ubuntu 20.04)
nvim 0.5 

configuration

lua <<EOF

  -- nvim-cmp setup
  local cmp = require 'cmp'
  cmp.setup {
    snippet = {
      expand = function(args)
        -- You must install `vim-vsnip` if you use the following as-is.
        vim.fn['vsnip#anonymous'](args.body)
      end,
    },
    mapping = {
      ['<C-p>'] = cmp.mapping.select_prev_item(),
      ['<C-n>'] = cmp.mapping.select_next_item(),
      ['<C-d>'] = cmp.mapping.scroll_docs(-4),
      ['<C-f>'] = cmp.mapping.scroll_docs(4),
      ['<C-Space>'] = cmp.mapping.complete(),
      ['<C-e>'] = cmp.mapping.close(),
    },
    sources = {
      { name = 'cmp_tabnine' },
      { name = 'nvim_lsp' },
      { name = 'buffer' },
    },
  }

  -- auto pairs
  require('nvim-autopairs').setup{}
  require("nvim-autopairs.completion.cmp").setup({
    map_cr = true, --map <CR> on insert mode
    map_complete = true, --it will auto insert `(` after select function or method item
  })

  -- tabnine
  local tabnine = require('cmp_tabnine.config')
  tabnine:setup({
    max_lines = 1000;
    max_num_results = 20;
    sort = true;
  })

  -- nvim lsp config
  local nvim_lsp = require('lspconfig')
  -- Use an on_attach function to only map the following keys
  -- after the language server attaches to the current buffer
  local on_attach = function(client, bufnr)
    local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
    local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end

    -- Enable completion triggered by <c-x><c-o>
    buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')

    -- Mappings.
    local opts = { noremap=true, silent=true }

    -- See `:help vim.lsp.*` for documentation on any of the below functions
    buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
    buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
    buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
    buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
    buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
    buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
    --buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
    --buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
    buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
    buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
    buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
    buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
    buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
    buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
    buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
    buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
    buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
  end

  -- Add additional capabilities supported by nvim-cmp
  local capabilities = vim.lsp.protocol.make_client_capabilities()
  capabilities.textDocument.completion.completionItem.snippetSupport = true
  capabilities.textDocument.completion.completionItem.preselectSupport = true
  capabilities.textDocument.completion.completionItem.insertReplaceSupport = true
  capabilities.textDocument.completion.completionItem.labelDetailsSupport = true
  capabilities.textDocument.completion.completionItem.deprecatedSupport = true
  capabilities.textDocument.completion.completionItem.commitCharactersSupport = true
  capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } }
  capabilities.textDocument.completion.completionItem.resolveSupport = {
    properties = {
      'documentation',
      'detail',
      'additionalTextEdits',
    },
  }

  -- lsp install 
  require'lspinstall'.setup() -- important
  local servers = require'lspinstall'.installed_servers()
  for _, server in pairs(servers) do
    nvim_lsp[server].setup{
      on_attach = on_attach,
      flags = {
        debounce_text_changes = 150,
      },
      capabilities = capabilities,
    }
  end

EOF

Result

Tabnine doesn't work

Updated formatting config

    formatting = {
        format = lspkind.cmp_format({
            mode = "symbol_text", -- options: 'text', 'text_symbol', 'symbol_text', 'symbol'
            maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)

            -- The function below will be called before any actual modifications from lspkind
            -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
            before = function(entry, vim_item)
                vim_item.kind = lspkind.presets.default[vim_item.kind]

                local menu = source_mapping[entry.source.name]

                if entry.source.name == "cmp_tabnine" then
                    if entry.completion_item.data ~= nil and entry.completion_item.data.detail ~= nil then
                        menu = entry.completion_item.data.detail .. " " .. menu
                    end
                    vim_item.kind = ""
                end

                vim_item.menu = menu

                return vim_item
            end,
        }),
    },

-apple-darwin/TabNine is not executable

Hello,

I have just encountered the following error after installing the plugin via Plug.

My config:

NVIM v0.6.0-dev+631-g72d62aa6a

mac osx 12.01

iterm build 3.4.12

Error message:

Error executing vim.schedule lua callback: Vim:E475: Invalid value for argument cmd: '/Users/martin/.loc
al/share/nvim/plugged/cmp-tabnine/binaries/4.0.9/-apple-darwin/TabNine' is not executable

I suspect there is a bug in creating the path to the binary. In my system, the following folder with binaries was created:

/.local/share/nvim/plugged/cmp-tabnine/binaries/4.0.9/x86_64-apple-darwin/

but the plugin is looking for:

/.local/share/nvim/plugged/cmp-tabnine/binaries/4.0.9/-apple-darwin/

So the workaround is simply rename

/x86_64-apple-darwin/

to

/-apple-darwin/

and the plugin is working after that. But I recommend to try lookup the bug.

I was looking into soruce file lines 74 and 84 and it seems looking fine to me.

The uname command is giving me correctly:

uname -m
x86_64

I dunno where the bug could be (if there is any). I suggest to investigate.

Selecting a complete entry does not delete the triggering keyword

After the selection is complete, the previous trigger keyword will be retained.

I am editing a markdown file, maybe it has something to do with the file type?

Below is the picture

Peek 2022-05-21 23-50

Below is my minimal configuration:

vim.opt.runtimepath:append("~/.local/share/nvim/site/pack/packer/opt/nvim-lspconfig")
vim.opt.runtimepath:append("~/.local/share/nvim/site/pack/packer/opt/nvim-cmp")
vim.opt.runtimepath:append("~/.local/share/nvim/site/pack/packer/opt/vim-vsnip")
vim.opt.runtimepath:append("~/.local/share/nvim/site/pack/packer/opt/cmp-vsnip")
vim.opt.runtimepath:append("~/.local/share/nvim/site/pack/packer/opt/cmp-tabnine")

vim.opt.termguicolors = true
vim.opt.cursorline = true
vim.opt.completeopt = "menu,menuone,noselect"

local cmp = require("cmp")

cmp.setup({
    snippet = {
        expand = function(args)
            vim.fn["vsnip#anonymous"](args.body)
        end,
    },
    sources = cmp.config.sources({
        { name = "vsnip" },
        { name = "nvim_lsp" },
        { name = "cmp_tabnine" },
    }),
    mapping = {
        ["<cr>"] = cmp.mapping(cmp.mapping.confirm(), { "i", "s", "c" }),
        ["<c-p>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "s", "c" }),
        ["<c-n>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "s", "c" }),
        ["<c-k>"] = cmp.mapping(function()
            if cmp.visible() then
                cmp.abort()
            else
                cmp.complete()
            end
        end, { "i", "s", "c" }),
    },
})

require("lspconfig").pyright.setup({
    flags = {
        debounce_text_changes = 150,
    },
})

vim.cmd([[runtime! after/plugin/*.lua]])

Missing configuration options in `tabnine::config`

Do you know why there are missing configuration options in tabnine::config when using nvim as opposed to say vscode? I no longer see options like multiline suggestions or inline completions when using nvim. I remember being able to use multiline suggestions with the older compe-tabnine. Now this is no longer possible.

Error: aarch64-apple-darwin/TabNine is not executable

I'm getting this error when I open neovim in the terminal.

Error executing vim.schedule lua callback: Vim:E475: Invalid value for argument cmd: '/Users/aricjiang/.local/share/nvim/site/pack/packer/start/cmp-tabnine/binaries
/4.0.59/aarch64-apple-darwin/TabNine' is not executable
stack traceback:
[C]: in function 'jobstart'
...pack/packer/start/cmp-tabnine/lua/cmp_tabnine/source.lua:234: in function '_on_exit'
...pack/packer/start/cmp-tabnine/lua/cmp_tabnine/source.lua:135: in function 'new'
...e/pack/packer/start/cmp-tabnine/lua/cmp_tabnine/init.lua:8: in function <...e/pack/packer/start/cmp-tabnine/lua/cmp_tabnine/init.lua:7>

ENVIRONMENT:
Mac OS Monterey Version 12.0.1 Apple M1 Pro

Error while trying to install cmp-tabnine

Hey, I tried to install this plugin but when I open vim, I have this error : cmp-tabnine: Cannot find installed TabNine. Please run install.sh So I executed install.sh this way : bash install.sh and I have this error :

install.sh: line 2: $'\r': command not found
: invalid option nameet: errexit
: invalid option nameet: pipefail
: invalid option 7: set: -
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
install.sh: line 8: $'\r': command not found
install.sh: line 9: curl: command not found
install.sh: line 10: $'\r': command not found
install.sh: line 11: syntax error near unexpected token `$'in\r''
'nstall.sh: line 11: `case $(uname -s) in

I am on Windows 10. Thank you and have a good day

Error when trying to enter insert mode

When entering insert mode or using fzf, I get the following error:

Error executing vim.schedule lua callback: Vim:E475: Invalid value for argument cmd: '/home/pilchh/.local/share/nvim/site/pack/packer/opt/cmp-tabnine/binaries/4.4.10/x86_64-unknown-linux-musl/TabNine' is not executable
stack traceback:
        [C]: in function 'jobstart'
        ...e/pack/packer/opt/cmp-tabnine/lua/cmp_tabnine/source.lua:234: in function '_on_exit'
        ...e/pack/packer/opt/cmp-tabnine/lua/cmp_tabnine/source.lua:135: in function 'new'
        ...ite/pack/packer/opt/cmp-tabnine/lua/cmp_tabnine/init.lua:8: in function <...ite/pack/packer/opt/cmp-tabnine/lua/cmp_tabnine/init.lua:7>

I am using the same config I have used previously with no issues on a native arch build but I get this error when attempting to use it in WSL 2.

Errors frequently as of recent

NeoVim Version:

NVIM v0.7.0-dev+653-g7229afcd6
Build type: Debug
LuaJIT 2.1.0-beta3

Error:

Error detected while processing TextChangedI Autocommands for "*":
E5108: Error executing lua Vim:E900: Invalid channel id
stack traceback:
        [C]: in function 'chansend'
        ...lson/.vim/plugged/cmp-tabnine/lua/cmp_tabnine/source.lua:154: in function '_do_complete'
        ...lson/.vim/plugged/cmp-tabnine/lua/cmp_tabnine/source.lua:164: in function 'complete'
        /home/mpaulson/.vim/plugged/nvim-cmp/lua/cmp/source.lua:290: in function 'complete'
        /home/mpaulson/.vim/plugged/nvim-cmp/lua/cmp/core.lua:246: in function 'complete'
        /home/mpaulson/.vim/plugged/nvim-cmp/lua/cmp/core.lua:164: in function 'callback'
        /home/mpaulson/.vim/plugged/nvim-cmp/lua/cmp/core.lua:214: in function 'autoindent'
        /home/mpaulson/.vim/plugged/nvim-cmp/lua/cmp/core.lua:156: in function 'on_change'
        /home/mpaulson/.vim/plugged/nvim-cmp/lua/cmp/init.lua:302: in function 'callback'
        ...mpaulson/.vim/plugged/nvim-cmp/lua/cmp/utils/autocmd.lua:31: in function 'emit'
        [string ":lua"]:1: in main chunk

I see this error get spammed every now and then. Effectively it wont happen for 5 minutes, then i'll get the error 15 times in a row. Love tabnine though :). Thanks for the plugin too.

Linux binary seems to be not available at the moment

Here is the result of install script

❯ ./install.sh
++ curl -sS https://update.tabnine.com/bundles/version
+ version=4.1.16
+ case $(uname -s) in
++ uname -s
++ uname -m
+ platform=aarch64-unknown-linux-musl
++ dirname ./install.sh
+ cd .
+ path=4.1.16/aarch64-unknown-linux-musl
+ curl https://update.tabnine.com/bundles/4.1.16/aarch64-unknown-linux-musl/TabNine.zip --create-dirs -o binaries/4.1.16/aarch64-unknown-linux-musl/TabNine.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   454  100   454    0     0   1568      0 --:--:-- --:--:-- --:--:--  1570
+ unzip -o binaries/4.1.16/aarch64-unknown-linux-musl/TabNine.zip -d binaries/4.1.16/aarch64-unknown-linux-musl
Archive:  binaries/4.1.16/aarch64-unknown-linux-musl/TabNine.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of binaries/4.1.16/aarch64-unknown-linux-musl/TabNine.zip or
        binaries/4.1.16/aarch64-unknown-linux-musl/TabNine.zip.zip, and cannot find binaries/4.1.16/aarch64-unknown-linux-musl/TabNine.zip.ZIP, period.

Response to https://update.tabnine.com/bundles/4.1.16/aarch64-unknown-linux-musl/TabNine.zip is below

403 Forbidden
Code: AccessDenied
Message: Access Denied
RequestId: MRPP6SP3NJF55TNM
HostId: 7eOmDt2wDY8tnFTJGt56Mb85nQPBIZqbgX5FI0fkJ3jvQAJRbcJvZp1zxPSN/YrjhjBUwouLgtI=
An Error Occurred While Attempting to Retrieve a Custom Error Document
Code: AccessDenied
Message: Access Denied

The URL for mac platform works though.

Error on startup

My setup is similar to this gist. However, I am getting following error on startup.

Error in packer_compiled: ...pack/packer/start/cmp-tabnine/lua/cmp_tabnine/source.lua:53: attempt to index local 'latest' (a nil value)
Please check your config for correctness
Error detected while processing /home/mayank/.local/share/nvim/site/pack/packer/start/cmp-tabnine/after/plugin/cmp-tabnine.lua:
E5113: Error while calling lua chunk: ...pack/packer/start/cmp-tabnine/lua/cmp_tabnine/source.lua:53: attempt to index local 'latest' (a nil value
)

How to disable tabnine in Telescope?

image

my config:

local tabnine = require('cmp_tabnine.config')
tabnine:setup({
    max_lines = 1000;
    max_num_results = 20;
    sort = true;
    run_on_every_keystroke = true;
    snippet_placeholder = '..';
    ignored_file_types = { -- default is not to ignore
    "TelescopePrompt",          -- not working.

    };
})

x86_64-apple-darwin/TabNine is not executable

Intel macbook 2020 running Monterey
NVIM v0.8.0-dev
nvim-cmp
cmp-tabnine.
output of uname -m is x86_64

Opening nvim I get:

Error executing vim.schedule lua callback: Vim:E475: Invalid value for argument cmd: '/Users/jsanders/.lo
cal/share/nvim/site/pack/packer/start/cmp-tabnine/binaries/4.4.118/x86_64-apple-darwin/TabNine' is not ex
ecutable
stack traceback:
        [C]: in function 'jobstart'
        ...pack/packer/start/cmp-tabnine/lua/cmp_tabnine/source.lua:240: in function '_on_exit'
        ...pack/packer/start/cmp-tabnine/lua/cmp_tabnine/source.lua:141: in function 'new'
        ...e/pack/packer/start/cmp-tabnine/lua/cmp_tabnine/init.lua:8: in function <...e/pack/packer/star
t/cmp-tabnine/lua/cmp_tabnine/init.lua:7>

So I ran the install script manually getting:

++ curl -sS https://update.tabnine.com/bundles/version
+ version=4.4.118
+ case $(uname -s) in
++ uname -s
++ arch
+ '[' i386 == arm64 ']'
++ arch
+ platform=i386-apple-darwin
++ dirname ./install.sh
+ cd .
+ path=4.4.118/i386-apple-darwin
+ curl https://update.tabnine.com/bundles/4.4.118/i386-apple-darwin/TabNine.zip --create-dirs -o binaries/4.4.118/i386-apple-darwin/TabNine.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   454  100   454    0     0   2951      0 --:--:-- --:--:-- --:--:--  3131
+ unzip -o binaries/4.4.118/i386-apple-darwin/TabNine.zip -d binaries/4.4.118/i386-apple-darwin
Archive:  binaries/4.4.118/i386-apple-darwin/TabNine.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of binaries/4.4.118/i386-apple-darwin/TabNine.zip or
        binaries/4.4.118/i386-apple-darwin/TabNine.zip.zip, and cannot find binaries/4.4.118/i386-apple-darwin/TabNine.zip.ZIP, period.

I then tried opening the zip file through different means (other than unzip):
jar, the unarchiver.. yet I still received this error message. Wouldn't unzip.

=> My workaround was to replace the install script with shougo's install script for deoplete-tabnine here and running it.

after that, the binary appeared and everything worked

Putting this here in case anyone has the same problem/perhaps the author would find this useful

attempt to call field 'nvim_add_user_command' (a nil value)

Just updated the plugin and, when I open Neovim I got this error

Error executing vim.schedule lua callback: ...e/pack/packer/start/cmp-tabnine/lua/cmp_tabnine/init.lua:10: attempt to call field 'nvim_add_user_command' (a nil value)                                                                          
stack traceback:                                                                                                                                                                                                                                
        ...e/pack/packer/start/cmp-tabnine/lua/cmp_tabnine/init.lua:10: in function <...e/pack/packer/start/cmp-tabnine/lua/cmp_tabnine/init.lua:7> 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.