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

Indent multiline bracketed expr with minimal amount of space #1116

Closed

Conversation

brandonchinn178
Copy link
Collaborator

Supercedes #1101

AFAICT, the only motivation for BracketStyle is to prevent the closing bracket from being in the same column as the opening bracket, which can be a parse error in certain contexts, like case patterns. So this only needs to indent by a single space, not a full indentation.

It's not that big of an issue here (1 vs 2 spaces), but it's a bigger issue with larger indentations. So I had to make this fix in Fourmolu anyway, but I'm opening this PR just in case you want to merge it upstream. IMO this encodes the intention better, but I recognize that the breakage might not be worthwhile

@mrkkrp
Copy link
Member

mrkkrp commented Jun 11, 2024

In my head, a code snippet is correctly indented iff all its lines start at columns that are divisible by the indentation step. I can see why it looks weird in Fourmolu with larger indentation, but Ormolu does not have that problem and so this change seems unnecessary.

@brandonchinn178
Copy link
Collaborator Author

@mrkkrp Understood. FWIW, there is at least one example where Ormolu does not indent along multiples of 2:

But I understand your point in general. I'll close this PR

@brandonchinn178 brandonchinn178 deleted the bchinn-multiline-brackets branch June 12, 2024 05:15
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