yaml-language-server
yaml-language-server copied to clipboard
Hover is always converting the contents to markdown
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 the markdownDescription 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 the markdownDescription 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
- Create file with schema attached that has a description that should be rendered as plaintext
- Hover over an element
- Observe that the hover element gets converted to markdown
Environment
- [ ] Windows
- [X] Mac
- [ ] Linux
- [ ] other (please specify)
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