all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Danny Freeman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 59929@debbugs.gnu.org
Subject: bug#59929: [PATCH]: Eglot, request progress notification on server init
Date: Fri, 09 Dec 2022 14:55:05 -0500	[thread overview]
Message-ID: <87y1rgtk78.fsf@dfreeman.email> (raw)

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


             reply	other threads:[~2022-12-09 19:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 19:55 Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
     [not found] ` <handler.59929.B.167061645810464.ack@debbugs.gnu.org>
2022-12-09 20:59   ` 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
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y1rgtk78.fsf@dfreeman.email \
    --to=bug-gnu-emacs@gnu.org \
    --cc=59929@debbugs.gnu.org \
    --cc=danny@dfreeman.email \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.