Closed bilucodota closed 2 years ago
can you please apply the following patch on top of your PR?
diff --git a/lua/cmp_tabnine/init.lua b/lua/cmp_tabnine/init.lua
index f8e05d9..ef0b25d 100644
--- a/lua/cmp_tabnine/init.lua
+++ b/lua/cmp_tabnine/init.lua
@@ -5,9 +5,11 @@ local M = {}
M.setup = function()
vim.schedule(function()
- tabnine_source = source.new()
+ local tabnine_source = source.new()
cmp.register_source('cmp_tabnine', tabnine_source)
- vim.cmd [[command! CmpTabnineHub lua tabnine_source.open_tabnine_hub()]]
+ vim.api.nvim_add_user_command('CmpTabnineHub', function()
+ tabnine_source:open_tabnine_hub()
+ end, { force = true })
end)
end
diff --git a/lua/cmp_tabnine/source.lua b/lua/cmp_tabnine/source.lua
index 301b82a..a16ab71 100644
--- a/lua/cmp_tabnine/source.lua
+++ b/lua/cmp_tabnine/source.lua
@@ -136,24 +136,17 @@ function Source.new()
return self
end
-
-Source.open_tabnine_hub = function()
+Source.open_tabnine_hub = function(self)
local req = {}
req.version = '3.3.0'
req.request = {
Configuration = {
- quiet = false
+ quiet = false,
},
}
- local bin = binary()
- if not bin then
- return
- end
-
- local hub = fn.jobstart({ bin, '--client=cmp.vim' })
-
- pcall(fn.chansend, hub, fn.json_encode(req) .. '\n')
+ -- pcall(fn.chansend, hub, fn.json_encode(req) .. '\n')
+ pcall(fn.chansend, self.job, fn.json_encode(req) .. '\n')
end
Source.is_available = function()
Also, can you add something in the README?
@tzachar done
Thank you for your patience :)
I'm using version of nvim 0.6.1 - and this line cause a nil exception:
vim.api.nvim_add_user_command('CmpTabnineHub',
the nvim_add_user_command doesn't exists at vim.api - is this my local issue ?
This was introduced lately, in nvim 0.7. I'll change it to be backwards compatible.
@marcinmaciukiewicz should be solved now.
yep, it's working - I'm using last stable - since 0.7 had some performance issues
Hi @tzachar
Thanks for maintaining this plugin!
Please check out this PR - I've added a command to open Tabnine Hub - as this is requested by many of our users. I'm not a lua developer nor a cmp user. So good chance I've made it completely wrong.
Feel free to change anything if needed.
Thanks!