smartparens
smartparens copied to clipboard
Add a limit to how long we can take parsing the buffer
Let's put a two second cap on the parser so that emacs don't hang forever in a buffer with exceptionally large sexp.
The parser needs to run asynchronously instead of blocking the UI thread. A two second cap on the parser, if it is run asynchronously, sounds good to me.
Blocking the UI thread for this functionality, even for just 0.1 seconds, is not really acceptable.
Elisp functions can not run asynchronously.
@Fuco1 I was thinking about running the computation in a different process asynchronously.
I've tried that in the past on a couple projects and it is incredibly buggy, hard to debug and hard to write reliably. There is the async package but for anything more than a toy example it is a world of pain.
Much better way is to write something like a persistent server (a la LSP) which we can query with some API. I'm not planning on doing that either though, it's too much effort for not a lot of extra gain.
Users can opt-out of the highlights if the perf is bad. It is good in majority of cases and modes.