Akuli / porcupine

A decent editor written in tkinter
MIT License
156 stars 46 forks source link

langserver restart on error #1252

Open Akuli opened 1 year ago

Akuli commented 1 year ago

I use clangd with Porcupine when editing C code. It sometimes crashes. To restart it, I need to close all C files and reopen the file I want to edit.

It would be nice if I could configure clangd to start automatically after crashing. In fact, that should probably be the default behavior, with some reasonable rule to prevent it from endlessly restarting the langserver if it crashes immediately every time. For example, we could give up if we have restarted the langserver 5 times within the last minute.

Akuli commented 5 months ago

Let's try exponential backoff. When langserver crashes, wait 1 second. If it crashes again, wait 2 seconds. If still crashes wait 4 seconds, then 8, then 16, then 32, and so on. If it's crashing constantly, we practically give up: the wait time is about 8.5 minutes after it has crashed 10 times.

Advantages of exponential backoff: