this post was submitted on 27 Nov 2023
1 points (100.0% liked)

Emacs

305 readers
1 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

Hey there,

So I know if emacs is lagging I should run the profiler for a bit while it's lagging and then review the report. However, I'm not sure what to do next.

It looks clear that company / completion is responsible for the laggy behavior here, especially a jsonrpc-request made by completion. That makes sense, there's a slow network call somewhere in the works that's gumming things up.

I'm using eglot for lsp and would expect that would be the source of a slow jsonrpc call, maybe eglot trying to get completion candidates on every keystroke through the LSP server? But I don't understand the stack here well enough to know how to proceed in debugging or fixing things.

Would love any help. Knowing what to fix is great - but also I'm really interested in knowing how to know what to do next in general in this scenario.

Thanks!

https://preview.redd.it/9rbx4pm5ty2c1.png?width=1843&format=png&auto=webp&s=974bbb907f702dc775a1ef2bd34dffebc0809554

you are viewing a single comment's thread
view the rest of the comments
[–] SnooPets20@alien.top 1 points 9 months ago

I've found that using this configuration, the LSP can't halt the UI anymore, resulting in a very snappy experience. The results still take a few secs to show up, but at least you aren't typing blindly waiting for the UI to refresh.

(setq eglot-autoshutdown t)
(setq eglot-sync-connect 0)
(setq eglot-events-buffer-size 0)
(fset #'jsonrpc--log-event #'ignore)
(add-hook 'focus-out-hook 'garbage-collect)

If you don't use eglot, then the last two are the only relevant ones, which are the ones actually doing the work I think.