vscode-yaml
vscode-yaml copied to clipboard
Invalid auto-complete when `const` is an object
Describe the bug
When the value of const is an object, the auto-complete for the property/instance is garbled and invalid.
Instead of:
foo:
bar: baz
It auto-completes as:
foo:
bar}: ${2:baz
Expected Behavior
Auto-complete for constant values should insert correctly, even when the constant is an object, as it does when the constant is an array, string, number, or null.
Current Behavior
Auto-complete inserts what appears to be a broken internal string.
Steps to Reproduce
-
Define a test schema as
test.schema.json:{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Schema with an object constant", "description": "Defines a schema with an object constant.", "type": "object", "properties": { "foo": { "title": "Property with an object constant", "const": { "bar": "baz" } } } } -
Define a test instance using that schema as
test.instance.yaml:# yaml-language-server: $schema=test.schema.json -
Type
foo, wait for IntelliSense, then press enter. -
Result:
# yaml-language-server: $schema=test.schema.yaml foo: bar}: ${2:baz -
Define a test instance as
test.schema.json{ "$schema": "test.schema.json" } -
Add a comma, then use IntelliSense to find the
fooproperty and press enter to auto-complete. -
Result:
{ "$schema": "test.schema.json", "foo": { "bar": "baz" } }
Environment
- [x] Windows
- [ ] Mac
- [ ] Linux
- [ ] other (please specify)