Skip to content

[Regression] Intellisense/Auto-Completion won't work for subschemas with type array since 1.11 #879

@silverOrdeal

Description

@silverOrdeal

Describe the bug

We rely on custom yaml configuration to setup particular systems. We validate these yaml files with json schema, and rely on the Intellisense/Autocompletion feature of this yaml extensions to expose the possible values, alongside a relevant description, since we have hundreds of values which need to be correct.

We recently had reports of developers that when accessing Intellisense (Control + Space ) , they suddenly had an empty box, with no longer the possible values.

Further investigation showed that the fault was on vscode auto-updating the YAML extension to 1.11 . Reverting to 1.10 succesfully restored functionality, but this is breaking workflows revolving around dynamic development environments, in the browser for example. Since we cannot specify required version in suggested workspace extensions ( .vscode/extensions.json), the remote environment will try to setup with the latest of every extensions - thus requiring a manual downgrade step.

Expected Behavior

Before 1.10

✅ String type with const

image

✅ Array type with const

image

✅ Array type with enum

image

Current Behavior

From 1.11

✅ String type with const

image

❌ Array type with const

image

Note that the validation aspect still works :

Note that the validation aspect still works, despite the autocompletion issue :

⚠️ Array type with const - validates, but does not autocomplete

image

✅ Array type with enum

image

Steps to Reproduce

  1. Create a workspace, where VSCode will validate yaml files using the demo schema below (in our case using .vscode/settings.json).
  2. Make sure you use the YAML extension version 1.10.1 - may need downgrading on the extension page
  3. Create a yaml file and test the validation and autocompletion
  4. Upgrade to 1.11 and compare behaviours
⚙️ settings.json
{
    "yaml.schemas": {
        ".\\custom_json_schema.json": "*.yaml",
      }
}
📝 Demonstration schema
{
    "title": "Demonstration Schema",
    "description": "Demonstrates Validation Glitch",
    "$schema": "http://json-schema.org/draft-07/schema#",
    "additionalProperties": false,
    "required": [
        "string_example",
        "array_example",
        "array_enum_example"
    ],
    "properties": {
        "string_example": {
            "title": "Constants for string",
            "type": "string",
            "description": "Shows behaviour when using a string with constants subschemas",
            "oneOf": [
                {
                    "const": "Option 1",
                    "description": "Sample Option 1",
                    "markdownDescription": "_Sample Option 1_"
                },
                {
                    "const": "Option 2",
                    "description": "Sample Option 2",
                    "markdownDescription": "_Sample Option 2_"
                }
            ]
        },

        "array_example": {
            "title": "Constants for array",
            "type": "array",
            "description": "Shows behaviour when using an array with constants subschemas",
            "items": {
                "type": "string",
                "anyOf": [
                    {
                        "const": "Option 1",
                        "description": "Sample Option 1",
                        "markdownDescription": "_Sample Option 1_"
                    },
                    {
                        "const": "Option 2",
                        "description": "Sample Option 2",
                        "markdownDescription": "_Sample Option 2_"
                    }
                ]
            }

        },

        "array_enum_example": {
            "title": "Enum for array",
            "type": "array",
            "description": "Shows behaviour when using an enum with constants subschemas",
            "items": {
                "type": "string",
                "enum": ["Option 1", "Option 2"]
            }
            
        }
    }
}

Environment

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions