Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a proposed fix for microsoft/vscode#43195, but more specifically for this use case: #205
After trying a few different solutions for this issue, we came up with a way to change the jsonCompletions.getValueCompletions() function to return all "type" or "@type" options while the user is still working on that property.
We noticed the issue happens because of how the jsonParser.validate.testAlternatives function handles the bestMatch logic.
The current behavior of the jsonCompletions.getValueCompletions() is to exclude the valueNode, which causes the schema validation for the types to fail only on types that have more required fields, but no other validation fails for the incomplete type value.
The new behavior is to make sure the valueNode for the type is not excluded from the validation making sure there is a validation issue for all alternatives. This causes the bestMatch logic to return all types until the user has finished typing the value.
The actual fix is simple enough and it doesn't seem to affect other scenarios. We included unit tests to make sure these scenarios are covered.
Feedback is welcome.