vscode-yaml icon indicating copy to clipboard operation
vscode-yaml copied to clipboard

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

Open cridam opened this issue 1 year ago • 0 comments

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)

cridam avatar Sep 26 '24 07:09 cridam