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 #496

Closed
3 tasks
SucculentGoose opened this issue Apr 27, 2021 · 0 comments · Fixed by redhat-developer/yaml-language-server#475

Comments

@SucculentGoose
Copy link

SucculentGoose commented Apr 27, 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: redhat-developer/yaml-language-server#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.

Environment

  • Windows
  • [x ] Mac
  • Linux
  • other (please specify)
@SucculentGoose SucculentGoose changed the title Autocomplete not working when certain characters are in property keys Autocomplete not working when certain characters are in object property keys Apr 27, 2021
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 a pull request may close this issue.

1 participant