GNU bug report logs - #71353
[PATCH] eglot--format-markup doesn't support MarkedString code-blocks

Previous Next

Package: emacs;

Reported by: Troy Brown <brownts <at> troybrown.dev>

Date: Tue, 4 Jun 2024 02:52:02 UTC

Severity: normal

Tags: patch

Done: João Távora <joaotavora <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Troy Brown <brownts <at> troybrown.dev>
To: 71353 <at> debbugs.gnu.org
Subject: bug#71353: [PATCH] eglot--format-markup doesn't support MarkedString code-blocks
Date: Mon, 3 Jun 2024 22:51:07 -0400
[Message part 1 (text/plain, inline)]
It appears that eglot--format-markup only supports MarkedString for
string literals and MarkupContent.  This causes markup provided by the
server as a MarkedString code-block to be formatted using the major
mode.  This happens because the MarkedString code-block uses the
"language" field to designate the type of markup.
eglot--format-markup is only looking for the "kind" field found in
MarkupContent.  The following is an example of a hover response from
an LSP server using a MarkedString code-block to provide a description
in "plaintext".

[jsonrpc] e[13:34:28.888] --> textDocument/hover[25]
{"jsonrpc":"2.0","id":25,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/troy/repos/crates/gtkada_24.0.0_80c56171/src/gtkada.gpr"},"position":{"line":70,"character":12}}}
[jsonrpc] e[13:34:29.033] <-- textDocument/hover[25]
{"jsonrpc":"2.0","id":25,"result":{"contents":[{"language":"plaintext","value":"This
package specifies the compilation options used when building an
executable or a library for a project. Most of the options should be
set in one of Compiler, Binder or Linker packages, but there are some
general options that should be defined in this package."}]}}

The following patch will format MarkedString code-blocks for markdown
and plaintext while using the major mode to format any other language.
[0001-Eglot-Support-formatting-MarkedString-code-block.patch (text/x-patch, attachment)]

This bug report was last modified 1 year and 16 days ago.

Previous Next


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