From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Danny Freeman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#59929: [PATCH]: Eglot, request progress notification on server init Date: Fri, 09 Dec 2022 14:55:05 -0500 Message-ID: <87y1rgtk78.fsf@dfreeman.email> Reply-To: Danny Freeman Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3085"; mail-complaints-to="usenet@ciao.gmane.io" To: 59929@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 09 21:08:21 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p3jfP-0000ad-Vg for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 09 Dec 2022 21:08:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3jfH-0002jk-NE; Fri, 09 Dec 2022 15:08:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3jfC-0002gb-FL for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2022 15:08:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3jf8-0000Dq-FR for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2022 15:08:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p3jf8-0002j1-9q for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2022 15:08:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Danny Freeman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Dec 2022 20:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59929 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.167061645810464 (code B ref -1); Fri, 09 Dec 2022 20:08:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 9 Dec 2022 20:07:38 +0000 Original-Received: from localhost ([127.0.0.1]:38204 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3jej-0002ii-Ks for submit@debbugs.gnu.org; Fri, 09 Dec 2022 15:07:37 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:33214) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3jeh-0002ia-6C for submit@debbugs.gnu.org; Fri, 09 Dec 2022 15:07:35 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3jee-0002bU-4f for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2022 15:07:35 -0500 Original-Received: from out2.migadu.com ([2001:41d0:2:aacc::]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3jeb-000074-EJ for bug-gnu-emacs@gnu.org; Fri, 09 Dec 2022 15:07:31 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dfreeman.email; s=key1; t=1670616447; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=2WPDMOFzeSFgaSoB26KDA3cUgz9VwGeiax4rAZHxndI=; b=TLHbGy51zo3M8CxHHDUP5xyiqmyIgKm4DkRG119ck6dMtjxe1JA1tn4Fh/jeqFKUGDrfxo NTjhRMLRtoBDfmV4+MbMkGYVV18mvc4xN6F+fE/u430DI10TZrTCc+YHQhomDWkWBXfD07 4RSXLylG3V2YDotj4gL9rsoyXBQSjM4= X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:2:aacc::; envelope-from=danny@dfreeman.email; helo=out2.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:250446 Archived-At: --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Eglot-show-progress-reports-for-slow-starting-server.patch Content-Description: Eglot report initialization progress >From 1b81fa34ff282bfca0f754afad2c9eca04ad7985 Mon Sep 17 00:00:00 2001 From: dannyfreeman 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 --=-=-=--