-
-
Notifications
You must be signed in to change notification settings - Fork 265
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
fix: Limit error messages new line visualization (fixes #362) #609
fix: Limit error messages new line visualization (fixes #362) #609
Conversation
b8c7823
to
236d27d
Compare
`new_from_pos` and `new_from_span` only visualize newline characters if positions point to the newline characters.
236d27d
to
c35a751
Compare
Will conditional handling of newline characters violate the principle of least surprise? Is it possible to use pest to parse a grammar in which newlines characters are not treated as whitespace? That may be an example where the principle of least surprise is most dramatically violated. Maybe an example, before and after this fix, would help demonstrate that the behaviour is never surprising. |
This change (should) only impacts error rendering. When showing a snippet of source, the newlines are still visible as, well, newlines. The addition of One potential source of confusion is if |
Ok, sounds reasonable. Thanks. @tomtau feel free to add an example if you think it clarifies things. |
(I assigned |
Yeah, I haven't had a chance to look through any of the code yet, so I wouldn't know what I'm looking at at this point. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In retrospect I'm not completely certain I agree with the choice to visualize LF in this manner, but this is clearly an improvement on the status quo.
@glyn one of the error tests has an example where the Line 774 in 96eace8
\n , while some of the other error tests were fixed not to visualize the newline characters in their examples, because their positions didn't point to \n or \r .
|
new_from_pos
andnew_from_span
only visualize newlinecharacters if positions point to the newline characters.