emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59146: closed (Patch: improve eglot-shutdown-all)


From: GNU bug Tracking System
Subject: bug#59146: closed (Patch: improve eglot-shutdown-all)
Date: Thu, 10 Nov 2022 17:20:02 +0000

Your message dated Thu, 10 Nov 2022 17:20:21 +0000
with message-id <87v8nm9162.fsf@gmail.com>
and subject line Re: Patch: improve eglot-shutdown-all
has caused the debbugs.gnu.org bug report #59146,
regarding Patch: improve eglot-shutdown-all
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
59146: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59146
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: Patch: improve eglot-shutdown-all Date: Wed, 9 Nov 2022 13:27:49 +0200
eglot-shutdown-all has a bug that results in partially stopping
servers - when a server shutdown timeouts (1.5s), an error is
propagated and eglot-shutdown-all does not try to shutdown the rest of
the servers.

The patch below (produced with "git show" to include a commit message)
modifies eglot-shutdown-all to ignore errors, converting them to
messages via "with-demoted-errors".

Comparison of old VS new behaviour follows.

Steps to reproduce:

1. start 2 different language servers, the servers should be slow to
stop (I use gopls in a monorepo, so slow startup time is guaranteed)
2. (optional) if your language server is not slow to stop, change the
timeout in eglot-shutdown from 1.5 sec to 0.1 sec to force a timeout
3. run eglot-shutdown-all

Before: only one of the 2 servers is stopped - 1st one times out, 2nd
one is not asked to stop at all. Messages:

```
[eglot] Asking EGLOT (project1/go-mode) politely to terminate
[jsonrpc] Server exited with status 9
down-list: jsonrpc-error: "request id=4 failed:",
(jsonrpc-error-message . "Timed out")
```

After: both servers are stopped, the timeout errors are converted to
messages by with-demoted-errors. Messages:

```
[eglot] Asking EGLOT (project1/go-mode) politely to terminate
[jsonrpc] Server exited with status 9
[eglot] shutdown all: (jsonrpc-error request id=2 failed:
(jsonrpc-error-message . Timed out))
[eglot] Asking EGLOT (project2/go-mode) politely to terminate
[jsonrpc] Server exited with status 9
[eglot] shutdown all: (jsonrpc-error request id=2 failed:
(jsonrpc-error-message . Timed out))
```

Patch:

Author: Evgeni Kolev <evgenysw@gmail.com>
Date:   Wed Nov 9 13:17:01 2022 +0200

    Ignore errors when shutting down all LSP servers

    eglot-shutdown-all has a bug that results in partially stopping
    servers: when a server shutdown timeouts (1.5s), an error is
    propagated and eglot-shutdown-all does not try to shutdown the rest of
    the servers.

    * eglot.el (eglot-shutdown-all): Ignore errors when shutting down
      servers, converting errors to messages.

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index ce989b5611..5a28c64bb0 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -877,7 +877,8 @@ eglot-shutdown-all
 PRESERVE-BUFFERS as in `eglot-shutdown', which see."
   (interactive (list current-prefix-arg))
   (cl-loop for ss being the hash-values of eglot--servers-by-project
-           do (cl-loop for s in ss do (eglot-shutdown s nil nil
preserve-buffers))))
+           do (with-demoted-errors "[eglot] shutdown all: %s"
+                (cl-loop for s in ss do (eglot-shutdown s nil nil
preserve-buffers)))))

 (defun eglot--on-shutdown (server)
   "Called by jsonrpc.el when SERVER is already dead."



--- End Message ---
--- Begin Message --- Subject: Re: Patch: improve eglot-shutdown-all Date: Thu, 10 Nov 2022 17:20:21 +0000 User-agent: Gnus/5.13 (Gnus v5.13)
Thanks,  I applied the patch

João



--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]