redhat-developer / redhat-developer/yaml-language-server

Hover is always converting the contents to markdown

Open
#837 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
1.5k
Forks
352
Avg merge
2d 7h
Merged PRs (30d)
11

Description

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

  1. Create file with schema attached that has a description that should be rendered as plaintext
  2. Hover over an element
  3. Observe that the hover element gets converted to markdown

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/languageservice/services/yamlHover.ts at the referenced lines around 89 and 117, and trace how schema description fields are turned into hover results. Verify the behavior with a schema using description versus markdownDescription; done means only markdownDescription content is rendered as markdown while description remains plaintext.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.