tzachar / cmp-tabnine

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

Spawning many tabnine processes #73

Closed lopi-py closed 1 year ago

lopi-py commented 1 year ago

I just have one file open and sometimes I open others but I delete that buffers and then there is one left but tabnine processes seems not killed and causes slowdowns in my entire computer. image (There are more processes not shown in the screenshot) btw: when I exit neovim, all process get killed. Also I get this everytime I want to enter the hub: image

Details

os: Windows nvim version: NVIM v0.9.0-dev-55-gedc8a1f04 nvim gui: Neovide 0.10.1

tzachar commented 1 year ago

This plugin opens up a new tabnine process only in the following cases: 1) when starting a new instance of neovim 2) when there was an error communicating with the running tabnine process Tabnine itself is prone to open new instances, especially when updating to a newer version (tabnine does that itself).

try running with the following patch, and lets see if the plugin is the culprit:

diff --git a/lua/cmp_tabnine/source.lua b/lua/cmp_tabnine/source.lua                             
index 329b212..2d8cb97 100644                                                                    
--- a/lua/cmp_tabnine/source.lua                                                                 
+++ b/lua/cmp_tabnine/source.lua                                                                 
@@ -270,6 +270,7 @@ function Source.on_exit(self, job, code)                                     
   end                                                                                           
   self.tabnine_version = version                                                                
   self.pending = {}                                                                             
+  dump('starting a new tabnine process. reason:', code)                                         
   self.job = fn.jobstart({ bin, '--client=cmp.vim' }, {                                         
     on_stderr = nil,                                                                            
     on_exit = function (j, c, _) self:on_exit(j, c) end,                                        

I would also try to disable the cloud option and see if it helps.

lopi-py commented 1 year ago

Thanks, I'll try but I can't disable cloud because of the above capture, I get it everytime I want to access the hub

lopi-py commented 1 year ago

I can't reproduce now the multiple instances but I found that at startup, 2 are spawned: image I guess that only 1 should be spawned.

Also I'm getting delay when typing, but seems related to tabnine maybe? My pc isn't too good, thats I why use cloud but it's weird anyway image

lopi-py commented 1 year ago

Something like a keystroke debounce may help?

Edit: Ok, I noticed that I should use require("cmp_tabnine.config").setup" instead of require("cmp_tabnine").setup, now one instance is spawned

tzachar commented 1 year ago

Something like a keystroke debounce may help?

This can be set in cmp.

Edit: Ok, I noticed that I should use require("cmp_tabnine.config").setup" instead of require("cmp_tabnine").setup, now one instance is spawned

yes, the second one is internal to cmp. you should use the first option

lopi-py commented 1 year ago

Seems more related to tabnine than this plugin, but I still can't access the hub

alechp commented 1 year ago

@lopi-py try running :CmpTabnineHubUrl and clicking the link.

Running CmpTabnineHub prefixes with Tabnine's actual website, which doesn't work

What I see when I run :CmpTabnineHub: Screen Shot 2022-10-14 at 1 41 30 PM

What I see when I run :CmpTabnineHubUrl (and click the link that pops up via vim-notify): Screen Shot 2022-10-14 at 1 54 07 PM

Screen Shot 2022-10-14 at 1 54 12 PM

lopi-py commented 1 year ago

@alechp Ah thanks! I'm able to enter the hub, closing this since its related to tabnine

alechp commented 1 year ago

@lopi-py Just checked and default link generated by :CmpTabnineHub breaks when using Brave. Tested in Firefox and it works fine without the URL workaround

Tabnine docs: https://support.tabnine.com/hc/en-us/articles/9115214579601-Tabnine-hub-is-showing-Lost-conenction-Please-reopen-the-Tabnine-Hub-

What I see in Brave: Screen Shot 2022-10-16 at 1 14 17 PM

What I see in Firefox: Screen Shot 2022-10-16 at 1 13 59 PM

Another oddity of the Brave bug is that it throws an erroneous "Please verify your email" notice (even after having verified email)

lopi-py commented 1 year ago

@alechp Oh, I was using brave too, I just tried with opera and it works, thanks for the info 😄