all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#59929: [PATCH]: Eglot, request progress notification on server init
@ 2022-12-09 19:55 Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
       [not found] ` <handler.59929.B.167061645810464.ack@debbugs.gnu.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-09 19:55 UTC (permalink / raw)
  To: 59929

[-- Attachment #1: Type: text/plain, Size: 923 bytes --]


I would like to propose a change to Eglot that builds on my last patch
in bug 59149.

What I did not realize at the time of writing that patch, is that
clients can opt into receiving progress notifications for server
initialization when sending the `:initialize` request.
This is useful for slow starting servers or large projects that require
the lsp server to do a lot of analysis on startup. The server of course
has to be able to send these progress reports. Not all of them do and
may ignore this parameter.

If users do not want to see this, they can set `eglot-report-progress`
to `nil`.

There are other requests that extend the WorkDoneProgressParams
interface that this could also be done for. It may be worth looking
through the spec and seeing if it makes sense to send this param with
other requests. Many of them are for typically quick requests like
`textDocument/definition`

Thank you,
-- 
Danny Freeman


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Eglot report initialization progress --]
[-- Type: text/x-patch, Size: 1771 bytes --]

From 1b81fa34ff282bfca0f754afad2c9eca04ad7985 Mon Sep 17 00:00:00 2001
From: dannyfreeman <danny@dfreeman.email>
Date: Fri, 9 Dec 2022 14:40:01 -0500
Subject: [PATCH] Eglot: show progress reports for slow starting servers

* lisp/progmodes/eglot.el (eglot--connect): report progress on
initialization

This takes advantage of the new `eglot-handle-notification`
implementation of the LSP $/progress method.

Slow starting servers will now show their progress in the
minibuffer if `eglot-report-progress` is `t`. The server must
also opt in to providing the $/progress notifications.

See
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#initialize
for more information on the InitializeParams interface.
---
 lisp/progmodes/eglot.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index a53f62fc565..cceb9fb5b32 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -1291,7 +1291,10 @@ eglot--connect
                             :initializationOptions (eglot-initialization-options
                                                     server)
                             :capabilities (eglot-client-capabilities server)
-                            :workspaceFolders (eglot-workspace-folders server))
+                            :workspaceFolders (eglot-workspace-folders server)
+                            ;; Request $/progress notifications from the
+                            ;; server on startup.
+                            :workDoneToken "initialize")
                       :success-fn
                       (eglot--lambda ((InitializeResult) capabilities serverInfo)
                         (unless canceled
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#59929: [PATCH]: Eglot, request progress notification on server init
       [not found] ` <handler.59929.B.167061645810464.ack@debbugs.gnu.org>
@ 2022-12-09 20:59   ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-03-25 19:10     ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 4+ messages in thread
From: Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-09 20:59 UTC (permalink / raw)
  To: 59929

[-- Attachment #1: Type: text/plain, Size: 810 bytes --]


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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Eglot-Enable-server-initiated-progress-reports.patch --]
[-- Type: text/x-patch, Size: 1409 bytes --]

From f30bd7d7396d29c38249a232e36f4b811dd27f56 Mon Sep 17 00:00:00 2001
From: dannyfreeman <danny@dfreeman.email>
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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#59929: [PATCH]: Eglot, request progress notification on server init
  2022-12-09 20:59   ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-03-25 19:10     ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-03-25 19:15       ` João Távora
  0 siblings, 1 reply; 4+ messages in thread
From: Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-03-25 19:10 UTC (permalink / raw)
  To: 59929, João Távora


Danny Freeman <danny@dfreeman.email> writes:

> 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.

I think this bug can be closed. It is old and I lost track of it, but
some recent commits in Emacs I think addressed this

- 82523dc621ace104d8f379509a436fcb03c48c26
- 47d8e4b0d3835f5e0b0b6ab76f242ef0aa25bda7

Thank you,
Danny Freeman





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#59929: [PATCH]: Eglot, request progress notification on server init
  2023-03-25 19:10     ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-03-25 19:15       ` João Távora
  0 siblings, 0 replies; 4+ messages in thread
From: João Távora @ 2023-03-25 19:15 UTC (permalink / raw)
  To: Danny Freeman, 59929-done

On Sat, Mar 25, 2023 at 7:12 PM Danny Freeman <danny@dfreeman.email> wrote:
>
>
> Danny Freeman <danny@dfreeman.email> writes:
>
> > 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.
>
> I think this bug can be closed. It is old and I lost track of it, but
> some recent commits in Emacs I think addressed this
>
> - 82523dc621ace104d8f379509a436fcb03c48c26
> - 47d8e4b0d3835f5e0b0b6ab76f242ef0aa25bda7
>
> Thank you,
> Danny Freeman

Yes, I think so to.  I had lost track of this bug,
thanks for reminding me.

João





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-25 19:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-09 19:55 bug#59929: [PATCH]: Eglot, request progress notification on server init Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found] ` <handler.59929.B.167061645810464.ack@debbugs.gnu.org>
2022-12-09 20:59   ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-25 19:10     ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-25 19:15       ` João Távora

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.