-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Don't break a line if it's too long because of comments #3329
Comments
Thanks @ichard26 for the tagging. Do you think there is already a setting for this? |
I want to mention the special case of pragma comments that exceed the line length limit. Moving pragmas to different lines might even break them from working, depending on the implementation of the tool. |
There is not and I don't think we'll add one either since we try to avoid adding formatting configuration options. We can consider changing the logic in the presence of comments though. |
Related: #1713. |
This might be way too disruptive and I might not be considering it all the way through, but I'd prefer Black to move the comment on a different line before the line that would be too long. But likely too optimistic 😅 |
Black will continue to take comments into account while enforcing line length. Line length limits exist to make it easy to read code in environments with fixed-width lines, and code includes comments. |
A long line is split into multiple lines if it exceeds the
black_line_length
setting.How to not take the comments into consideration to compute the line length?
Example:
Is there already a setting for this?
Currently the second example gives:
and I'd prefer to not break the line at all.
The text was updated successfully, but these errors were encountered: