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

Bugfix/43195 type completion issue #237

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

mpmartins
Copy link

@mpmartins mpmartins commented Jul 19, 2024

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.

Mario Martins added 7 commits July 10, 2024 14:43
@mpmartins
Copy link
Author

@microsoft-github-policy-service agree

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 this pull request may close these issues.

1 participant