From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#71353: [PATCH] eglot--format-markup doesn't support MarkedString code-blocks Date: Sat, 15 Jun 2024 15:36:27 +0300 Message-ID: <86v82atmb8.fsf@gnu.org> References: <87ed9dl0wq.fsf@betli.tmit.bme.hu> <87zfs1j6lo.fsf@betli.tmit.bme.hu> <878qzk8pr1.fsf@betli.tmit.bme.hu> <86tthuvd3z.fsf@gnu.org> 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="29018"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71353@debbugs.gnu.org, brownts@troybrown.dev, felician.nemeth@gmail.com To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 15 14:39:16 2024 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 1sISgc-0007I9-JE for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 15 Jun 2024 14:39:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sISgR-0008J0-0c; Sat, 15 Jun 2024 08:39:03 -0400 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 1sISgP-0008Ie-Q7 for bug-gnu-emacs@gnu.org; Sat, 15 Jun 2024 08:39:01 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sISgP-0002ch-I3 for bug-gnu-emacs@gnu.org; Sat, 15 Jun 2024 08:39:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sISgP-0004MD-Uk for bug-gnu-emacs@gnu.org; Sat, 15 Jun 2024 08:39:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 15 Jun 2024 12:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71353 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 71353-submit@debbugs.gnu.org id=B71353.171845513216712 (code B ref 71353); Sat, 15 Jun 2024 12:39:01 +0000 Original-Received: (at 71353) by debbugs.gnu.org; 15 Jun 2024 12:38:52 +0000 Original-Received: from localhost ([127.0.0.1]:41248 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sISgF-0004LT-Ec for submit@debbugs.gnu.org; Sat, 15 Jun 2024 08:38:52 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:43472) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sISgD-0004L2-CV for 71353@debbugs.gnu.org; Sat, 15 Jun 2024 08:38:50 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sISdz-0002Ap-NF; Sat, 15 Jun 2024 08:36:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:Subject:In-Reply-To:To:From: Date; bh=/ZpYaftARGExhiokHwmAJQ8J2jWFC8hRtxAca1C4GZg=; b=b6nF6t022htVqKUR337O rgWtcchX1TtrcUrk3I8v5ZiyWsOE/purEDxs0+EU67S74wZHrQovBMtUBhL0HPQVAT/4Pm2brRAt1 ySu0LnwYcnZLecPLangUghRRRA1bFsS7AeF7CtiYd7H4wJnT0OC7HZB3a0bLgy73hg+Oho5gH+Lpj Cm6j5LxvaE3lcC2HDlPZYxRYzEI/BaaUB7wd5RFnSL7DXcIPSmjIyRnN88wXh8mlatNfdTGOgUuH8 ZKjlEhN1Zq9tjMUJ9BcGfCnF3IXATob4CraWEf5nfjuU+B5vWWpcQgWOz5Ryv65hmMWYTwNH2AVHg Mgs/0KY+mXuyIQ==; In-Reply-To: (message from =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= on Sat, 15 Jun 2024 10:37:48 +0100) 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:287285 Archived-At: --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable > From: Jo=E3o T=E1vora > Date: Sat, 15 Jun 2024 10:37:48 +0100 > Cc: Felician Nemeth , Troy Brown ,=20 > 71353@debbugs.gnu.org >=20 > Can you please resend the patch for inspection? Attached. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Eglot-Support-formatting-MarkedString-code-block.patch >From e9c6387eb123aac1fe4741a871be2b68128de41a Mon Sep 17 00:00:00 2001 From: Troy Brown Date: Tue, 4 Jun 2024 08:30:53 -0400 Subject: [PATCH] Eglot: Support formatting MarkedString code-block * lisp/progmodes/eglot.el (eglot--format-markup): Add support for MarkedString code-block. Copyright-paperwork-exempt: yes --- lisp/progmodes/eglot.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 5ccae5210fe..70224d0dcd6 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1861,11 +1861,15 @@ eglot--format-markup "Format MARKUP according to LSP's spec." (pcase-let ((`(,string ,mode) (if (stringp markup) (list markup 'gfm-view-mode) - (list (plist-get markup :value) - (pcase (plist-get markup :kind) - ("markdown" 'gfm-view-mode) - ("plaintext" 'text-mode) - (_ major-mode)))))) + (if-let ((language (plist-get markup :language)) + (value (plist-get markup :value))) + (list (concat "```" language "\n" value "\n```") + 'gfm-view-mode) + (list (plist-get markup :value) + (pcase (plist-get markup :kind) + ("markdown" 'gfm-view-mode) + ("plaintext" 'text-mode) + (_ major-mode))))))) (with-temp-buffer (setq-local markdown-fontify-code-blocks-natively t) (insert string) -- 2.37.1 --=-=-=--