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

Add quick fixes for obvious type errors

Open
#532 0 comments 0 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

Is your enhancement related to a problem? Please describe.

One of the arguments some people use who don’t like YAML, is that types are hard to deal with in YAML. Some strings need to be quoted in YAML, whereas others do not. I think this might be useful to them.

Describe the solution you would like

Based on schema validation, add quick actions to convert:

  • true or false to 'true' or 'false' if a string is expected
  • null to 'null' if a string is expected
  • Numbers to numeric strings if a string is expected
  • Dates and datetimes to strings if a string is expected
  • 'true' or 'false' to true or false to if a boolean is expected
  • 'null' or '' (empty string) to null if a null type is expected
  • Numeric strings to numbers if a number is expected
  • Single line objects to a quoted string if a string is expected
  • Multi line objects to a multiline string if a string is expected
  • Any invalid value to a valid value if an enum is expected
Describe alternatives you have considered

Autofix would also be possible, but I think the user should be in control.

Additional context

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 by locating the schema-validation and quick-action entry points in the YAML language server. Review how user-controlled actions are represented, then cover the listed scalar, object, and enum conversions. Done means each requested conversion is available as an explicit quick action with validation coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, yaml
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.