Closed lopi-py closed 2 years ago
This is very strange. It indicates a bug somewhere in the communication to the TabNine process. Does it continue to happen after a while?
Yes, now that I see it well, it seems that it only does it on the first keystroke when typing a word
Can you try updating the tabnine executable?
Still is happening
can you apply the following patch and send the output?
diff --git a/lua/cmp_tabnine/source.lua b/lua/cmp_tabnine/source.lua
index fb42c38..402dd03 100644
--- a/lua/cmp_tabnine/source.lua
+++ b/lua/cmp_tabnine/source.lua
@@ -274,7 +274,8 @@ Source._on_stdout = function(_, data, _)
elseif id == nil then
-- ignore this message
elseif Source.pending[id] == nil then
- dump('TabNine: unknown message: ', jd)
+ dump('TabNine: unknown id:', id, ', message:', jd)
+ dump('Pending:', Source.pending)
else
local ctx = Source.pending[id].ctx
local callback = Source.pending[id].callback
:messages
"TabNine: unknow id:" 12 ", message:" '{"old_prefix":"l","results":[{"new_prefix":"languages","old_suffix":"","new_suffix":"","origin":"VANILLA"},{"new_prefix":"local","old_suffix":"","new_suffix":"","origin":"VANILLA"},{"new_prefix":"linters","old_suffix":"","new_suffix":"","origin":"VANILLA"},{"new_prefix":"list_extend","old_suffix":"","new_suffix":"","origin":"VANILLA"},{"new_prefix":"lua","old_suffix":"","new_suffix":"","origin":"VANILLA"}],"user_message":["Establishing connection to TabNine Cloud..."],"docs":[],"correlation_id":12,"is_locked":false}'
"Pending:" {
[22] = {
callback = <function 1>,
ctx = {
completion_context = {
triggerKind = 3
},
context = {
bufnr = 1,
cache = {
entries = {
["get_offset:\\%(-\\?\\d\\+\\%(\\.\\d\\+\\)\\?\\|\\h\\w*\\%(-\\w*\\)*\\):lo"] = 1
},
<metatable> = {
__index = <1>{
clear = <function 2>,
ensure = <function 3>,
get = <function 4>,
key = <function 5>,
new = <function 6>,
set = <function 7>
}
}
},
cursor = {
character = 2,
col = 3,
line = 8,
row = 9
},
cursor_after_line = "",
cursor_before_line = "lo",
cursor_line = "lo",
filetype = "lua",
id = 22,
option = {},
prev_context = {
bufnr = 1,
cache = {
entries = {
["get_offset:\\%(-\\?\\d\\+\\%(\\.\\d\\+\\)\\?\\|\\h\\%(\\w\\|á\\|Á\\|é\\|É\\|í\\|Í\\|ó\\|Ó\\|ú\\|Ú\\)*\\%(-\\%(\\w\\|á\\|Á\\|é\\|É\\|í\\|Í\\|ó\\|Ó\\|ú\\|Ú\\)*\\)*\\):l"] = 1,
["get_offset:\\%(-\\?\\d\\+\\%(\\.\\d\\+\\)\\?\\|\\h\\w*\\%(-\\w*\\)*\\):l"] = 1,
["get_offset:\\%([^[:alnum:][:blank:]]\\|\\w\\+\\):l"] = 1
},
<metatable> = {
__index = <table 1>
}
},
cursor = {
character = 1,
col = 2,
line = 8,
row = 9
},
cursor_after_line = "",
cursor_before_line = "l",
cursor_line = "l",
filetype = "lua",
id = 12,
option = {
reason = "auto"
},
prev_context = {
bufnr = 1,
cache = {
entries = {},
<metatable> = {
__index = <table 1>
}
},
cursor = {
character = 0,
col = 1,
line = 8,
row = 9
},
cursor_after_line = "",
cursor_before_line = "",
cursor_line = "",
filetype = "lua",
id = 11,
option = {
reason = "auto"
},
time = 761083334
},
time = 761084203,
<metatable> = {
__index = <2>{
changed = <function 8>,
clone = <function 9>,
empty = <function 10>,
get_offset = <function 11>,
get_reason = <function 12>,
new = <function 13>
}
}
},
time = 761087336,
<metatable> = {
__index = <table 2>
},
},
name = "cmp_tabnine",
offset = 1,
option = {}
}
}
}
This indicates that TabNine is retuning the same completion result twice. Lets try the following to make sure:
diff --git a/lua/cmp_tabnine/source.lua b/lua/cmp_tabnine/source.lua
index fb42c38..69cf2cc 100644
--- a/lua/cmp_tabnine/source.lua
+++ b/lua/cmp_tabnine/source.lua
@@ -220,6 +220,7 @@ function Source.complete(self, ctx, callback)
callback()
return
end
+ dump('pushing id:', ctx.context.id)
Source.pending[ctx.context.id] = { ctx = ctx, callback = callback }
Source._do_complete(ctx)
end
@@ -235,6 +236,7 @@ Source._on_exit = function(self, code)
if not bin then
return
end
+ dump('clearing ids')
Source.pending = {}
Source.job = fn.jobstart({ bin, '--client=cmp.vim' }, {
on_stderr = nil,
@@ -274,10 +276,11 @@ Source._on_stdout = function(_, data, _)
elseif id == nil then
-- ignore this message
elseif Source.pending[id] == nil then
- dump('TabNine: unknown message: ', jd)
+ dump('TabNine: unknown id:', id, ', message:', jd)
else
local ctx = Source.pending[id].ctx
local callback = Source.pending[id].callback
+ dump('poping id:', id)
Source.pending[id] = nil
local cursor = ctx.context.cursor
+ dump('TabNine: unknown id:', id, ', message:', jd) + dump('Pending:', Source.pending)
Happens to me also. I changed the files for your request, here are the messages:
"clearing ids"
"clearing ids"
"pushing id:" 67
"pushing id:" 67
"poping id:" 67
"TabNine: unknown id:" 67 ", message:" '{"old_prefix":"","results":[{"new_prefix":"Install","old_suffix":"","new_suffix":"","origin":"LOCAL","detail":"51%"},{"new_prefix":"Install packer","old_suffix":"","new_suf
fix":"","origin":"LOCAL","detail":" 6%"},{"new_prefix":"Install pack","old_suffix":"","new_suffix":"","origin":"LOCAL","detail":" 6%"},{"new_prefix":"Install package","old_suffix":"","new_suffix":"","origin":"LOC
AL","detail":" 3%"},{"new_prefix":"Install site","old_suffix":"","new_suffix":"","origin":"LOCAL","detail":" 2%"}],"user_message":[],"docs":[],"correlation_id":67,"is_locked":false}'
"Pending:" {}
can you please try f2ea9c0 ? it should solve the problem.
can you please try f2ea9c0 ? it should solve the problem.
Definitely helped. Waiting for this to be merged :) Thank you @tzachar !
Lets use it for a couple of days, if there are no issues, I will merge it.
Lets use it for a couple of days, if there are no issues, I will merge it.
sure.
merged. thanks for your help
Sorry delay. Yep that works, tysm
Hello! just installed and get this every keystroke, completion works good, however this is annoying OS: Windows 10