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)