Closed ddaniel27 closed 1 month ago
Could you share more info, e.g. the sample project and the LSP you are using?
Yeah, I can provide you with a sample project A backend project. There is nothing special, just a backend. This is also happening with my company repositories (that unfortunately I can't give you a repo to see), but all are just normal go projects with small/medium/large code base.
I'm using gopls
as my lsp
$ gopls version
golang.org/x/tools/gopls v0.15.2
This is my lsp config for navigator
lsp = {
format_on_save = false,
code_action = {
enable = true,
},
code_lens_action = {
enable = false,
},
gopls = {
settings = {
gopls = {
usePlaceholders = false,
},
},
},
},
I don't know if there is more relevant info that I can share with you, just let me know and I'll be happy to help
Hey, I've been trying to troubleshooting this a little bit, I just want to share with you some useful info that I found. I wrote some logs to debug and this is what I found:
Actual logs
6 branch - Elapsed time: 19.487ms - Memory diff: 839.413KB - Initial Memory: 10597.967KB
6 branch - Elapsed time: 9.103ms - Memory diff: 138.247KB - Initial Memory: 9182.038KB
6 branch - Elapsed time: 10.009ms - Memory diff: 125.786KB - Initial Memory: 14681.901KB
6 branch - Elapsed time: 13.346ms - Memory diff: 119.091KB - Initial Memory: 9999.645KB
6 branch - Elapsed time: 21.183ms - Memory diff: 121.657KB - Initial Memory: 9475.389KB
6 branch - Elapsed time: 40.083ms - Memory diff: 127.700KB - Initial Memory: 17122.500KB
6 branch - Elapsed time: 66.202ms - Memory diff: 118.622KB - Initial Memory: 8826.390KB
6 branch - Elapsed time: 119.110ms - Memory diff: 119.845KB - Initial Memory: 14993.913KB
6 branch - Elapsed time: 253.276ms - Memory diff: 125.759KB - Initial Memory: 16297.065KB
6 branch - Elapsed time: 343.913ms - Memory diff: -2070.076KB - Initial Memory: 10943.944KB
6 branch - Elapsed time: 552.294ms - Memory diff: 123.173KB - Initial Memory: 9505.059KB
6 branch - Elapsed time: 876.451ms - Memory diff: 118.388KB - Initial Memory: 11226.063KB
Now, this seems to be related with the lsp communication or something like that because it's happening even when I only open go files without jumping with the definition function or a preview function. Only opening using nvim-tree :(
I am surprised about the memory usage. On my laptop it stay 0.1~0.5% using the sample project (16GB M3) after I jump between files for 5mins.
The plugin will communicate with gopls in background when file updated/open and it should stop communication when things are stable.
How many files are opened? are there any large system/lib files? e.g. when I open fmt/printer.go
the memory will jump to 0.8% and once I close it it will back to 0.2% after a few secs.
Hi, I'm updating this. I downloaded your dotfiles for nvim (pretty neat btw) and all work fine. I've been jumping through all the project (even the echo files) and nothing lags. I think it should be something related with my config (?) so I think I can close this.
Big thanks for your help and your amazing plugin. I'm gonna try to find what in my config is lagging my nvim haha.
EDIT: Actually I found the lag origin, I have the following maps in my nvim config
vim.api.nvim_command([[
autocmd FileType go nmap <buffer> <F3> :GoTestFunc<CR>
autocmd FileType go nmap <buffer> <F2> :GoCoverage -p <CR>
autocmd FileType go nmap <buffer> <F5> :DapToggleBreakpoint<CR>
autocmd FileType go nmap <buffer> <F7> :DapStepInto<CR>
autocmd FileType go nmap <buffer> <F8> :DapStepOver<CR>
autocmd FileType go nmap <buffer> <F9> :DapStepOut<CR>
autocmd FileType go nmap <buffer> <F12> :DapUiToggle<CR>:DapContinue<CR>
]])
vim.api.nvim_command([[
autocmd FileType tex nmap <buffer> <F3> :VimtexCompile<CR>
]])
So, for some reason this is causing the lag (maybe many autocmd
) and because I mainly work on go, I thought was navigator with the lsp the lag reason. My most sincere apologies for this :)
Again, amazing plugin and thanks for give me some support through this!
Hi, I've used your plugin for a long time and I really love it. I have a problem here that I hope we can be able to solve. I've saw that after some mins (~30 mins) neovim starts to lagging when change window/buffer/tab, go to a definition, implementation, so on. I tried to debug it turning on/off plugins. That brings me here. I notice that when I use something related with navigator, my RAM usage starts to raise. I was able to replicate the lag behavior in two machines (Mac M3, Arch linux x86), just jumping through definitions. Even jumping between two files, it took like 10 jumps to start lagging.
So basically, navigator isn't freeing memory, it's allocating more memory at a point that neovim just freezes several seconds just to switch windows.
With 15 jumps With 20 jumps This seems to be exponential.
This happened using go files. Files that doesn't have a lsp (or something that helps to get definitions/go to files) installed like lua is fine. Neovim version
Also happened with versions 0.9.X both machines.
Please forget any redaction mistakes, I'm tired debugging this all night. I hope this can help to get a fix or if you can point any potential place to do the fix, I'll be happy to help trying to fix it.