Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: autocomplete indent on object within an array #751

Merged

Conversation

rickcowan
Copy link
Contributor

What does this PR do?

Fixes an issue where the indent is incorrect for an object within an array that is also within an array.

Given the following schema:

{
  "type": "object",
  "properties": {
    "array1": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["thing1"],
        "properties": {
          "thing1": {
            "type": "object",
            "required": ["array2"],
            "properties": {
              "array2": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": ["thing2", "type"],
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "thing2": {
                      "type": "object",
                      "required": ["item1", "item2"],
                      "properties": {
                        "item1": { "type": "string" },
                        "item2": { "type": "string" }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

When autocomplete is attempted on:

array1:
  - #cursor here

It previously autocompleted to:

array1:
  - thing1:
      array2:
        - type: 
          thing2:
          item1: 
          item2: 

After the fix it correctly indents as:

array1:
  - thing1:
      array2:
        - type: 
          thing2:
            item1: 
            item2: 

The prior code that added indentation should now be handled by this fix: #634

What issues does this PR fix or reference?

no ref

Is it tested? How?

Manual testing and unit test.

@coveralls
Copy link

coveralls commented Jul 21, 2022

Coverage Status

Coverage remained the same at 82.614% when pulling 1fb8ef0 on jigx-com:fix/object-indenting-main into 7d12372 on redhat-developer:main.

Copy link
Collaborator

@gorkem gorkem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution

Copy link
Contributor

@msivasubramaniaan msivasubramaniaan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for your contribution

@msivasubramaniaan msivasubramaniaan merged commit 1f1d47d into redhat-developer:main Jul 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants