-
-
Notifications
You must be signed in to change notification settings - Fork 29
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 remaining issues with array newlines and equal sign spaces #66
Conversation
Hm, I think Ruma never explicitly opted into formatting, just sorting. Is it on by default? Running |
213b5d9
to
dc64b96
Compare
I had a copy/paste error, and with that fixed now, it breaks arrays that are longer than 80 bytes (yes, this is just the array part of the string). I'm pretty sure with the older version the formatting was less aggressive, we just kept more of the user's formatting. With the changes now it only reformats 2 missing commas and a multiline array into a single because it is under the 80 bytes. We could make the default 60 and the changes to Ruma's Cargo.toml would just be the 2 commas. |
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.
I just tested this and it looks pretty good! Is it supposed to always say that it has rewritten the file, even if no changes were done, when running in non-check mode?
Also, formatting currently removes trailing commas on multiline arrays, which I find wrong. Do you agree?
Finally, in workspaces where one crate has the same name as the workspace directory itself, it's a bit confusing to see two Checking main-crate
lines. How about either changing the messages to refer to the proper file path of the file that was checked, or printing a different message when the Cargo.toml
doesn't contain a [package]
section?
In any case, approving since this PR is a clear improvement so I wouldn't mind addressing all of those things separately from it.
I'd say this is a bug, it probably always has... I think.
Agreed, a few of the multiline formatting choices I like the idea about either printing file paths or check for At some point we can file issues for all these! |
Well, this fixes all the issues, I think. If you think this is reasonable, I would just add docs in the readme about the two new tomlfmt options (
max_array_line_len
andindent_count
) and it's ready to go. I could add the docs to the readme and it probably won't take me a whole year haha.