Skip to content

Conversation

@Alasdair
Copy link
Collaborator

This file makes two main improvements to the formatter. First and most importantly, it adds an AST diff check formatting. This means that if the syntax tree differs in any way (other than some minor permitted differences) after reformatting, this raises an error.

Secondly, we now preserve lined up match statements where possible, so in something like:

match x {
  0  => foo,
  32 => bar,
  _  => baz,
} 

The extra spaces after 0 and _ will be preserved, allowing the => to remain lined up. This happens when we detect that all the match expressions were lined up in the original source. This heuristic likely needs some tweaking to find the correct balance.

@github-actions
Copy link

Test Results

   16 files     36 suites   0s ⏱️
1 004 tests 1 001 ✅  3 💤 0 ❌
4 840 runs  4 798 ✅ 42 💤 0 ❌

Results for commit 16dbbe9.

@Alasdair Alasdair merged commit 4b0f709 into sail2 Oct 28, 2025
17 checks passed
@Alasdair Alasdair deleted the fmt_improvements3 branch October 28, 2025 15:10
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