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

Autocomplete not working when certain characters are in object property keys #474

Closed
3 tasks
SucculentGoose opened this issue May 26, 2021 · 2 comments
Closed
3 tasks
Labels

Comments

@SucculentGoose
Copy link

SucculentGoose commented May 26, 2021

Describe the bug

If there is a colon in a property key name, it breaks the auto complete dropdown from working. For example, if i have the following schema:

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "description": "test description",
    "additionalProperties": false,
    "properties": {
        "Test: Colon": {
            "additionalProperties": false,
            "type": "object",
            "properties": {
                "none": {
                    "type": "boolean",
                    "enum": [
                        true
                    ]
                }
            }
        }
    }
}

when using vscode with the extension, the following happens:
image

However, if you add quotes around the object key in the YAML, the autocomplete dropdown works as expected as you can see in the following image:
image

I have also found the same issue arises when using other special characters at the start of the object key property name. This issue seems to be similar to the issue fixed here: #435

Maybe if an object key starts with any non-alphanumeric/special characters, it should be quoted be default? And also if the object key contains a : it should also be quoted.

Steps to Reproduce

  1. Create a JSON schema using the schema from above
  2. When using this schema with the vscode-yaml extension, use ctrl+space to have the dropdown auto complete option appear and select the item in the dropdown (in this example it is Test: Colon
  3. See that when doing ctrl+space again under that object, it wont have the expected behavior where it has none as the selectable item in the dropdown.
  4. If you then wrap the Test: Colon in quotes, and do ctrl+space again it will now have none as a selectable item in the typeahead.

Environment

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

I originally created this issue in the vscode-yaml repo, but after coming back to it, it seems like it should actually be here.

@JPinkney
Copy link
Contributor

Should be fixed with #475. The fix will be available in our next release

@SucculentGoose
Copy link
Author

Thanks @JPinkney!

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