Stream: t-compiler/rust-analyzer

Topic: MarkupKind

Martin Asquino (Jun 18 2020 at 20:49, on Zulip):

Hi folks! Quick question, in case this was reported already. I noticed that rust-analyzer does not honour the client's markup kind setting. For example, I have my vim client set to send plaintext as the contentFormat in HoverClientCapabilities, but rust-analyzer sends content with kind markdown.
Is this a known issue or should I open an issue about it?

Jeremy Kolb (Jun 18 2020 at 20:56, on Zulip):

You are correct we do not currently look at markdown capabilities. is the issue

Jeremy Kolb (Jun 18 2020 at 20:57, on Zulip):

Feel free to comment on the issue. PRs are qelcome and we can help you with that!

Martin Asquino (Jun 18 2020 at 20:59, on Zulip):

Ah cool! Thanks for the link! :bow:

Jeremy Kolb (Jun 27 2020 at 18:43, on Zulip):

@Martin Asquino can you comment on the issue? I'd like to know how this manifests other than the kind being different. Does your editor not show anything?

Martin Asquino (Jun 27 2020 at 18:54, on Zulip):

@Jeremy Kolb Oh, no, it's just that I prefer the documentation to be plain text, but it does show correctly (formatting aside).

This is how hover looks in my editor (vim) for Rust code:


And this is how I would prefer it to be shown (this last screenshot is from Go, with gopls):


It is definitely not a critical issue.

Jeremy Kolb (Jun 27 2020 at 19:27, on Zulip):

We are definitely non-compliant here so it should be fixed. Can you switch gopls to use markdown and post a screenshot? I'm curious what the difference is

Jeremy Kolb (Jun 27 2020 at 19:29, on Zulip):

It's a weird feature in the LSP. I would expect the client to specify which format it wants but instead it reports which formats it supports in preferential order. I'm not sure if your language client just swaps the order or only send down text as its supported format

Martin Asquino (Jun 27 2020 at 19:46, on Zulip):

Yeah it's definitely weird. The language client I'm using just takes a list of values and sends that to the server, my current config is only ['plaintext'] though, not sure what the correct behaviour would be for that case, but I'd much rather have it display what it can (I reckon that's what rust-analyzer is doing now) than error if I don't include one of the options or if one of the options is not supported by that specific server.

Here's how gopls display that same bit of code without setting the preferred markup kind for hover or setting ['markdown'] or ['markdown', 'plaintext'].


Martin Asquino (Jun 27 2020 at 19:49, on Zulip):

(the white block there is just really lazy censoring :smiley: )

Last update: Jul 28 2021 at 04:15UTC