Eglot: introduce eglot-advertise-cancellation
Setting this variable to true causes Eglot to send special
cancellation notification for certain stale client request.
This may help some LSP servers avoid doing costly but ultimately useless
work on behalf of the client, improving overall performance.
Request cancellation is described in
https://microsoft.github.io/language-server-protocol/
specifications/lsp/3.17/specification/#cancelRequest
* lisp/jsonrpc.el (jsonrpc-request): Accept function as value for
CANCEL-ON-INPUT.
* lisp/progmodes/eglot.el (eglot--request): Rework.
* doc/misc/eglot.texi (Customizing Eglot): Mention
eglot-advertise-cancellation.
(cherry picked from commit
7f0ef9655cdc28c3b8055e32c9e84ea57339b139)