Neovim-from-scratch icon indicating copy to clipboard operation
Neovim-from-scratch copied to clipboard

High CPU Usage w/ Sumneko Lua

Open jonleopard opened this issue 2 years ago • 2 comments

Been following along your great series over at youtube. I noticed when editing .lua files, the neovim gets very sluggish and my CPU fans start to whirl up. I checked the LSP logs and this showed up:

 [WARN][2022-03-04 11:00:21] .../lua/vim/lsp.lua:751 "server_request: no handler found for"  "workspace/semanticTokens/refresh"

Here's a look at the process, it stays at 99.5% as long as the .lua buffer is open: Screenshot 2022-03-04 at 15 07 53

Any ideas?

jonleopard avatar Mar 04 '22 22:03 jonleopard

Unsure of if this will help you out, but I was suffering from workspaces never being able to fully load, and lua-language-server using 100%+ cpu as well as multiple gigabytes of ram as i left it running for longer. I delved a bit into the problem, and this post led me to looking through the default server configuration located at ~/.local/share/nvim/site/pack/packer/start/nvim-lspconfig/lua/lspconfig/server_configurations/sumneko_lua.lua.

The tl;dr is that sumneko will recursively go to parent directories until it sees certain files which it uses to determine the scope of a project. If you're following along by hand and manually copying files (like I was) there's no .git folder that sumneko will find and as a result it will keep trying to pull in more and more code to parse. So I made a new git project in ~/.config/nvim/ and now the cpu and ram usage are much more reasonable. I hope this helps because this was giving me a lot of headaches over the last couple of days too!

sazro89 avatar Apr 25 '22 19:04 sazro89

Thank you so much for the write-up @sazro89 ! While it didn't solve my problem, you've definitely put me on the right trail.

Cheers :)

jonleopard avatar May 03 '22 21:05 jonleopard