GNU bug report logs - #76683
[PATCH] Eglot: Implement additionalPropertiesSupport for showMessage

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Felician Nemeth <felician.nemeth@HIDDEN>; Keywords: patch; dated Sun, 2 Mar 2025 13:40:03 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 2 Mar 2025 13:39:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 02 08:39:37 2025
Received: from localhost ([127.0.0.1]:56001 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tojXd-0002Zu-BG
	for submit <at> debbugs.gnu.org; Sun, 02 Mar 2025 08:39:37 -0500
Received: from lists.gnu.org ([2001:470:142::17]:57732)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <felician.nemeth@HIDDEN>)
 id 1tojXa-0002ZK-KV
 for submit <at> debbugs.gnu.org; Sun, 02 Mar 2025 08:39:35 -0500
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 <felician.nemeth@HIDDEN>)
 id 1tojXR-00062E-9w
 for bug-gnu-emacs@HIDDEN; Sun, 02 Mar 2025 08:39:26 -0500
Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <felician.nemeth@HIDDEN>)
 id 1tojXP-00065x-GX
 for bug-gnu-emacs@HIDDEN; Sun, 02 Mar 2025 08:39:25 -0500
Received: by mail-ej1-x632.google.com with SMTP id
 a640c23a62f3a-abf48293ad0so236546766b.0
 for <bug-gnu-emacs@HIDDEN>; Sun, 02 Mar 2025 05:39:22 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740922760; x=1741527560; darn=gnu.org;
 h=mime-version:face:user-agent:message-id:date:subject:to:from:from
 :to:cc:subject:date:message-id:reply-to;
 bh=KDpmDsUZrvUPURjWk3X9LB/6LOudN5VunLTz9aWJ8W0=;
 b=D4DjfuswHcucqrC/i5KTnqHKILAbo49FrJTWjqvzB9p+DEIsjSbGkItnbRnWKi1Pld
 zAu+DcJaOYDaIEETvRGj7mHOUFSBrMibw1pnwTBh8k2GWRP2AMCK2Zl0m+3kTsYeSliR
 kXqUWg2nYNv63/FCRLPPcTN/rl56JPTHMNN6pkfYRlKw15vQyYWbpOQVUmSFOjKAJD6I
 KxSnxhh8Mqgnqw24D4w9UmcXX43SE178ty7/sqwrmVd+3yCxk2uSuPgbxocn+w6+SlcG
 9BQZiqXTVFg7Y8jhhAFUj/9xewZg8wJp3TD9+/ZCw8p9pnrxcxzKk3TD86NpFxrmi8Ss
 hOFQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740922760; x=1741527560;
 h=mime-version:face:user-agent:message-id:date:subject:to:from
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=KDpmDsUZrvUPURjWk3X9LB/6LOudN5VunLTz9aWJ8W0=;
 b=CCI9IftYEEwRRyoAhKQXIMzWLBdBXb9hWEmCs3Ga5H6jfsi2tguC3ydnQ+q3ubsaCN
 RFFBppzY8GNg/8ymC9KAtDjklOcwb2/0KC+GGMkfgHYK3Z/Gzt94XuCsqLoOVAArkaHr
 l5SgqqJvS5V8nvA/I9bPPmKENuSk7jZDIDyPB+KsRa0TZLfvPagaQp3WIYN/Oi75X2Bw
 PEPitU2S/+xqKqKli51/c6mUt5Ujk66bRD1V67iDWVwsQ8au8ztW9JQsHyAlIvOl/XVf
 mw/60fteIHMkL0kslo2fRAkTW2QpAd5V/d7W4Km42FMeb4up5DyrQRL51tlWrMzV+z0L
 99kA==
X-Gm-Message-State: AOJu0YyoNR8bZHX54B+yymTDx27CAhQt97vlz+BfHauX/QLTkfhTZXbJ
 hIqzzUt8dYI+2vOqAPyVDYQ8QW8g0nYZYMxVw3fdaXdBceayGp4yDVhSjw==
X-Gm-Gg: ASbGnctRybBpb64dlWVtJdy86Ewy+pyiMugYRD9yvQg9YbzKZGpn3fb98+YFssyreMz
 IueAEpwYxS2SFcUVAX14XxCfHkDxcKX2ofbNS2zMq2pQGQEIHo4Pi2ZLG+K4Q2g+qwHSTcLQCXE
 Kp34wU6xiZxTb8HBwXI3c+90ziBMfifawxI/JzoUuSVrZonaAg7TGiSwdxNajryCjp9jWn1d2pK
 LORc5SkLUf9f9AdzhpzUG1xIxH5yiCgwJFmY+1vIPq0N3ghcjsJ+xDP7HjUjdEvnwZt1JIe3mab
 L/eplC+XoUckDFFSV3MjGuG16NcUY/P5mkVodBAAT2htcEuvmlZoggGTkKQlU4lDNQB0ZlsY8kH
 jRFvpHi46Bvbb7S0V7i3fE+RypA==
X-Google-Smtp-Source: AGHT+IGv6dRjtg7KWTw+Fm5gphnW3VSmFEzjqB5NHpCtlPphbLtezCjmq1zSR5tqocIeiYbc1BQ2mA==
X-Received: by 2002:a17:907:7faa:b0:abf:74d6:e2a5 with SMTP id
 a640c23a62f3a-abf74d6e404mr152813166b.6.1740922760175; 
 Sun, 02 Mar 2025 05:39:20 -0800 (PST)
Received: from betli.gmail.com (catv-213-222-160-137.catv.fixed.one.hu.
 [213.222.160.137]) by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-abf7a3ea634sm23505366b.174.2025.03.02.05.39.19
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 02 Mar 2025 05:39:19 -0800 (PST)
From: Felician Nemeth <felician.nemeth@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Eglot: Implement additionalPropertiesSupport for showMessage
X-Debbugs-Cc: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Date: Sun, 02 Mar 2025 14:39:18 +0100
Message-ID: <87cyez1ri1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEUMBwgHAgMFAAGPjY7/
 //80MDHq6eqJt3pKAAABr0lEQVQ4jX2UzZKDIAzHqR177q7TPbtx2HMr6guQcrbY9txZ0fd/hA0f
 onXazcEJ/CD8E4Js8/HS9mwjXtqeMRxHXJkakTEm4b4GPVQW8PU8ov4fQCqeThlF60MBWdo1IXzd
 2nEEZE7CEAZLwI0N/gJAhTj7ESQAX4gPgO8lyI+cvgViSVPlNomAj2M9gW40eg7VWY3cATjUcyiO
 Z+i03cFruGLYoUR7VyU3HihdmCEVhoDN65FXkpbSxkomOzsTQN/gySaodGb9Gdi1oSRXP46gdBWh
 LcUKJNdeGCWac74GKakmne0aHCFvyqJPYLsCFAVlhRTvGdzMdLHqtgRyUulyXIAH7CYQ3AB0Nody
 JQhAkq/qtOnbjhxdzYDkXPxlH5y4WdUAeUcX1NVJ6GR7UQEYPGWoAnA36OQNn5lRRp38vHTAp9Br
 LoTmvlPPDoRCKzpjG1SXT89AaT5l456BamJuMcs+NIOMzJ/s5dI6yUVcrARlruwOebfdv6gunTn4
 ww3+QjGBEn5suVyLHoSGvAqREuDLN+iqZ+VcFg+HBbsJUU9+FZthbez9T+bdb+kPv2Ls6ct3hTkA
 AAAASUVORK5CYII=
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2a00:1450:4864:20::632;
 envelope-from=felician.nemeth@HIDDEN; helo=mail-ej1-x632.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.7 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Hi João, This small patch implements a harmless feature introduced
    in LSP version 3.16: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#window_showMessageRequest
    
 
 Content analysis details:   (1.7 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (felician.nemeth[at]gmail.com)
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
  0.1 URIBL_SBL_A            Contains URL's A record listed in the Spamhaus SBL
                             blocklist
                             [URIs: microsoft.github.io]
  0.6 URIBL_SBL              Contains an URL's NS IP listed in the Spamhaus SBL
                             blocklist
                             [URIs: microsoft.github.io]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [2001:470:142:0:0:0:0:17 listed in]
                             [list.dnswl.org]
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.7 (/)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi Jo=C3=A3o,

This small patch implements a harmless feature introduced in LSP version
3.16:
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.1=
8/specification/#window_showMessageRequest

It allows me to implement a rust-analyzer feautre in a simple, stateless
manner.

Thank you,
Felici=C3=A1n


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Eglot-Implement-additionalPropertiesSupport-for-show.patch

From 2829d1e98336d5588d2552b27d169f1674a99874 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felici=C3=A1n=20N=C3=A9meth?= <felician.nemeth@HIDDEN>
Date: Sun, 2 Mar 2025 14:18:48 +0100
Subject: [PATCH] Eglot: Implement additionalPropertiesSupport for showMessage

This feature was introduced in LSP v3.16.

https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#window_showMessageRequest

* lisp/progmodes/eglot.el (eglot-client-capabilities): Set
window/showMessage/messageActionItem/additionalPropertiesSupport to t.
(eglot-handle-request window/showMessageRequest): Return the whole
selected ActionItem, not just its title.
---
 lisp/progmodes/eglot.el | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 1920d835cc3..c7e0a83f04e 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -1089,6 +1089,8 @@ eglot-client-capabilities
                                          [,@(mapcar
                                              #'car eglot--tag-faces)])))
             :window `(:showDocument (:support t)
+                      :showMessage (:messageActionItem
+                                    (:additionalPropertiesSupport t))
                       :workDoneProgress ,(if eglot-report-progress t :json-false))
             :general (list :positionEncodings ["utf-32" "utf-8" "utf-16"])
             :experimental eglot--{})))
@@ -2594,17 +2596,16 @@ eglot-handle-request
   (_server (_method (eql window/showMessageRequest))
            &key type message actions &allow-other-keys)
   "Handle server request window/showMessageRequest."
-  (let* ((actions (append actions nil)) ;; gh#627
+  (let* ((actions (mapcar (lambda (a) (cons (plist-get a :title) a)) actions))
          (label (completing-read
                  (concat
                   (format (propertize "[eglot] Server reports (type=%s): %s"
                                       'face (if (or (not type) (<= type 1)) 'error))
                           type message)
                   "\nChoose an option: ")
-                 (or (mapcar (lambda (obj) (plist-get obj :title)) actions)
-                     '("OK"))
-                 nil t (plist-get (elt actions 0) :title))))
-    (if label `(:title ,label) :null)))
+                 (or actions '("OK"))
+                 nil t (caar actions))))
+    (if label (cdr (assoc label actions)) :null)))
 
 (cl-defmethod eglot-handle-notification
   (_server (_method (eql window/logMessage)) &key _type _message)
-- 
2.39.5


--=-=-=--




Acknowledgement sent to Felician Nemeth <felician.nemeth@HIDDEN>:
New bug report received and forwarded. Copy sent to joaotavora@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to joaotavora@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#76683; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 2 Mar 2025 13:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.