Subject: bug#71353: [PATCH] eglot--format-markup doesn't support MarkedString code-blocks

From: Felician Nemeth <[email-masked]>
Date: Tue, 04 Jun 2024 13:21:55 +0200

Troy Brown <[email-masked]> writes:

> On Tue, Jun 4, 2024 at 1:42 AM Felician Nemeth
> <[email-masked]> wrote:
>>
>> According to the LSP specification, if MarkedString is "{ language:
>> string; value: string }", then it should be interpreted as this markdown
>> formatted string:
>>
>> ```${language}
>> ${value}
>> ```

> Unless I'm mistaken, I believe it does implement that behavior if the
> language is markdown, plaintext or the same as the major mode.  

I don't think "markdown" is a valid markdown language.

For example, if a MarkedString is

    { "language": "c", "value": "printf(42);"}

then the LSP client should interpret it as this markdown-formatted text:

    ```c
    printf(42);
    ```

Whereas I think you argue that this MarkedString:

    { "language": "markdown", "value": "```c\nprintf(42);\n```"}

should be interpreted as this markdown-formatted text:

    ```c
    printf(42);
    ```

I beleive the second example is not in line with the LSP specification.

The patch, however, will format "printf(42);" according to the
major-mode of the current buffer, which is probably c-mode or something
similar.  So this part will usually work.

In any case, why not just turn a MarkedString into a markdown-formatted
text and give it gfm-view-mode?