-
Notifications
You must be signed in to change notification settings - Fork 86
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
Allow the parser to add contextual help text to errors; Add contextual help text for parenthesized for loops #1828
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sezna
force-pushed
the
alex/error-help-text
branch
from
August 9, 2024 20:56
0e7338f
to
27b3166
Compare
Benchmark for edf0a55Click to view benchmark
|
swernli
reviewed
Aug 9, 2024
sezna
force-pushed
the
alex/error-help-text
branch
from
August 9, 2024 22:31
db2c617
to
330fbc3
Compare
Benchmark for 6215868Click to view benchmark
|
Benchmark for ada005dClick to view benchmark
|
swernli
approved these changes
Aug 9, 2024
ScottCarda-MS
approved these changes
Aug 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Given the problems users have faced with non-parenthesized for loop iterators (like this one), we wanted to provide some help text for the user in this situation.
Instead of just patching in a fix for precisely this situation, I wanted to use
miette
's great functionality for composable errors. So, with this change, can now compose any parse error with help text.I also manually implemented
Debug
forError
to omit the help text if it isn't present. This is primarily so this PR doesn't addNone
to every single parser expect test which tests errors. (Happy to revert this and update the tests if desired, but I really don't like spraying the diff with 1k lines of expect-test changes that just sayNone
)