redhat-developer / redhat-developer/vscode-yaml

wrong suggestion in completion with anyOf and enum by suggesting any value starting with same word

Open
#1,058 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
829
Forks
260
Avg merge
5h 43m
Merged PRs (30d)
1

Description

Describe the bug

When a property is suggested from an enum inside an any-of, it is completed with any enum starting with the same name followed with dash or with matching name : a vs a-dash, a vs adash , a vs aaa etc...

dash-completion issue

Expected Behavior

The expected behavior is to suggest only the related property defined to the name (here the version 3.0.x)

Current Behavior

The suggestion list contains the version of both properties.

Steps to Reproduce

  1. Just take the bug.json schema { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "http://bug-redhat-completion-with-dash.net", "properties": { "components": { "items": { "oneOf": [ { "properties": { "name": { "type": "string", "enum": [ "a-dash" ], "description": "a-dash", "default": "a-dash" }, "version": { "type": "string", "enum": [ "4.0.7", "4.0.6", "4.0.5" ], "default": "4.0.7" } }, "required": [ "name", "version" ], "title": "a-dash" }, { "properties": { "name": { "type": "string", "enum": [ "a" ], "description": "a", "default": "a" }, "version": { "type": "string", "enum": [ "3.0.1", "3.0.2" ], "default": "3.0.1" } }, "required": [ "name", "version" ], "title": "a" } ] }, "type": "array", "properties": { "name": { "type": "string" }, "version" : { "type": "string" } }, "required": [ "name", "version" ] } } }
  2. Define a yaml file attached to the schema using for instance inline attachment
  3. `# yaml-language-server: $schema=bug.json
    components:
  • name: a-dash
    version: "4.0.7"
  • name: a
    version: `

Environment

  • [ X] Windows
  • Mac
  • [X ] 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 by reproducing the issue with the inline bug.json schema and YAML example, then inspect the YAML completion entry point that handles oneOf/anyOf enum suggestions. Done means the version suggestions for the a item contain only its matching 3.0.x enum values, rather than values from the a-dash item.

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
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.