-
Notifications
You must be signed in to change notification settings - Fork 11
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
associative binary operators #106
Comments
What's the point of contention here? The way it hangs the last line after reformatting, or the style of putting operators first? Personally I prefer the reformatted code aside from the dangle, so I don't think there's much to discuss there as it's going to be a preference thing, but if it's about avoiding the dangle when rearranging this I'd agree. If you bring that dangling expression onto the same line as the operator manually it won't reformat it to dangle, so there is room for a heuristic that will stop it from doing that when formatting existing code potentially. |
Unfortunately, it's difficult to reformat it without the dangling bit because that's a common stylistic choice for the trailing operand. I couldn't come up with a local heuristic like I could for the leading operands, other than to not support the dangling operand at all. It's possible one could do some kind of larger analysis on the operator chain, but I don't really want to write that. |
Yeah I like the It's the two dangles which I find distracting. There is a dangle after the first line, and a dangle before the last line. Anyway, it seems you're already aware of this case and have thought about it and have not yet written a solution because it's not worth it the effort, so fair enough. I don't really want to write it either. |
Indenting leading operators is by far the common style, and what I prefer. I don't have any intention of ever changing that as it's deliberate. If anyone wants to have a go at fixing the other, which would entail a heuristic for "correcting" a different style, I'm happy to consider it, but I also have no intention of doing it myself. |
I feel like
purs-tidy
’s treatment of associative binary operators could be improved.The text was updated successfully, but these errors were encountered: