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

Array indentation in autocomplete is broken after upgrade to 0.13 #376

Closed
yazaabed opened this issue Dec 14, 2020 · 18 comments
Closed

Array indentation in autocomplete is broken after upgrade to 0.13 #376

yazaabed opened this issue Dec 14, 2020 · 18 comments
Assignees
Labels
Milestone

Comments

@yazaabed
Copy link

yazaabed commented Dec 14, 2020

Hallo everyone! I hope you are having a good time!

We have upgraded our implementation on top of yaml-language-server to latest version. And after successfully finish all needed things, we noticed that the array required fields autocomplete is broken. After debugging we found out that it is because of a small change in the completion service here and the code was changed to this

Can you please give us a way to fix this issue? Or is it a bug from your side?

Thank you and Best regards!

@JPinkney
Copy link
Contributor

Do you have any particular schema and yaml that can reproduce the issue? I've just tried on VSCode with:

sample:
  - name: test
    email: test
    homepage: test
    role: test

and

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "name": "Package",
    "type": "object",
    "properties": {
        "sample": {
            "type": "array",
            "items": {
                "type": "object",
                "required": [
                    "name",
                    "email",
                    "homepage",
                    "role"
                ],
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string"
                    },
                    "homepage": {
                        "type": "string"
                    },
                    "role": {
                        "type": "string"
                    }
                }
            }
        }
    }
}

and haven't been able to reproduce yet

@yazaabed
Copy link
Author

Yes for first level array it is working fine but for nested arrays it is not working in the new version. For example we have this yaml.

components:
  - id: jsakdh
    type: list
    settings:
        data:
          arrayItems:
            - show: true
        id: asdgjajkdg <- this id here should be autocompleted under show not under data.

Schema

{
    "type": "object",
    "properties": {
        "components": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "type": {
                        "type": "string"
                    },
                    "settings": {
                        "type": "object",
                        "properties": {
                            "data": {
                                "type": "object",
                                "properties": {
                                    "arrayItems": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "required": [
                                                "id"
                                            ],
                                            "properties": {
                                                "show": {
                                                    "type": "boolean",
                                                    "default": true
                                                },
                                                "id": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

@JPinkney
Copy link
Contributor

Strange, I've just tested it on VSCode and everything is working as expected. Is this for monaco-yaml? If so I'll have to go in and test why it's behaving differently then VSCode

@yazaabed
Copy link
Author

Strange, I've just tested it on VSCode and everything is working as expected. Is this for monaco-yaml? If so I'll have to go in and test why it's behaving differently then VSCode

No Monaco-yaml didn't upgrade to latest language server yet. This is a custom yaml language worker within the company I am working with. It is the same implementation in Monaco-yaml, but with language server 0.13.

The one in monaco-yaml is 0.11.0.

@yazaabed
Copy link
Author

@JPinkney when I downgraded to 0.11 the issue is fixed. So I believe it is the recursive nested array.

@yazaabed
Copy link
Author

@JPinkney here is a screenshot of the items returned from the completion service.

Screenshot 2020-12-15 at 14 40 58

@evidolob
Copy link
Collaborator

@JPinkney I think it may be related to my changes in #332
I will give a look on this.

@evidolob evidolob self-assigned this Dec 15, 2020
@evidolob evidolob added the bug label Dec 15, 2020
@evidolob evidolob added this to the 0.14.0 milestone Dec 15, 2020
@evidolob evidolob removed the bug label Dec 15, 2020
@evidolob
Copy link
Collaborator

evidolob commented Dec 15, 2020

Hm, @yazaabed I test(on current master) your schema and completion works for me:
ezgif com-gif-maker (5)

@yazaabed
Copy link
Author

You need to do the autocomplete from the settings level not down. Please check the gif down.

Dec-15-2020 16-15-02

@evidolob
Copy link
Collaborator

OK, we definitely has a bug with completion:
ezgif com-gif-maker (6)
We add unneeded after settings completion, and for some reason not providing template for rest objects

@evidolob evidolob added the bug label Dec 15, 2020
@yazaabed
Copy link
Author

@evidolob thank you for your response. What we can do to fix it? Should I go back to the previous version? It will take time to go back because we removed most of the things. And new things like calculate links.

@evidolob
Copy link
Collaborator

@yazaabed I provide PR to fix this ASAP, we plan to release 0.14.0 on next week, so it up to you.

@evidolob
Copy link
Collaborator

Just FYI, I was able to reproduce this issue with :

{
    "type": "object",
    "properties": {
        "components": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "type": {
                        "type": "string"
                    },
                    "settings": {
                        "type": "object",
                        "required": ["data"],
                        "properties": {
                            "data": {
                                "type": "object",
                                "required": ["arrayItems"],
                                "properties": {
                                    "arrayItems": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "required": [
                                                "id"
                                            ],
                                            "properties": {
                                                "show": {
                                                    "type": "boolean",
                                                    "default": true
                                                },
                                                "id": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

evidolob added a commit to evidolob/yaml-language-server that referenced this issue Dec 16, 2020
Signed-off-by: Yevhen Vydolob <yvydolob@redhat.com>
@yazaabed
Copy link
Author

@yazaabed I provide PR to fix this ASAP, we plan to release 0.14.0 on next week, so it up to you.

Yeah it can wait, we will not release before next week. Thank you for your update.

@yazaabed
Copy link
Author

@evidolob I can help testing it locally with my schema. I will branch out from your branch and check.

@yazaabed
Copy link
Author

@evidolob Yes! It is working fine. Thank you 👍

test

@evidolob
Copy link
Collaborator

@yazaabed Can you add comment in to #379 ?

@yazaabed
Copy link
Author

@yazaabed Can you add comment in to #379 ?

Sure!

evidolob added a commit that referenced this issue Dec 16, 2020
Signed-off-by: Yevhen Vydolob <yvydolob@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants