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

DefaultSnippets quick suggestions don't show description if they overlap with const defined in if else #642

Closed
1 of 4 tasks
biellls opened this issue Nov 14, 2021 · 0 comments
Assignees
Milestone

Comments

@biellls
Copy link

biellls commented Nov 14, 2021

Describe the bug

Given the following schema:

{
    "title": "Example",
    "type": "object",
    "properties": {
        "foo": {
            "title": "Foo",
            "type": "string",
            "defaultSnippets": [
                {
                    "label": "foobar",
                    "markdownDescription": "# FooBar\n```Foo Bar```",
                    "body": "foobar"
                },
                {
                    "label": "foobaz",
                    "markdownDescription": "# FooBaz\n```Foo Baz```",
                    "body": "foobaz"
                }
            ]
        },
        "bar": {
            "title": "Bar",
            "type": "object",
            "default": {}
        }
    },
    "allOf": [
        {
            "if": {
              "properties": {
                "foo": {
                  "const": "foobar"
                }
              }
            },
            "then": {
                "properties": {
                    "bar": {
                        "properties": {
                            "barbar": {
                                "title": "BarBar",
                                "description": "Bar Bar Bar"
                              }
                        }
                    }
                }
            }
        },
        {
            "if": {
              "properties": {
                "foo": {
                  "const": "foobaz"
                }
              }
            },
            "then": {
                "properties": {
                    "bar": {
                        "properties": {
                            "barbaz": {
                                "title": "BarBaz",
                                "description": "Bar Baz Bar"
                              }
                        }
                    }
                }
            }
        }
    ]
}

Expected Behavior

The quick suggestions should show the snippets with descriptions.

Current Behavior

The snippet quick suggestions don't show any description.
Screen Shot 2021-11-14 at 8 19 05 PM

This is because the quick suggestions are using the const from the if elses in the "allOf" section instead of the snippets.

Steps to Reproduce

  1. Use the defined schema
  2. Type foo: and hit ctrl + space
  3. You can delete the key "defaultSnippets" and see that the suggestions don't change.
  4. If you delete the "allOf" section you will notice that the description does show like it should now.

Screen Shot 2021-11-14 at 8 31 56 PM

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants