-
Notifications
You must be signed in to change notification settings - Fork 893
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
Support vertical alignment #1103
Comments
There is an ongoing effort to find out which style is preferred across the community. Maybe you should try your luck here: rust-lang/rfcs#1607 AFAIK rustfmt will stick to the style agreed on in the RFC. |
Thank you @duesee , I already did it. And I saw the RFC, it is targeting to get 'the decision process for the coding style', and it also said at last we will get the recommended style, and rustfmt will impl it as default style, leave others configurable. So whether the vertically align is choiced to be the recommended style, it can be implemented in rustfmt as a configuration. |
And another support is the gofmt use vertical alignment https://golang.org/doc/effective_go.html#formatting . |
Are there any updates? |
No, sorry. I would take a PR for this if there was a fairly complete implementation, but I don't have time to work on it myself and there is a lot of higher priority work (better support for the default options, basically) to point people at. |
Part of vertical-alignment effort of rust-lang#1103. Fixes rust-lang#1686
I guess there is still no update on this. Is this still true?
If yes, I would like to at least try to implement this feature, I really miss it 🙃 |
It would actually be really cool if it worked on per "code block" basis like this: // this would get vertically aligned
#[rustfmt::vertical_align]
const PLAYER_MONEY: f32 = 32.0;
const PLAYER_VERY_LOOOOONG_CONSTANT: u32 = 0;
// this would not since it's separated with a newline
const ENEMY_MONEY: f32 = 23.0;
const ENEMY_VERY_LOOOOONG_CONSTANT: u32 = 0; so it would be possible to tell it what to and what not to align vertically. |
Closing as this issue is quite old and has outlived its relevancy. The defaults were established many years ago and are not going change. However, those that prefer the vertical/visual layout can utilize existing options like indent_style and struct_field_align_threshold. There are certainly still gaps in places where vertical/visual alignment is only partially support and others not yet at all, but those are best tracked in their respective issues (e.g. #894). Anyone willing and interested in improving vertical/visual support should certainly feel free to do submit patches for review. |
Could the rustfmt support vertically align as default? At least it can be configured not to break the vertically aligned code when try to format codes include them.
Many people love it.
https://shkspr.mobi/blog/2014/11/why-i-vertically-align-my-code-and-you-should-too/
And another support is the gofmt use vertical alignment https://golang.org/doc/effective_go.html#formatting .
The text was updated successfully, but these errors were encountered: