Skip to content

Add some more tests to pin down comment indentation in switches. #1180

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

Merged
merged 1 commit into from
Feb 23, 2023

Conversation

munificent
Copy link
Member

I spent a bunch of time investigating whether comments in switches that aren't inside a case body (i.e. not between the "case" line and some statement inside the case) should be indented to align with the cases or the bodies.

After trying a bunch of alternatives and running them on a big corpus, I concluded that the current behavior (always align to the cases) actually works very well in almost all real-world code. But it's not pinned down well by tests, so this does that.

I spent a bunch of time investigating whether comments in switches that
aren't inside a case body (i.e. not between the "case" line and some
statement inside the case) should be indented to align with the cases
or the bodies.

After trying a bunch of alternatives and running them on a big corpus,
I concluded that the current behavior (always align to the cases)
actually works very well in almost all real-world code. But it's not
pinned down well by tests, so this does that.
@munificent munificent requested a review from natebosch February 17, 2023 22:45
@munificent munificent merged commit 35a5d9f into patterns Feb 23, 2023
@munificent munificent deleted the switch-comment-tests branch February 23, 2023 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants