Closed steinbrueckri closed 3 years ago
Can you try to apply this patch?
diff --git a/lua/compe_tabnine/init.lua b/lua/compe_tabnine/init.lua
index 76c783f..41fd4f6 100644
--- a/lua/compe_tabnine/init.lua
+++ b/lua/compe_tabnine/init.lua
@@ -40,8 +40,8 @@ function Source.get_metadata(_)
menu = '[TN]';
-- by default, do not sort
sort = false;
- max_lines = (vim.g.compe and vim.g.compe.source.tabnine.max_line) or 1000;
- max_num_results = (vim.g.compe and vim.g.compe.source.tabnine.max_num_results) or 20;
+ max_lines = (vim.g.compe and vim.g.compe.source.tabnine and vim.g.compe.source.tabnine.max_line) or 1000;
+ max_num_results = (vim.g.compe and vim.g.compe.source.tabnine and vim.g.compe.source.tabnine.max_num_results) or 20;
}
end
ok, a bit more verbose now:
diff --git a/lua/compe_tabnine/init.lua b/lua/compe_tabnine/init.lua
index 76c783f..72ea694 100644
--- a/lua/compe_tabnine/init.lua
+++ b/lua/compe_tabnine/init.lua
@@ -32,6 +32,19 @@ local Source = {
callback = nil;
}
+local function istable(t)
+ return type(t) == 'table'
+end
+
+local function has_conf(key, default)
+ if vim.g.compe and vim.g.compe.source and vim.g.compe.source.tabnine then
+ if istable(vim.g.compe.source.tabnine) then
+ return vim.g.compe.source.tabnine[key]
+ end
+ end
+ return default
+end
+
--- get_metadata
function Source.get_metadata(_)
return {
@@ -40,8 +53,8 @@ function Source.get_metadata(_)
menu = '[TN]';
-- by default, do not sort
sort = false;
- max_lines = (vim.g.compe and vim.g.compe.source.tabnine.max_line) or 1000;
- max_num_results = (vim.g.compe and vim.g.compe.source.tabnine.max_num_results) or 20;
+ max_lines = has_conf('max_line', 1000);
+ max_num_results = has_conf('max_num_results', 20);
}
end
Do you need more input from me? BTW: Maybe it makes more sense if you just open a new branch for you fixed and I just pull the branch.
ok, try this branch: https://github.com/tzachar/compe-tabnine/tree/fix_%235
Its strange as the bug above never happened on my machine. BTW, do you get the proper binaries downloaded?
@tzachar now it's working 🙌
BTW:
md5sum binaries/TabNine_Darwin
a2eb4c093999abc2695d87eae2edc5dd binaries/TabNine_Darwin
fixed in 0739a25
Hi Guys, I followed the "install guide" in the readme.:
Plug 'tzachar/compe-tabnine', { 'do': './install.sh' }
let g:compe.source.tabnine = v:true
and I get this error.:
OS: Darwin anubis 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64 nvim:
Br Richard