-
Notifications
You must be signed in to change notification settings - Fork 889
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
Add width for codeblocks in comments #5372
Add width for codeblocks in comments #5372
Conversation
Thank you for this! I'm in the process of prepping the next release but will circle back to this afterwards |
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.
Thanks this looks great! Couple small items but should be good to merge afterwards 🚀
- **Default value**: `100` | ||
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width) | ||
- **Stable**: No (tracking issue: [#5359](https://github.com/rust-lang/rustfmt/issues/5359)) | ||
|
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 think it would be good to include a link to the format_code_in_doc_comments
option, similar to what's done for other options https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#array_width
What do you think?
@@ -0,0 +1,17 @@ | |||
// rustfmt-max_width: 50 |
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.
These tests look good! However, we actually put tests for config option in a special directory, named configs
under the source and target dirs
Please move these when you get a chance, and with that move you may be able to rename the files (though don't feel obligated to do so)
https://github.com/rust-lang/rustfmt/tree/master/tests/source/configs
@calebcartwright Thanks for your review. I changed the docu and moved the tests to the config folder and renamed the files to mach with the tested option. Short question: In one of the test cases I wanted to use (and by that test) the default value, but there seems to be a check in the configs folder, that the config option has to be set explicitily (so I did that now). Or is there a way around it? |
Good question! It's actually better to have the options explicitly set. For these tests we're just trying to validate the formatting behavior when options have a certain value and not so concerned with using these to validate defaults. Once an option is stabilized we can't change the default and while options remain unstable there's still a chance that we could change the defaults, all of which makes it better for the system & idempotence tests to be explicit |
Everything looks good to me, thanks you and nice first contribution! |
Resolves #5359
Adds a new doc_comment_code_block_width configuration (default: 100), which limits the code blocks in comments, if format_code_in_doc_comments is true.