all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: felician.nemeth@gmail.com, Troy Brown <brownts@troybrown.dev>,
	74807@debbugs.gnu.org
Subject: bug#74807: 30.0.90; Eglot: Non-Markdown strings rendered as Markdown
Date: Mon, 06 Jan 2025 11:56:09 +0000	[thread overview]
Message-ID: <87bjwkkvfq.fsf@gmail.com> (raw)
In-Reply-To: <86y100t6i7.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 28 Dec 2024 13:02:40 +0200")

Eli Zaretskii <eliz@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






  reply	other threads:[~2025-01-06 11:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-12  0:46 bug#74807: 30.0.90; Eglot: Non-Markdown strings rendered as Markdown Troy Brown
2024-12-12  8:30 ` João Távora
2024-12-12 13:32   ` Troy Brown
2024-12-28 11:02     ` Eli Zaretskii
2025-01-06 11:56       ` João Távora [this message]
2025-01-06 23:56         ` Troy Brown
2025-01-07  0:28           ` João Távora
2025-01-08  3:56             ` Troy Brown
2025-01-08  9:18               ` João Távora
2025-01-08 23:37                 ` Troy Brown
2025-01-08 23:45                   ` João Távora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bjwkkvfq.fsf@gmail.com \
    --to=joaotavora@gmail.com \
    --cc=74807@debbugs.gnu.org \
    --cc=brownts@troybrown.dev \
    --cc=eliz@gnu.org \
    --cc=felician.nemeth@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.