redhat-developer / redhat-developer/vscode-yaml

Completion for "const" doesn't work inside "items"

Open
#1,011 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 I try to complete an array item which value is restricted by const nothing is suggested. But if I use enum instead of const, then completion brings up.

Expected Behavior

Completion should work in both cases.

Current Behavior

Already explained above.

Steps to Reproduce

Create JSON schema with the following content:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "array",
  "items": {
    "type": "string",
    "const": "pop"
  }
}

Create a test YAML file and link a JSON schema to it like this:

{
    "yaml.schemas": {
        "schema.json": "test.yaml"
    }
}

Try to type -<space> inside this test file and press Ctrl+Space to get no completion.

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 reproducing the issue with the provided draft-07 schema, linked test.yaml, and Ctrl+Space after typing an array item. Trace the YAML completion path for items with const and compare it with enum handling; done means the value "pop" is suggested in this scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.