Skip to content

bad completion with array of objects #793

@fbaligand

Description

@fbaligand

Describe the bug

Given that I have an array of objects in my schema; if in my YAML file, I add an array item, return to the line and invoke completion, the completion wrongly provides "{} - (array item) object" instead of the different properties available in my current object.

Here's a visual example:
test2

My JSON schema is the following:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "prop1": {
        "type": "string"
      },
      "prop2": {
        "type": "string"
      },
      "prop3": {
        "type": "string"
      }
    }
  }
}

Expected Behavior

In my example, completion should provide "prop2" and "prop3", and not "{} - (array item) object"

Current Behavior

In my example, completion actually provide "{} - (array item) object", and not "prop2" and "prop3"

Steps to Reproduce

  1. given the following YAML file:
- prop1: a
  
  1. go to 2nd line, write 2 spaces, and then do "Ctrl+Tab"
  2. you get the wrong completion list, that is to say "{} - (array item) object", and not "prop2" and "prop3"

Environment

  • Windows
  • Visual Studio Code
  • YAML extension v1.10.1 and also YAML extension v1.11.10112022

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions