Skip to content
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: comment max width #511

Closed

Conversation

rileymichael
Copy link
Contributor

@rileymichael rileymichael commented Aug 20, 2024

FormattingOptions#maxWidth is not respected for double slash comments. This is because it wasn't using the supplied value, and instead checked against the static property com.google.googlejavaformat.java.Formatter.MAX_LINE_LENGTH. I was unable to find any documentation / discussion that would indicate this as being intentional.

Test cases that deduced maxWidth actually relied on this behavior in some cases. Some of the fixes in 84dbfae simply adjusted the number of /, while others relied on a specific maxWidth and so I manually line-broke the comments to preserve the behavior under test.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 20, 2024
@rileymichael rileymichael marked this pull request as ready for review August 20, 2024 20:43
@hick209
Copy link
Contributor

hick209 commented Aug 23, 2024

Wow, great catch! Thanks for the fix 😃

@facebook-github-bot
Copy link
Contributor

@hick209 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@hick209 merged this pull request in 5ff9fbb.

@rileymichael rileymichael deleted the fix/comment-max-width branch August 23, 2024 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants