Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks
cridam opened this issue Sep 26, 2024 · 0 comments

Comments

@cridam
Copy link

cridam commented Sep 26, 2024

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant