roc-lang / roc

A fast, friendly, functional language.
https://roc-lang.org
Universal Permissive License v1.0
4.43k stars 311 forks source link

roc-ls returns plaintext, but tells the client that it is markdown #6277

Open olisolomons opened 10 months ago

olisolomons commented 10 months ago

Hello, I'm fairly sure that this is a bug, but I'm not 100% sure.

Anyway, when my editor sends a textDocument/hover request to roc-ls, the response is a a MarkedString, which should contain Markdown, but roc-ls seems to assume that it will be interpreted as plaintext. For example, I wrote the function f = \{field1, field2} -> {}, and when I hovered over the function name, roc-ls returned the response:

{
    contents: "{ field1 : *, field2 : * }* -> {}",
    range: {
        end: {
            character: 1,
            line: 9
        },
        start: {
            character: 0,
            line: 9
        }
    }
}

My editor (neovim, built-in lsp client) seems to process this as markdown (as the lsp specification says it should), and showed me text that looked like this: { field1 : , field2 : * } -> {}.

Apparently using MarkedString is deprecated anyway, and the new approach is to use MarkupContent, which supports a plaintext option.

The relevant code, I think

olisolomons commented 10 months ago

My original zulip message that barely contains any extra info, just in case it's useful: https://roc.zulipchat.com/#narrow/stream/231634-beginners/topic/possible.20roc-ls.20bug.3F/near/407596608