mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 09:14:18 +00:00
Eglot: fix thinko in eglot--async-request
Just because a specific request of a specific "hint" is cancelled doesn't mean we can cancel the other's too. Also eglot-advertise-cancellation = nil was subtly broken. This manifested itself mostly in Eglot semantic tokens. * lisp/progmodes/eglot.el (eglot--async-request): Fix thinkos.
This commit is contained in:
parent
4169720313
commit
ec5479f0b5
1 changed files with 15 additions and 12 deletions
|
|
@ -2030,21 +2030,25 @@ according to `eglot-advertise-cancellation'.")
|
|||
(timeout-fn nil timeout-fn-supplied-p)
|
||||
(timeout nil timeout-supplied-p)
|
||||
hint
|
||||
&aux moreargs
|
||||
id (buf (current-buffer)))
|
||||
&aux moreargs id
|
||||
(buf (current-buffer))
|
||||
(inflight eglot--inflight-async-requests))
|
||||
"Like `jsonrpc-async-request', but for Eglot LSP requests.
|
||||
SUCCESS-FN, ERROR-FN and TIMEOUT-FN run in buffer of call site.
|
||||
HINT argument is a symbol passed as DEFERRED to `jsonrpc-async-request'
|
||||
and also used as a hint of the request cancellation mechanism (see
|
||||
`eglot-advertise-cancellation')."
|
||||
(cl-labels
|
||||
((clearing-fn (fn)
|
||||
((wrapfn (fn)
|
||||
(lambda (&rest args)
|
||||
(eglot--when-live-buffer buf
|
||||
(when (and
|
||||
fn (memq id (cl-getf eglot--inflight-async-requests hint)))
|
||||
(cond (eglot-advertise-cancellation
|
||||
(when-let* ((tail (and fn (plist-member inflight hint))))
|
||||
(when (memq id (cadr tail))
|
||||
(apply fn args))
|
||||
(cl-remf eglot--inflight-async-requests hint)))))
|
||||
(setf (cadr tail) (delete id (cadr tail)))))
|
||||
(t
|
||||
(apply fn args)))))))
|
||||
(eglot--cancel-inflight-async-requests (list hint))
|
||||
(when timeout-supplied-p
|
||||
(setq moreargs (nconc `(:timeout ,timeout) moreargs)))
|
||||
|
|
@ -2053,13 +2057,12 @@ and also used as a hint of the request cancellation mechanism (see
|
|||
(setq id
|
||||
(car (apply #'jsonrpc-async-request
|
||||
server method params
|
||||
:success-fn (clearing-fn success-fn)
|
||||
:error-fn (clearing-fn error-fn)
|
||||
:timeout-fn (clearing-fn timeout-fn)
|
||||
:success-fn (wrapfn success-fn)
|
||||
:error-fn (wrapfn error-fn)
|
||||
:timeout-fn (wrapfn timeout-fn)
|
||||
moreargs)))
|
||||
(when (and hint eglot-advertise-cancellation)
|
||||
(push id
|
||||
(plist-get eglot--inflight-async-requests hint)))
|
||||
(push id (plist-get inflight hint)))
|
||||
id))
|
||||
|
||||
(cl-defun eglot--delete-overlays (&optional (prop 'eglot--overlays))
|
||||
|
|
|
|||
Loading…
Reference in a new issue