Subject: bug#59929: [PATCH]: Eglot, request progress notification on server init

From: Danny Freeman <[email-masked]>
Date: Fri, 09 Dec 2022 15:59:24 -0500

Another patch for consideration related to the first in this thread,
I've confirmed that clients can signal to servers that they are willing
to accept server initiated progress notifications with the client
capability in the attached patch. 

Note: there is still no server capability for this that can be ignored,
and the `eglot-report-progress` defcustom remains relevant here. Any
server initiated progress report will be ignored if
`eglot-report-progress` is `nil`.

Server will send a `window/workDoneProgress/create` request, but nothing
needs to be done with it. That request will be followed by the already
implemented $/progress notifications.

I need to find a server that I can test this with before this patch is
applied. I will report back in this thread once I've done that.

-- 
Danny Freeman

>From f30bd7d7396d29c38249a232e36f4b811dd27f56 Mon Sep 17 00:00:00 2001
From: dannyfreeman <[email-masked]>
Date: Fri, 9 Dec 2022 15:55:28 -0500
Subject: [PATCH] Eglot: Enable server initiated progress reports

* lisp/progmodes/eglot
(eglot-client-capabilities): servers can initiate progress reports
---
 lisp/progmodes/eglot.el | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index cceb9fb5b32..e909efdb6f4 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -728,6 +728,7 @@ eglot-client-capabilities
   "What the Eglot LSP client supports for SERVER."
   (:method (s)
            (list
+            :window (list :workDoneProgress t)
             :workspace (list
                         :applyEdit t
                         :executeCommand `(:dynamicRegistration :json-false)
@@ -2062,6 +2063,10 @@ eglot-handle-notification
   (_server (_method (eql telemetry/event)) &rest _any)
   "Handle notification telemetry/event.") ;; noop, use events buffer
 
+(cl-defmethod eglot-handle-reqeust
+  (_server (_method (eql window/workDoneProgress/create)) &rest _any)
+  "Handle request window/workDoneProgress/create.") ;; noop, use events buffer
+
 (cl-defmethod eglot-handle-notification
   (server (_method (eql $/progress)) &key token value)
   "Handle $/progress notification identified by TOKEN from SERVER."
-- 
2.38.1