redhat-developer / redhat-developer/vscode-yaml

`allOf` with condition breaks completion

Open
#919 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

While choosing suggested property value, Tab inserts <property-value>: <property-value> instead of just <property-value>:

image

Expected Behavior

<property-value> to be inserted instead of <property-value>: <property-value>.

Current Behavior

<property-value>: <property-value> being inserted.

Steps to Reproduce

Setup:

{
    "$schema": "http://json-schema.org/draft-07/schema",
    "definitions": {
        "version-property": {
            "description": "A syntax version\nhttps://taskfile.dev/usage/#getting-started",
            "type": "string",
            "enum": [
                "2"
            ]
        },
        "v2-properties": {
            "properties": {
                "version": {
                    "$ref": "#/definitions/version-property"
                }
            },
            "additionalProperties": false
        }
    },
    "title": "tasks",
    "description": "Tasks",
    "type": "object",
    "required": [
        "version"
    ],
    "properties": {
        "version": {
            "$ref": "#/definitions/version-property"
        }
    },
    "allOf": [
        {
            "if": {
                "properties": {
                    "version": {
                        "const": "2"
                    }
                }
            },
            "then": {
                "$ref": "#/definitions/v2-properties"
            }
        }
    ]
}

schema for some local YAML file via .vscode/settings.json

Try to complete version value and obtain this bug.

Environment

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

Original issue

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

Reproduce the completion in a YAML file using the schema and .vscode/settings.json configuration shown in the issue. Trace the completion handling for the allOf condition and compare the inserted text with the expected value; done means Tab inserts only , not the value followed by a duplicate key and value.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode, yaml
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.