]> git.eshelyaron.com Git - emacs.git/commit
Eglot: use eglot-advertise-cancellation in more situations
authorJoão Távora <joaotavora@gmail.com>
Sun, 16 Feb 2025 18:27:48 +0000 (18:27 +0000)
committerEshel Yaron <me@eshelyaron.com>
Wed, 26 Feb 2025 09:37:10 +0000 (10:37 +0100)
commitfe44e01347f292498f2c532c6ef0b1b1dc8587b9
treeaf883a3e3d1d70c948bf98bd1ca3803ba940a2b5
parent9fde5b95cf2d417632bf4ddea75926ef2037fc90
Eglot: use eglot-advertise-cancellation in more situations

The async requests frequently issued by ElDoc are a significant
source of request pile-up on the server side (for some servers).

With this change, Eglot will issue additional LSP
$/cancelRequest notifications for in-flight requests of certain
kinds in the pre-command hook.

This required a small change to the 'jsonrpc-async-request'
entrypoint.

This feature is experimental.

* lisp/jsonrpc.el (jsonrpc-async-request): No longer returns nil.

* lisp/progmodes/eglot.el (eglot--inflight-async-requests): New variable.
(eglot--cancel-inflight-async-requests): New function.
(eglot--async-request): New function.
(eglot--pre-command-hook): Call eglot--cancel-inflight-async-requests.
(eglot-signature-eldoc-function, eglot-hover-eldoc-function)
(eglot-highlight-eldoc-function, eglot-code-action-suggestion):
Use eglot--async-request.

(cherry picked from commit e4c911adeaa679a92fab58b196b27c502aaed2f3)
lisp/jsonrpc.el
lisp/progmodes/eglot.el