-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
Regression: origStart is not accurate in some cases #126
Comments
Something weird is happening with the BlankLine node there; not sure if the issues are related. But I find it surprising that it's before rather than after the CollectionItem. Will investigate. |
Bother, the issues are indeed related, and they do get a bit complicated. There are three things going on here that are, when put together, a bit wrong:
So something's got to give here. I can fix most of the bugginess without any deeper changes, but that'll still leave some problematic cases where it's possible to end up with BlankLine nodes that have ranges that start after the start location of subsequent nodes. I'm pretty sure that this is isolated to map values, but that's because blank lines between most other prop comments & values are currently dropped. Now, there are three possible ways to fix this, and it's not obvious to me which one to go with:
I'm leaning towards the third option right now, but I'll at least sleep on this before picking a way forward. |
I went with the first option, at least for now. Blank lines that could appear between comments or a value and a preceding comment are in any case ignored by the AST level, and this should fix the actual bugs that were identified. Strictly speaking option 2 might've required a major version bump, as it would add a new prop type for nodes. Option 3 might work, but there's some special handling for map value comments at the AST level that breaks if the comments are nodes rather than props, as well as issues that come up with comments in compact in-line notation cases, where the reference to the surrounding item array is more complicated. All that added complexity just isn't worth it. |
Fix included in patch release 1.7.1. |
version: 1.7.0 (minimal reproducible version: 1.2.0)
The text was updated successfully, but these errors were encountered: