redhat-developer / redhat-developer/vscode-yaml

Code completion suggests the same property multiple times

Open
#890 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug

When a property is filled dynamically (using if/then/else) based on the value of another property, code completion shows multiple options of the same property (the original blank one and the dynamically chosen filled one)
Screen Shot 2023-02-24 at 1 33 07 PM
This behavior does not happen when using the same schema within a json file
Screen Shot 2023-02-24 at 1 32 56 PM

Expected Behavior

Only one code completion item should be shown: the updated property based on either the then or else clause

Current Behavior

Multiple code completion items are shown:

  1. the original empty property
  2. the updated property based on the active then or else clause

Steps to Reproduce

  1. download the attatched schema, json, and yaml files: redhat-yaml-issue.zip
  2. edit settings.json file to include the following lines:
"json.schemas": [
    {
      "fileMatch": [
        "/json.json"
      ],
      "url": "file:///path/to/files/schema.json"
    },
"yaml.schemas": {
    "file:///path/to/files/schema.json": [
      "yaml.yaml"
    ]
  },
  1. put curser on the line underneath the "enableGrandchild" object
  2. bring up code completion (ctrl+space on mac)

Environment

  • Windows
  • Mac
  • 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 downloading the attached redhat-yaml-issue.zip and following the settings.json, schema.json, json.json, and yaml.yaml reproduction steps. Compare completion results for JSON and YAML with the active if/then/else branch. Done means completion offers only the updated property once in the affected YAML case.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode, yaml
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.