sungo.io

About - RSS - Code

Emacs + gopls = 100% cpu

I’m a go developer and a while back I tried to switch from neovim to doom emacs. As is my way, I tried to use lsp and gopls. Lo and behold, gopls started chewing up an entire core and emacs was trying its best. emacs didn’t totally lock up but it did get sluggish as hell. I searched for solutions but the global response was “shrug. doesn’t happen to me” or “eglot and tree-stitter are coming! they’ll be better!” siiiiiiigh. So I put it down and went back to neovim for code development.

Now, for reasons, I’m trying emacs again, this time building my config myself, rather than relying on a framework like doom. Same problem. So it wasn’t doom’s fault. The internet answers were still the same so I started turning stuff on and off to find the problem. And I finally found it.

(setq lsp-semantic-tokens-enable t)

I copied that config line from god knows during my initial setup. Getting rid of that line stopped the cpu burn problem with no noticeable side effects.