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

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

Open silverOrdeal opened this issue 2 years ago • 8 comments

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

  • [x] Windows
  • [ ] Mac
  • [ ] Linux
  • [ ] other (please specify)

silverOrdeal avatar Jan 26 '23 08:01 silverOrdeal

This is still broken as of 1.12.1 . Could someone have a look at it, since a list of validated values is most likely to be useful to other users, and this was a supported feature until recently ?

silverOrdeal avatar Mar 09 '23 09:03 silverOrdeal

Confirmed to be broken as of 1.12.2 . I also try to go through the settings in case something new was added. If the repo maintainer have acked the regression, could you please comment ? This is impacting moving to remote development with web ides, since customized yaml schemas are a big part of our deployment (and I assume many others, who rely on the extension in their day to day) .

silverOrdeal avatar Mar 27 '23 10:03 silverOrdeal

@gorkem / @msivasubramaniaan kindly pinging here for visibility, this is very impacting and is clearly a bug with autocompletion.

silverOrdeal avatar Apr 26 '23 22:04 silverOrdeal

This is affecting our team as well and is a fairly frustrating bug

LevonW-IIS avatar May 24 '23 21:05 LevonW-IIS

@gorkem / @msivasubramaniaan sorry to bother again, but tested on 1.13 it's still broken. Having this structure is the only way to allow descriptions for multiple options for each entry of a list, as enum does not support descriptions. It's pretty certain there are others who will hit this, as was commented by another user.

Currently I had to retrain a whole dev team to stick to 1.10 to not block operations. Let me know if I can inform or support in any other way.

behemothsecurity avatar Jun 05 '23 17:06 behemothsecurity

@gorkem / @msivasubramaniaan Qualified as still broken for 1.14. Probably a regression inherited from https://github.com/redhat-developer/yaml-language-server . This is still problematic for developer expererience on our end.

behemothsecurity avatar Jul 20 '23 11:07 behemothsecurity