Open jpinkney-aws opened 1 year ago
Are you planning to send a PR for this ?
Looks like at https://github.com/redhat-developer/yaml-language-server/blob/f8885262ad219e28121d4571bd6fc2a07fec984c/src/languageservice/services/yamlHover.ts#L120 , https://github.com/redhat-developer/yaml-language-server/blob/f8885262ad219e28121d4571bd6fc2a07fec984c/src/languageservice/services/yamlHover.ts#L141
which just treat the regular description as markdown. Seems like it shouldn't be that tricky to handle these cases. We already uses MarkupContent
in the hover, which supports both.
Update: Another thing to consider is if we're always returning markdown content, then we're probably not respecting contentFormat
I found this while researching this behaviour in kate and I think the YAML language server is behaving correctly here. Microsoft's JSON language server does the same, and some non-VSC editors (e.g. emacs) do treat this correctly.
It's subtle, but when sending the contents
field on hover
as a plain string, the protocol defines this to be interpreted as a MarkedString, which should be interpreted as Markdown. (So in this case, Visual Studio and Kate are both behaving incorrectly.)
In the end though, the piece I think is most important about the MarkedString
type is:
@deprecated use MarkupContent instead.
I'm guessing v4 of the protocol will remove MarkedString
, so the language server could both "fix" this bug and future-proof itself by replacing the string with a MarkupContent field. Double bonus: not having to convert the contents to Markdown since you can just mark it as plaintext instead :-)
Describe the bug
When you hover over a element that has a schema applied the hover results get converted directly into markdown regardless of whether or not you are using the
description
json schema field or themarkdownDescription
json schema field. This actually breaks non-VSCode editors like Visual Studio, which can't/don't handle the markdown from hover gracefully.It's also worth noting that we don't convert our completion description results to markdown. They are shown as plaintext.
Expected Behavior
Hovers coming from
description
json schema fields should not re-render everything as markdown. We should only convert the incoming description as markdown when the user uses themarkdownDescription
field in the schema.Current Behavior
Every hover request gets rendered as markdown.
Related code: https://github.com/redhat-developer/yaml-language-server/blob/main/src/languageservice/services/yamlHover.ts#L89 and https://github.com/redhat-developer/yaml-language-server/blob/main/src/languageservice/services/yamlHover.ts#L117
Steps to Reproduce
Environment