GNU bug report logs - #74807
30.0.90; Eglot: Non-Markdown strings rendered as Markdown

Previous Next

Package: emacs;

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

Date: Thu, 12 Dec 2024 00:47:02 UTC

Severity: normal

Found in version 30.0.90

Full log


Message #17 received at 74807 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: felician.nemeth <at> gmail.com, Troy Brown <brownts <at> troybrown.dev>,
 74807 <at> debbugs.gnu.org
Subject: Re: bug#74807: 30.0.90; Eglot: Non-Markdown strings rendered as
 Markdown
Date: Mon, 06 Jan 2025 11:56:09 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

> Ping!  Can we make some progress here, please?

>> [jsonrpc] e[08:23:09.518] --> textDocument/hover[13]
>> {"jsonrpc":"2.0","id":13,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/troy/junk/hello_world.gpr"},"position":{"line":4,"character":21}}}
>> [jsonrpc] e[08:23:09.531] <-- textDocument/hover[13]
>> {"jsonrpc":"2.0","id":13,"result":null}

Hello Troy,  I've finally had time to look at your bug report.

> I've run across a situation where Eglot receives a documentation
> string as part of a "completionItem/resolve".  The documentation is
> being provided as a regular "string", not MarkupContent, yet it is
> being rendered as markup.  Since the string contains characters which
> are being interpreted as markdown (e.g., ":"), it causes the
> documentation to be rendered incorrectly.

After perusing the spec, I'm not sure the simple strings cannot be
rendered as Markdown by the client.  The spec doesn't seem to
disambiguate this.  All it says about the documentation field of a
Completion structure, besides its polymorphic type, is that it is a

    /**
     * A human-readable string that represents a doc-comment.
     */
     documentation?: string | MarkupContent;


Anyway I think if the server wants to ensure something is _not_ rendered
as Markdown it should use the more advanced MarkupContent structure and
explicitly specify 'plaintext' in its MarkupKind field.

I understand this sounds counter-intuitive, but I have to be very
careful to do these kinds of changes.  As you know, Eglot works with a
large body of servers, and I wouldn't be at all surprised that some of
those servers (or, more importantly, regulat users of those servers) do
actually expect plain strings to be rendered as Markdown when such a
renderer is available.

Lastly, and adding to my reluctance to address this in code, I don't
understand what ':' is tripping the renderer here.  Last I checked, ':'
doesn't have any special meaning in Markdown, especially in the middle
of the sequence.  Emacs's `markdown-view-mode` from the markdown.el
package does give the left and right parts of:

   Indentation kind: spaces | tabs

a different face (I don't know why, the online renderers I've tried do
not do that).  But I wouldn't say it is being rendered "incorrectly".

Anyway, I lean strongly towards not touching this.
João





This bug report was last modified 158 days ago.

Previous Next


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