swiftlang / swift-syntax

A set of Swift libraries for parsing, inspecting, generating, and transforming Swift source code.
Apache License 2.0
3.24k stars 413 forks source link

Fix `CodeGenerationFormat` to not add extra indentation, leave trailing spaces when adding newlines, or indent empty lines #2833

Closed roopekv closed 1 month ago

roopekv commented 2 months ago

This fixes multiple issues with CodeGenerationFormat. Files were re-generated with each commit, so the differences in formatting caused by each change to CodeGenerationFormat should be easy to review.

Fix CodeGenerationFormat to not add extra indentation

Fix CodeGenerationFormat to not leave trailing spaces when adding newlines

Fix CodeGenerationFormat to not indent empty lines

roopekv commented 1 month ago

@ahoppen is this good to go now?

ahoppen commented 1 month ago

Yes, let’s 🚢it

ahoppen commented 1 month ago

@swift-ci Please test

ahoppen commented 1 month ago

The macOS test failures are unrelated to your changes. I’m looking into them.

ahoppen commented 1 month ago

Sorry, there’s a merge conflict now. Could you rebase?

roopekv commented 1 month ago

Sure, just a moment.

roopekv commented 1 month ago

Done

ahoppen commented 1 month ago

@swift-ci Please test

ahoppen commented 1 month ago

@swift-ci Please test

ahoppen commented 1 month ago

@swift-ci Please test macOS

ahoppen commented 1 month ago

@swift-ci Please test macOS

ahoppen commented 1 month ago

@swift-ci Please test macOS