-
Notifications
You must be signed in to change notification settings - Fork 151
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
Inline comment to a record constructor leads to non idempotent behavior #426
Comments
It seems for me that I found a problem: for input data Foo
= Foo { foo :: Int } -- ^ foo
data Foo
= Foo
{ foo :: Int
} -- ^ foo
The question is open: what's our choice to fix this. In other words, what is the comment for a record constructor, is should it be attached to the constructor as inline comment, or after it as a following comment, splitting I'll try to implement one of these cases or maybe even both to compare results, when I have enough time. Your opinion is wellcome! |
Oh, I found a very nice solution! It's just to replace a check in takeNext ((ib, i) : items) ((cb, c) : comments)
- | blockStart ib == blockStart cb =
+ | blockEnd ib == blockStart cb =
Just (ib <> cb, NextItemWithComment i c, items, comments)
- | blockStart ib < blockStart cb =
+ | blockEnd ib < blockStart cb =
Just (ib, NextItem i, items, (cb, c) : comments)
| otherwise =
Just (cb, NextComment c, (ib, i) : items, comments) I don't understand, why it was Sorry for being too hurry sometimes and writing some not thoughtful enough comments (and then deliting them). |
Initial formatting
after the first run
after the second run
It was discovered by me at the same time as #425, but I think that this is another issue
The text was updated successfully, but these errors were encountered: